From b9f98d36f47b4596cbf07dd2cad8f94610c0c66e Mon Sep 17 00:00:00 2001 From: David Kebler Date: Thu, 14 Dec 2023 21:09:19 -0800 Subject: [PATCH] moving host and network directories out of /any --- load.sh | 4 ++-- module.lib | 3 ++- modules/install-shell-repos.lib | 2 +- shell.env | 23 +++++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/load.sh b/load.sh index 01a09d4..45e5242 100755 --- a/load.sh +++ b/load.sh @@ -28,14 +28,14 @@ reload_user() { } load_custom_shell_env () { - [[ -f $BASH_SHELL_HOST/shell.env ]] && source $BASH_SHELL_HOST/shell.env + [[ -f $BASH_SHELL_HOSTNAME/shell.env ]] && source $BASH_SHELL_HOSTNAME/shell.env [[ -f $BASH_SHELL_USER_DIR/shell.env ]] && source $BASH_SHELL_USER_DIR/shell.env [[ -f $BASH_SHELL_DEV/shell.env ]] && shell_process_directory $BASH_SHELL_DEV/shell.env } load_shell_host () { module_load shell-process-directory - [[ -d $BASH_SHELL_HOST ]] && shell_process_directory $BASH_SHELL_HOST + [[ -d $BASH_SHELL_HOSTNAME ]] && shell_process_directory $BASH_SHELL_HOSTNAME } load_shell_user () { diff --git a/module.lib b/module.lib index fec1859..cabdf2f 100644 --- a/module.lib +++ b/module.lib @@ -10,7 +10,7 @@ local DIR local NAME DIR=$1 NAME=$2 -# echo finding $NAME in $DIR + # TODO use file instead for valid extensions # allow explicit extension FILE="$(command find -L ${DIR} -type f -name "${NAME}.mod" -o -name "${NAME}".lib -o -name "${NAME}".func -o -name "${NAME}".sh -o -name "${NAME}".env)" @@ -66,6 +66,7 @@ for ((i=1;i<=cnt;i++)); do # find modules in reverse order so more specific ones override DIR="${DIRS[cnt-i]}/modules" if [[ -d $DIR ]]; then + # echo $DIR $MODULE RES=$(module_confirm "$DIR" "$MODULE") [ $? -eq 0 ] && echo $RES && return 0 fi diff --git a/modules/install-shell-repos.lib b/modules/install-shell-repos.lib index 856ad74..d348570 100644 --- a/modules/install-shell-repos.lib +++ b/modules/install-shell-repos.lib @@ -41,7 +41,7 @@ update_shell_host () { } update_shell_network () { - cd $BASH_SHELL_ANY_NETWORK || { echo not directory $BASH_SHELL_ANY_NETWORK; return 2; } + cd $BASH_SHELL_NETWORK || { echo not directory $BASH_SHELL_NETWORK; return 2; } git pull origin master } diff --git a/shell.env b/shell.env index 3c97bfc..e01a748 100755 --- a/shell.env +++ b/shell.env @@ -60,13 +60,12 @@ export BASH_ENV="$BASH_SHELL_BASE/module.lib # module loading functions" # DEFAULT DIRECTORY STRUCTURE # /shell # -- base # $BASH_SHELL_BASE=/shell/base (default) is set in /etc/profile during setup -# -- any # -- host +# -- # -- network # -- networks -# -- -# -- -# -- +# -- +# -- # -- $HOME/shell # user # default loading preference is first in list is lowest and last is highest @@ -79,22 +78,22 @@ declare parent parent="$(dirname $BASH_SHELL_BASE)" # Any Host -BASH_SHELL_ANY_HOST="${parent}/any/host" +BASH_SHELL_HOST="${parent}/host" # export BASH_SHELL_ALL_HOSTS= -[[ -d $BASH_SHELL_ANY_HOST ]] && BASH_SHELL_DIRS+="$BASH_SHELL_ANY_HOST " && export BASH_SHELL_ANY_HOST +[[ -d $BASH_SHELL_HOST ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOST " && export BASH_SHELL_HOST -BASH_SHELL_ANY_NETWORK=$parent/any/network +BASH_SHELL_NETWORK=$parent/network # BASH_SHELL_ALL_NETWORKS= -[[ -d $BASH_SHELL_ANY_NETWORK ]] && BASH_SHELL_DIRS+="$BASH_SHELL_ANY_NETWORK " && export BASH_SHELL_ANY_NETWORK +[[ -d $BASH_SHELL_NETWORK ]] && BASH_SHELL_DIRS+="$BASH_SHELL_NETWORK " && export BASH_SHELL_NETWORK # these are all the base directories to source export BASH_SHELL_DIRS # machine specific shell -BASH_SHELL_HOST="$parent/$([[ -f /etc/hostname ]] && cat /etc/hostname || echo nohostname)" -# BASH_SHELL_HOST= +BASH_SHELL_HOSTNAME="$parent/$([[ -f /etc/hostname ]] && cat /etc/hostname || echo nohostname)" +# BASH_SHELL_HOSTNAME= # if there is a host directory add it to list and export env var -# [[ -d $BASH_SHELL_HOST ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOST " && export BASH_SHELL_HOST -[[ -d $BASH_SHELL_HOST ]] && export BASH_SHELL_HOST +# [[ -d $BASH_SHELL_HOSTNAME ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOSTNAME " && export BASH_SHELL_HOSTNAME +[[ -d $BASH_SHELL_HOSTNAME ]] && export BASH_SHELL_HOSTNAME # if this directory exists it is included first in the sourcing # if allows on the develop scripts and modules, etc for later incorporation into a repo