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 () { 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_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 [[ -f $BASH_SHELL_DEV/shell.env ]] && shell_process_directory $BASH_SHELL_DEV/shell.env
} }
load_shell_host () { load_shell_host () {
module_load shell-process-directory 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 () { load_shell_user () {

View File

@ -10,7 +10,7 @@ local DIR
local NAME local NAME
DIR=$1 DIR=$1
NAME=$2 NAME=$2
# echo finding $NAME in $DIR
# TODO use file instead for valid extensions # TODO use file instead for valid extensions
# allow explicit extension # 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)" 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 # find modules in reverse order so more specific ones override
DIR="${DIRS[cnt-i]}/modules" DIR="${DIRS[cnt-i]}/modules"
if [[ -d $DIR ]]; then if [[ -d $DIR ]]; then
# echo $DIR $MODULE
RES=$(module_confirm "$DIR" "$MODULE") RES=$(module_confirm "$DIR" "$MODULE")
[ $? -eq 0 ] && echo $RES && return 0 [ $? -eq 0 ] && echo $RES && return 0
fi fi

View File

@ -41,7 +41,7 @@ update_shell_host () {
} }
update_shell_network () { 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 git pull origin master
} }

View File

@ -60,13 +60,12 @@ export BASH_ENV="$BASH_SHELL_BASE/module.lib # module loading functions"
# DEFAULT DIRECTORY STRUCTURE # DEFAULT DIRECTORY STRUCTURE
# /shell # /shell
# -- base # $BASH_SHELL_BASE=/shell/base (default) is set in /etc/profile during setup # -- base # $BASH_SHELL_BASE=/shell/base (default) is set in /etc/profile during setup
# -- any
# -- host # -- host
# --<specific host>
# -- network # -- network
# -- networks # -- networks
# -- <network name> # -- <network name>
# -- <another network name> # -- <another network name>
# -- <hostname>
# -- $HOME/shell # user # -- $HOME/shell # user
# default loading preference is first in list is lowest and last is highest # default loading preference is first in list is lowest and last is highest
@ -79,22 +78,22 @@ declare parent
parent="$(dirname $BASH_SHELL_BASE)" parent="$(dirname $BASH_SHELL_BASE)"
# Any Host # Any Host
BASH_SHELL_ANY_HOST="${parent}/any/host" BASH_SHELL_HOST="${parent}/host"
# export BASH_SHELL_ALL_HOSTS=<some directory> # 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> # 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 # these are all the base directories to source
export BASH_SHELL_DIRS export BASH_SHELL_DIRS
# machine specific shell # machine specific shell
BASH_SHELL_HOST="$parent/$([[ -f /etc/hostname ]] && cat /etc/hostname || echo nohostname)" BASH_SHELL_HOSTNAME="$parent/$([[ -f /etc/hostname ]] && cat /etc/hostname || echo nohostname)"
# BASH_SHELL_HOST=<some directory> # BASH_SHELL_HOSTNAME=<some directory>
# if there is a host directory add it to list and export env var # 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_HOSTNAME ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOSTNAME " && export BASH_SHELL_HOSTNAME
[[ -d $BASH_SHELL_HOST ]] && export BASH_SHELL_HOST [[ -d $BASH_SHELL_HOSTNAME ]] && export BASH_SHELL_HOSTNAME
# if this directory exists it is included first in the sourcing # 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 # if allows on the develop scripts and modules, etc for later incorporation into a repo