refactor for shell.env files are loaded early at user login
parent
ea8c78f72c
commit
56be5950c8
11
load.sh
11
load.sh
|
@ -27,11 +27,12 @@ reload_user() {
|
||||||
cd $save
|
cd $save
|
||||||
}
|
}
|
||||||
|
|
||||||
load_custom_shell_env () {
|
# remove, loading in shell.env
|
||||||
[[ -f $BASH_SHELL_HOSTNAME/shell.env ]] && source $BASH_SHELL_HOSTNAME/shell.env
|
# load_custom_shell_env () {
|
||||||
[[ -f $BASH_SHELL_USER_DIR/shell.env ]] && source $BASH_SHELL_USER_DIR/shell.env
|
# [[ -f $BASH_SHELL_HOSTNAME/shell.env ]] && source $BASH_SHELL_HOSTNAME/shell.env
|
||||||
[[ -f $BASH_SHELL_DEV/shell.env ]] && shell_process_directory $BASH_SHELL_DEV/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 () {
|
load_shell_host () {
|
||||||
module_load shell-process-directory
|
module_load shell-process-directory
|
||||||
|
|
17
shell.env
17
shell.env
|
@ -79,28 +79,30 @@ BASH_SHELL_DIRS="$BASH_SHELL_BASE "
|
||||||
declare parent
|
declare parent
|
||||||
parent="$(dirname $BASH_SHELL_BASE)"
|
parent="$(dirname $BASH_SHELL_BASE)"
|
||||||
|
|
||||||
# Any Host
|
# Mainly used for installing scripts to the hostname directory (see below)
|
||||||
BASH_SHELL_HOST="${parent}/host"
|
BASH_SHELL_HOST="${parent}/host"
|
||||||
# export BASH_SHELL_ALL_HOSTS=<some directory>
|
|
||||||
[[ -d $BASH_SHELL_HOST ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOST " && export BASH_SHELL_HOST
|
[[ -d $BASH_SHELL_HOST ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOST " && export BASH_SHELL_HOST
|
||||||
|
# source any additional shell env
|
||||||
|
[[ -f $BASH_SHELL_HOST/shell.env ]] && source $BASH_SHELL_HOST/shell.env
|
||||||
|
|
||||||
BASH_SHELL_NETWORK=${parent}/network
|
BASH_SHELL_NETWORK=${parent}/network
|
||||||
# BASH_SHELL_ALL_NETWORKS=<some directory>
|
|
||||||
[[ -d $BASH_SHELL_NETWORK ]] && BASH_SHELL_DIRS+="$BASH_SHELL_NETWORK " && export BASH_SHELL_NETWORK
|
[[ -d $BASH_SHELL_NETWORK ]] && BASH_SHELL_DIRS+="$BASH_SHELL_NETWORK " && export BASH_SHELL_NETWORK
|
||||||
|
# source any additional shell env
|
||||||
|
[[ -f $BASH_SHELL_NETWORK/shell.env ]] && source $BASH_SHELL_NETWORK/shell.env
|
||||||
|
|
||||||
# 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 based on hostname
|
||||||
BASH_SHELL_HOSTNAME="$parent/$([[ -f /etc/hostname ]] && cat /etc/hostname || echo nohostname)"
|
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_HOSTNAME ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOSTNAME " && export BASH_SHELL_HOSTNAME
|
|
||||||
[[ -d $BASH_SHELL_HOSTNAME ]] && export BASH_SHELL_HOSTNAME
|
[[ -d $BASH_SHELL_HOSTNAME ]] && export BASH_SHELL_HOSTNAME
|
||||||
|
[[ -f $BASH_SHELL_HOSTNAME/shell.env ]] && source $BASH_SHELL_HOSTNAME/shell.env
|
||||||
|
|
||||||
# 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
|
||||||
BASH_SHELL_DEV=${BASH_SHELL_DEV:-/opt/shell}
|
BASH_SHELL_DEV=${BASH_SHELL_DEV:-/opt/shell}
|
||||||
[[ -d $BASH_SHELL_DEV ]] && export BASH_SHELL_DEV
|
[[ -d $BASH_SHELL_DEV ]] && export BASH_SHELL_DEV
|
||||||
|
[[ -f $BASH_SHELL_DEV/shell.env ]] && source $BASH_SHELL_DEV/shell.env
|
||||||
|
|
||||||
# #################### NETWORKING #########################
|
# #################### NETWORKING #########################
|
||||||
|
|
||||||
|
@ -119,6 +121,7 @@ export BASH_NETWORKS_DIR
|
||||||
[[ -f $HOME/.ucishell ]] && source $HOME/.ucishell > /dev/null
|
[[ -f $HOME/.ucishell ]] && source $HOME/.ucishell > /dev/null
|
||||||
# by default USER shell sources will be looked for under $HOME/shell
|
# by default USER shell sources will be looked for under $HOME/shell
|
||||||
export BASH_SHELL_USER_DIR=${BASH_SHELL_USER_DIR:-$HOME/shell}
|
export BASH_SHELL_USER_DIR=${BASH_SHELL_USER_DIR:-$HOME/shell}
|
||||||
|
[[ -f $BASH_SHELL_USER_DIR/shell.env ]] && source $BASH_SHELL_USER_DEV/shell.env
|
||||||
|
|
||||||
# now load and export bootstrap module loading functions library so it is always available even for non-interactive shells
|
# now load and export bootstrap module loading functions library so it is always available even for non-interactive shells
|
||||||
set -a;source $BASH_SHELL_BASE/module.base;set +a
|
set -a;source $BASH_SHELL_BASE/module.base;set +a
|
||||||
|
|
Loading…
Reference in New Issue