moving host and network directories out of /any

master
David Kebler 2023-12-14 21:09:19 -08:00
parent 21dc81b1da
commit b9f98d36f4
4 changed files with 16 additions and 16 deletions

View File

@ -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 () {

View File

@ -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

View File

@ -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
}

View File

@ -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
# --<specific host>
# -- network
# -- networks
# -- <network name>
# -- <another network name>
# -- <hostname>
# -- <network name>
# -- <another network name>
# -- $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=<some directory>
[[ -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=<some directory>
[[ -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=<some directory>
BASH_SHELL_HOSTNAME="$parent/$([[ -f /etc/hostname ]] && cat /etc/hostname || echo nohostname)"
# BASH_SHELL_HOSTNAME=<some directory>
# 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