refactored script sourcing exludes to .bash-shell-ignore file
refacted load.sh and startup.sh accordingly and also used loop to process the shell repos switched from export to declare for module.lib allows multiple network domains to be set in shell.env. This allows primary and vpn setups moved docker and language files out of base added comment functionsmaster
parent
0ac5906eee
commit
5e45c1f23a
|
@ -0,0 +1,5 @@
|
||||||
|
*.off
|
||||||
|
*.md
|
||||||
|
*TODO*
|
||||||
|
LICENSE
|
||||||
|
*.sample
|
|
@ -1,7 +1,7 @@
|
||||||
# 00 will get loaded first
|
# 00 will get loaded first
|
||||||
|
|
||||||
# does root login with calls profile and loads all the shells
|
# does root login with calls profile and loads all the shells
|
||||||
alias sudo='sudo -i'
|
# alias sudo='sudo -i'
|
||||||
|
|
||||||
alias flist="function_list"
|
alias flist="function_list"
|
||||||
alias flistg="function_list | grep"
|
alias flistg="function_list | grep"
|
||||||
|
|
33
alias/docker
33
alias/docker
|
@ -1,33 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
if command -v docker >/dev/null 2>&1; then
|
|
||||||
|
|
||||||
#docker - add users to docker group to avoid needing sudo
|
|
||||||
# run a command on a container
|
|
||||||
# if [ $(which docker)]; then
|
|
||||||
|
|
||||||
alias dkcr="docker run"
|
|
||||||
# start a container
|
|
||||||
alias dkcs="docker start"
|
|
||||||
# restart all running containers
|
|
||||||
alias dkcrr="docker restart $(docker ps -q)"
|
|
||||||
# start all exited containers
|
|
||||||
alias dkcsu="docker start $(docker ps --filter "status=exited")"
|
|
||||||
# ls stopped, la all, l running
|
|
||||||
alias dkcls="docker ps --filter "status=exited""
|
|
||||||
alias dkcla="docker ps -a "
|
|
||||||
alias dkcl="docker ps "
|
|
||||||
alias dkil="docker images --digests=true"
|
|
||||||
alias dkir="docker rmi $(docker images -q)"
|
|
||||||
alias dks="sudo service docker"
|
|
||||||
alias dkcstpa="docker stop $(docker ps -a -q)"
|
|
||||||
# remove unrunning containers
|
|
||||||
alias dkcrm="docker rm $(docker ps -a -q)"
|
|
||||||
# stop and remove
|
|
||||||
alias dkcsrm="docker rm -f $(docker ps -a -q)"
|
|
||||||
# cleans out unused/dangling aufs volumes - run this occasionally
|
|
||||||
alias dkclean="docker volume ls -qf dangling=true | xargs -r docker volume rm"
|
|
||||||
alias dkde="gksudo gedit /etc/default/docker"
|
|
||||||
|
|
||||||
# else
|
|
||||||
# echo "docker not installed, aliases not loaded"
|
|
||||||
fi
|
|
9
app/pm2
9
app/pm2
|
@ -1,9 +0,0 @@
|
||||||
alias pmi="sudo pm2 install"
|
|
||||||
alias pms="sudo pm2 start"
|
|
||||||
alias pmstp="sudo pm2 stop"
|
|
||||||
alias pmr="sudo pm2 delete"
|
|
||||||
alias pmra="sudo pm2 delete all"
|
|
||||||
alias pmstpa="sudo pm2 stop all"
|
|
||||||
alias pmv="sudo pm2 save"
|
|
||||||
alias pml="sudo pm2 list"
|
|
||||||
alias pmm="sudo pm2 monit"
|
|
|
@ -2,3 +2,5 @@
|
||||||
# export EDITOR=atom
|
# export EDITOR=atom
|
||||||
# export ELECTRON_TRASH=gio
|
# export ELECTRON_TRASH=gio
|
||||||
export EDITOR=nano
|
export EDITOR=nano
|
||||||
|
|
||||||
|
export BROWSER=google-chrome
|
|
@ -21,7 +21,7 @@ function function_list() {
|
||||||
done
|
done
|
||||||
echo "${FUNCS[@]}"
|
echo "${FUNCS[@]}"
|
||||||
else
|
else
|
||||||
# will list all sourced/declared functions available
|
cp# will list all sourced/declared functions available
|
||||||
echo
|
echo
|
||||||
echo -e "\033[1;4;32m""Functions:""\033[0;34m"
|
echo -e "\033[1;4;32m""Functions:""\033[0;34m"
|
||||||
declare -F | grep -v "declare -f\s_" | awk {'print $3'}
|
declare -F | grep -v "declare -f\s_" | awk {'print $3'}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
function comment_line() {
|
||||||
|
local regex="${1:?}"
|
||||||
|
local file="${2:?}"
|
||||||
|
local comment_mark="${3:-#}"
|
||||||
|
sed -ri "s:^([ ]*)($regex):\\1$comment_mark\\2:" "$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
function uncomment_line() {
|
||||||
|
local regex="${1:?}"
|
||||||
|
local file="${2:?}"
|
||||||
|
local comment_mark="${3:-#}"
|
||||||
|
sed -ri "s:^([ ]*)[$comment_mark]+[ ]?([ ]*$regex):\\1\\2:" "$file"
|
||||||
|
}
|
54
lang/node
54
lang/node
|
@ -1,54 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if command -v node >/dev/null 2>&1; then
|
|
||||||
# echo addding node langauge stuff
|
|
||||||
# gives access to packages with bin in a project
|
|
||||||
path_append ./node_modules/.bin
|
|
||||||
path_append /opt/node-global-apps/bin
|
|
||||||
|
|
||||||
|
|
||||||
export NPM_REGISTRY=https://npm.kebler.net
|
|
||||||
alias nr="npm run"
|
|
||||||
alias nrs="npm -s run"
|
|
||||||
alias nt="npm -s test"
|
|
||||||
alias ntw="npm -s run testw"
|
|
||||||
alias npms="npm start"
|
|
||||||
alias npmlag="npm la --silent --depth=0 --global"
|
|
||||||
alias npmla="npm la --silent --depth=0"
|
|
||||||
alias npmlaf="npm la --silent | grep"
|
|
||||||
alias npmlsg="npm ls --silent --depth=0 --global"
|
|
||||||
alias npmlsf="npm ls --silent grep"
|
|
||||||
alias npmlsa="npm ls --silent"
|
|
||||||
alias npmls="npm ls --silent --depth=0"
|
|
||||||
# just npm install for install without saving into package.json
|
|
||||||
alias npmi="npm install --save"
|
|
||||||
alias npmr="npm uninstall --save"
|
|
||||||
alias npmio="npm install --save-optional"
|
|
||||||
alias npmro="npm uninstall --save-optional"
|
|
||||||
alias npmidv="npm install --save-dev"
|
|
||||||
alias npmidvnd="npm install --save-dev --package-lock-only --no-package-lock"
|
|
||||||
alias npmrdv="npm uninstall --save-dev"
|
|
||||||
alias npmig="npm install -g"
|
|
||||||
alias snpmig="sudo npm install -g"
|
|
||||||
alias npmrg="npm uninstall -g"
|
|
||||||
alias snpmrg="npm uninstall -g"
|
|
||||||
alias npmunpm="echo npm installed version && npm --version && echo npm latest version available && npm view npm@latest version && echo any key to continue npm upgrade or break && read && npm install -g npm@latest"
|
|
||||||
alias npmua="npm --depth=9999 update"
|
|
||||||
alias npmug="npm-check -g -u"
|
|
||||||
alias npmu="npm-check -u"
|
|
||||||
alias npmcc="ncu -p -a -u"
|
|
||||||
alias npmcdvc="ncu -d -a -u"
|
|
||||||
alias npmc="ncu -p"
|
|
||||||
alias npma="npm-add-dependencies"
|
|
||||||
# will publish to whichever is the default registry - confusing so commented out
|
|
||||||
# alias npmpub="npm publish --access public"
|
|
||||||
alias npmlrepub="npm publish --registry http://localhost:4873 --force --access restricted"
|
|
||||||
alias npmlpub="npm publish --registry http://localhost:4873 --access restricted"
|
|
||||||
alias npmnrepub="npm publish --registry https://npm.kebler.net --force --access restricted"
|
|
||||||
alias npmnpub="npm publish --registry https://npm.kebler.net --access restricted"
|
|
||||||
alias npmjspub="npm publish --registry https://registry.npmjs.org --access public"
|
|
||||||
alias yalcpush="nodemon -x 'yalc push'"
|
|
||||||
|
|
||||||
# else
|
|
||||||
# echo "node not installed, npm aliases not loaded"
|
|
||||||
fi
|
|
12
lang/python
12
lang/python
|
@ -1,12 +0,0 @@
|
||||||
alias python3="python3.8"
|
|
||||||
alias spip="sudo -H python3.8 -m pip"
|
|
||||||
alias spipi="sudo -H python3.8 -m pip install"
|
|
||||||
alias spipiu="sudo -H python3.8 -m pip install -U"
|
|
||||||
alias spipl="sudo -H python3.8 -m pip list"
|
|
||||||
alias spiplo="sudo -H python3.8 -m pip list --outdated"
|
|
||||||
alias pipu="pipx upgrade"
|
|
||||||
alias pipua="pipx upgrade-all"
|
|
||||||
alias pipupip="pipx upgrade pipx"
|
|
||||||
alias pipi="pipx install"
|
|
||||||
alias pipl="pipx list"
|
|
||||||
alias piplv="pipx list --verbose"
|
|
19
lang/yarn
19
lang/yarn
|
@ -1,19 +0,0 @@
|
||||||
alias ycc="yarn cache clean"
|
|
||||||
alias yr="yarn run"
|
|
||||||
alias ys="yarn run start"
|
|
||||||
alias ya="yarn add"
|
|
||||||
# alias yu="yarn upgrade"
|
|
||||||
alias yrm="yarn remove"
|
|
||||||
alias yao="yarn add --optional"
|
|
||||||
alias yad="yarn add --dev"
|
|
||||||
alias yl="yarn list --depth=0"
|
|
||||||
alias ylp="yarn list --depth=0 --pattern"
|
|
||||||
alias yu="yarn upgrade-interactive"
|
|
||||||
|
|
||||||
alias ylg="yarn global list --depth=0"
|
|
||||||
alias ylgp="yarn global list --depth=0 --pattern"
|
|
||||||
alias yag="yarn global add"
|
|
||||||
alias yrg="yarn global remove"
|
|
||||||
alias yug="yarn global upgrade-interactive"
|
|
||||||
|
|
||||||
alias ypub="yarn publish --access public"
|
|
65
load.sh
65
load.sh
|
@ -5,6 +5,14 @@
|
||||||
|
|
||||||
DIR=${1:-$(dirname ${BASH_SOURCE[0]})}
|
DIR=${1:-$(dirname ${BASH_SOURCE[0]})}
|
||||||
|
|
||||||
|
# uncomment for debuggin
|
||||||
|
# echo $USER running load script in $DIR
|
||||||
|
# echo callers
|
||||||
|
# caller
|
||||||
|
# echo $(ps -o comm= $PPID)
|
||||||
|
# echo -----
|
||||||
|
# echo $BASH_SHELL_DIRS
|
||||||
|
|
||||||
# source the required directory source function
|
# source the required directory source function
|
||||||
if [ ! -e "$BASH_SHELL_BASE/source-dir.func" ]; then
|
if [ ! -e "$BASH_SHELL_BASE/source-dir.func" ]; then
|
||||||
echo "!Unable to load sourcing function at $DIR/source-dir, shell not set up!"
|
echo "!Unable to load sourcing function at $DIR/source-dir, shell not set up!"
|
||||||
|
@ -13,23 +21,40 @@ else
|
||||||
source "$BASH_SHELL_BASE/source-dir.func"
|
source "$BASH_SHELL_BASE/source-dir.func"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "$BASH_SHELL_BASE/module.lib" ]; then
|
# if [ ! -e "$BASH_SHELL_BASE/module.lib" ]; then
|
||||||
echo "!Unable to load module library functions function at $DIR/module.lib, shell not set up!"
|
# echo "!Unable to load module library functions function at $DIR/module.lib, shell not set up!"
|
||||||
return 1
|
# return 1
|
||||||
else
|
# else
|
||||||
source "$BASH_SHELL_BASE/module.lib"
|
# source "$BASH_SHELL_BASE/module.lib"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# REMOVED sourced via env directory
|
function shell_get_ignores () (
|
||||||
# [ -e "$DIR/options" ] && . $DIR/options
|
local file=${1:-"$BASH_SHELL_BASE"}/.bash-shell-ignore
|
||||||
|
[[ ! -f "$file" ]] && [[ $1 ]] && return 1
|
||||||
|
local excludes=''
|
||||||
|
local ignores=$(cat "$file")
|
||||||
|
for exclude in $ignores ; do
|
||||||
|
excludes+='"'$exclude'" '
|
||||||
|
done
|
||||||
|
echo $excludes
|
||||||
|
return 0
|
||||||
|
)
|
||||||
|
|
||||||
function shell_process_directory () {
|
function shell_process_directory () {
|
||||||
local SUBDIRS
|
local SUBDIRS
|
||||||
local DIR
|
local DIR
|
||||||
local DSUBDIRS
|
local DSUBDIRS
|
||||||
|
local excludes
|
||||||
|
|
||||||
DIR=${1:-$BASH_SHELL_BASE}
|
DIR=${1:-$BASH_SHELL_BASE}
|
||||||
# echo soucring directory $DIR
|
# echo soucring directory $DIR
|
||||||
|
if [[ $DIR = "$BASH_SHELL_BASE" ]]; then
|
||||||
|
BASH_SHELL_IGNORE=$(shell_get_ignores)
|
||||||
|
excludes=$BASH_SHELL_IGNORE
|
||||||
|
else
|
||||||
|
excludes=$(shell_get_ignores $DIR)
|
||||||
|
[[ $? -ne 0 ]] && excludes=$BASH_SHELL_IGNORE
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d "$DIR" ]; then
|
if [ -d "$DIR" ]; then
|
||||||
if [ "$DIR" = "$BASH_SHELL_BASE" ] && [ "$BASH_SHELL_BASE_LOADED" = "true" ]; then
|
if [ "$DIR" = "$BASH_SHELL_BASE" ] && [ "$BASH_SHELL_BASE_LOADED" = "true" ]; then
|
||||||
|
@ -44,15 +69,16 @@ fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$DIR/$BASH_SHELL_LOAD" ] && [ "$DIR" != "$BASH_SHELL_BASE" ]; then
|
if [ -f "$DIR/load.sh" ] && [ "$DIR" != "$BASH_SHELL_BASE" ]; then
|
||||||
# echo "$DIR/$BASH_SHELL_LOAD" found, running instead of default processing
|
# echo "$DIR/$BASH_SHELL_LOAD" found, running instead of default processing
|
||||||
source "$DIR/$BASH_SHELL_LOAD"
|
source "$DIR/load.sh"
|
||||||
else
|
else
|
||||||
# default processing
|
# default processing
|
||||||
local SUBDIRS
|
local SUBDIRS
|
||||||
local DSUBDIRS
|
local DSUBDIRS
|
||||||
# default subdirectories to source
|
# default subdirectories to source
|
||||||
# TODO allow passing in additional directories
|
# TODO allow passing in additional directories
|
||||||
|
|
||||||
DSUBDIRS="function alias env misc lang app"
|
DSUBDIRS="function alias env misc lang app"
|
||||||
IFS=' ' read -r -a SUBDIRS <<< "${2:-$DSUBDIRS}"
|
IFS=' ' read -r -a SUBDIRS <<< "${2:-$DSUBDIRS}"
|
||||||
# echo ${SUBDIRS[@]}
|
# echo ${SUBDIRS[@]}
|
||||||
|
@ -62,7 +88,8 @@ fi
|
||||||
# echo processing subdirectory $DIR/$SUBDIR
|
# echo processing subdirectory $DIR/$SUBDIR
|
||||||
# must quote all globs to avoid bash glob expansion which is likely on
|
# must quote all globs to avoid bash glob expansion which is likely on
|
||||||
# TODO have default set of ignores plus check for .shell-ignore
|
# TODO have default set of ignores plus check for .shell-ignore
|
||||||
source_dir -p "archive" -x '"*.off" "*.md" "*TODO*" "LICENSE" "*.sample"' -d 0 $DIR/$SUBDIR
|
# source_dir -p "archive" -x '"*.off" "*.md" "*TODO*" "LICENSE" "*.sample"' -d 0 $DIR/$SUBDIR
|
||||||
|
source_dir -p "archive" -x "$excludes" -d 0 $DIR/$SUBDIR
|
||||||
# else
|
# else
|
||||||
# echo no subdirectory $DIR/$SUBDIR to process, ignorning
|
# echo no subdirectory $DIR/$SUBDIR to process, ignorning
|
||||||
fi
|
fi
|
||||||
|
@ -79,14 +106,14 @@ fi
|
||||||
unset BASH_SHELL_BASE_LOADED
|
unset BASH_SHELL_BASE_LOADED
|
||||||
unset BASH_SHELL_LOADED
|
unset BASH_SHELL_LOADED
|
||||||
|
|
||||||
shell_process_directory # process base
|
# echo bash shell dirs: $BASH_SHELL_DIRS
|
||||||
export BASH_SHELL_BASE_LOADED=true
|
DIRS=${1:-$BASH_SHELL_DIRS}
|
||||||
# process network
|
|
||||||
shell_process_directory "$BASH_SHELL_NETWORK/all"
|
for dir in $DIRS; do
|
||||||
[ $NETWORKNAME ] && shell_process_directory "$BASH_SHELL_NETWORK/$NETWORKNAME"
|
# echo $dir
|
||||||
# process host
|
shell_process_directory $dir
|
||||||
shell_process_directory "$BASH_SHELL_HOST/all"
|
[[ $dir == "$BASH_SHELL_BASE" ]] && BASH_SHELL_BASE_LOADED=true
|
||||||
shell_process_directory "$BASH_SHELL_HOST/$(hostname)"
|
done
|
||||||
|
|
||||||
export BASH_SHELL_LOADED=true
|
export BASH_SHELL_LOADED=true
|
||||||
|
|
||||||
|
|
10
module.lib
10
module.lib
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo loading module library
|
||||||
|
|
||||||
module_confirm () {
|
module_confirm () {
|
||||||
local FILE
|
local FILE
|
||||||
local DIR
|
local DIR
|
||||||
|
@ -98,10 +100,12 @@ module_loaded () {
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# exported for login environment
|
# exported for login environment
|
||||||
export -f module_load
|
declare -f -x module_load
|
||||||
export -f module_find
|
declare -f -x module_find
|
||||||
export -f module_confirm
|
declare -f -x module_confirm
|
||||||
|
|
||||||
|
|
||||||
function test_modules {
|
function test_modules {
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
|
|
|
@ -7,4 +7,5 @@
|
||||||
# echo ----
|
# echo ----
|
||||||
# echo sourcing $BASH_SHELL_LOAD
|
# echo sourcing $BASH_SHELL_LOAD
|
||||||
|
|
||||||
|
|
||||||
source $BASH_SHELL_LOAD
|
source $BASH_SHELL_LOAD
|
||||||
|
|
|
@ -13,24 +13,14 @@
|
||||||
# main /etc/profile loaded for all logins
|
# main /etc/profile loaded for all logins
|
||||||
# more info see http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html
|
# more info see http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html
|
||||||
|
|
||||||
export LOGIN_LOG=$HOME/logs/login.log
|
|
||||||
mkdir -p $HOME/logs
|
|
||||||
touch $LOGIN_LOG
|
|
||||||
llog () {
|
|
||||||
echo "$@" 2>&1 | tee -a $LOGIN_LOG
|
|
||||||
}
|
|
||||||
export -f llog
|
|
||||||
|
|
||||||
# Set the initial path
|
# Set the initial path
|
||||||
export PATH=/bin:/usr/bin:/usr/local/bin
|
export PATH=/bin:/usr/bin:/usr/local/bin
|
||||||
|
|
||||||
# set directory for base shell repo
|
# set directory for base shell repo
|
||||||
export BASH_SHELL_BASE=/opt/bash/shell/base # where
|
export BASH_SHELL_BASE=/opt/bash/shell/base # where
|
||||||
# now bootstrap by souring the shell repo envinroment
|
# now bootstrap by souring the shell repo envinroment
|
||||||
. $BASH_SHELL_BASE/shell.env
|
. $BASH_SHELL_BASE/shell.env
|
||||||
|
# uncomment to NOT load the BASH SHELL Repos for interactive login shell
|
||||||
llog "$(env | grep BASH)"
|
# NO_LOGIN_BASHRC=true
|
||||||
|
|
||||||
if [[ $- == *i* ]]; then # interactive?
|
if [[ $- == *i* ]]; then # interactive?
|
||||||
echo interactive login shell
|
echo interactive login shell
|
||||||
if [[ ! $NO_LOGIN_BASHRC ]]; then
|
if [[ ! $NO_LOGIN_BASHRC ]]; then
|
||||||
|
@ -48,6 +38,15 @@ if [[ $- == *i* ]]; then # interactive?
|
||||||
unset RED GREEN NORMAL
|
unset RED GREEN NORMAL
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
export LOGIN_LOG=$HOME/logs/login.log
|
||||||
|
mkdir -p $HOME/logs
|
||||||
|
touch $LOGIN_LOG
|
||||||
|
llog () {
|
||||||
|
echo "$@" 2>&1 | tee -a $LOGIN_LOG
|
||||||
|
}
|
||||||
|
export -f llog
|
||||||
|
llog "$(env | grep BASH)"
|
||||||
echo "$(date)" > $LOGIN_LOG
|
echo "$(date)" > $LOGIN_LOG
|
||||||
llog "non-interactive login shell for $USER"
|
llog "non-interactive login shell for $USER"
|
||||||
if [ -d /etc/profile.d ]; then
|
if [ -d /etc/profile.d ]; then
|
||||||
|
@ -60,3 +59,4 @@ else
|
||||||
unset i
|
unset i
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
mkdir -p $BASH_SHELL_BASE/setup/etc/profile.d
|
||||||
|
mkdir -p $BASH_SHELL_BASE/setup/user
|
||||||
|
mkdir -p $BASH_SHELL_BASE/setup/root
|
||||||
|
cp /etc/profile $BASH_SHELL_BASE/setup/etc
|
||||||
|
cp /etc/bash.bashrc $BASH_SHELL_BASE/setup/etc
|
||||||
|
cp /etc/profile.d/02-root.sh $BASH_SHELL_BASE/setup/etc/profile.d
|
||||||
|
cp /etc/profile.d/03-startup.sh $BASH_SHELL_BASE/setup/etc/profile.d
|
||||||
|
cp $HOME/.bash_profile $BASH_SHELL_BASE/setup/user
|
||||||
|
cp $HOME/.profile $BASH_SHELL_BASE/setup/user
|
||||||
|
cp $HOME/.bashrc $BASH_SHELL_BASE/setup/user
|
||||||
|
cp $HOME/.bash_logout $BASH_SHELL_BASE/setup/user
|
||||||
|
cp /root/.bash_profile $BASH_SHELL_BASE/setup/root
|
||||||
|
cp /root/.profile $BASH_SHELL_BASE/setup/root
|
||||||
|
cp /root/.bashrc $BASH_SHELL_BASE/setup/root
|
||||||
|
cp /root/.bash_logout $BASH_SHELL_BASE/setup/root
|
|
@ -1,6 +1,5 @@
|
||||||
# echo $USER .bash_profile
|
# echo $USER .bash_profile
|
||||||
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
|
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
|
||||||
source $BASH_SHELL_LOAD
|
|
||||||
if [ -f ~/.bashrc ]; then
|
if [ -f ~/.bashrc ]; then
|
||||||
. ~/.bashrc
|
. ~/.bashrc
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
# echo $USER .bashrc
|
echo $USER .bashrc
|
||||||
|
|
|
@ -1,9 +1,2 @@
|
||||||
# ~/.profile: executed by Bourne-compatible login shells.
|
# ~/.profile: executed by Bourne-compatible login shells.
|
||||||
|
|
||||||
echo $USER .profile
|
echo $USER .profile
|
||||||
|
|
||||||
if [ "$BASH" ]; then
|
|
||||||
if [ -f ~/.bashrc ]; then
|
|
||||||
. ~/.bashrc
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
#!/bin/bash
|
||||||
|
|
||||||
# when leaving the console clear the screen to increase privacy
|
# when leaving the console clear the screen to increase privacy
|
||||||
|
|
||||||
if [ "$SHLVL" = 1 ]; then
|
if [ "$SHLVL" = 1 ]; then
|
||||||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#now
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# uncomment for debuggin
|
# uncomment for debugging
|
||||||
echo ".bash_profile sourced at user $USER login"
|
# echo ".bash_profile sourced at user $USER login"
|
||||||
|
|
||||||
# [[ $- == *i* ]] && [[ -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc"
|
# only source .bashrc if interactive login shell
|
||||||
|
[[ $- == *i* ]] && [[ -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# echo "$USER .bashrc"
|
# echo "$USER .bashrc"
|
||||||
|
|
||||||
# processing user's shell directory
|
# processing user's shell repo if base was loaded
|
||||||
[[ $BASH_SHELL_BASE_SOURCED = true ]] && \
|
[[ $BASH_SHELL_BASE_LOADED = true ]] && \
|
||||||
BASH_SHELL_USER=${BASH_SHELL_USER:-"bash/shell"} && \
|
BASH_SHELL_USER=${BASH_SHELL_USER:-"bash/shell"} && \
|
||||||
shell_process_directory "$HOME/$BASH_SHELL_USER"
|
shell_process_directory "$HOME/$BASH_SHELL_USER"
|
||||||
|
|
45
shell.env
45
shell.env
|
@ -1,13 +1,13 @@
|
||||||
# Shell Repos to Source
|
#!/bin/bash
|
||||||
|
# Shell Repos Environment
|
||||||
|
echo loading shell.env
|
||||||
# if bash is not the shell don't bother to continue
|
# if bash is not the shell don't bother to continue
|
||||||
[ ! "$SHELL" = "/bin/bash" ] && return 1
|
[ ! "$SHELL" = "/bin/bash" ] && return 1
|
||||||
|
|
||||||
# sourced for non-login interactive shells
|
# sourced for non-login interactive shells
|
||||||
# sourced via /etc/bash.bashrc so for all machine users
|
# sourced via /etc/bash.bashrc so for all machine users
|
||||||
# $BASH_SHELL_BASE # this MUST be set in /etc/profile
|
# $BASH_SHELL_BASE # this MUST be set in /etc/profile
|
||||||
# $BASH_SHELL_NETWORK/all
|
# $BASH_SHELL_NETWORK/all
|
||||||
# $BASH_SHELL_NETWORK/$NETWORKNAME
|
# $BASH_SHELL_NETWORK/(array of Domains)
|
||||||
# $BASH_SHELL_HOST/all
|
# $BASH_SHELL_HOST/all
|
||||||
# $BASH_SHELL_HOST/<hostname>
|
# $BASH_SHELL_HOST/<hostname>
|
||||||
# also
|
# also
|
||||||
|
@ -36,18 +36,29 @@ export BASH_SHELL_STARTUP=$BASH_SHELL_BASE/startup.sh # strtup.sh is default
|
||||||
export BASH_ENV=$BASH_SHELL_LOAD # use base repo
|
export BASH_ENV=$BASH_SHELL_LOAD # use base repo
|
||||||
# if not using implicit sourcing for non-interactive shells then on can do this per script
|
# if not using implicit sourcing for non-interactive shells then on can do this per script
|
||||||
##################
|
##################
|
||||||
# source $BASH_SHELL_BASE/$BASH_SHELL_BASE/${$BASH_SHELL_LOAD:-load.sh}
|
# expanding aliases is optional
|
||||||
# shopt -s expand_aliases
|
# shopt -s expand_aliases
|
||||||
|
# source $BASH_SHELL_LOAD
|
||||||
# < your script code >
|
# < your script code >
|
||||||
# shopt -u expand_aliases
|
# shopt -u expand_aliases
|
||||||
####################
|
####################
|
||||||
|
|
||||||
# identify a network name that this host resides on
|
# identify a network name that this host resides on
|
||||||
# like hostname but for the LAN network
|
# make a directory of the same name
|
||||||
# if unset then only /all will be sourced
|
# if unset then only /all will be sourced
|
||||||
export NETWORKNAME=238
|
export NETWORK_DOMAINS=(238.kebler.net 645.kebler.net)
|
||||||
# will use $BASH_SHELL_NETWORK/$NETWORKNAME under this directory unless specifically set
|
# network domain folder entry will be made for each domain set, first is home domain, others via vpn
|
||||||
|
if [[ $NETWORK_DOMAINS ]]; then
|
||||||
|
export NETWORK_HOME=${NETWORK_DOMAINS[0]}
|
||||||
export BASH_SHELL_NETWORK=/opt/bash/shell/network
|
export BASH_SHELL_NETWORK=/opt/bash/shell/network
|
||||||
|
declare domain
|
||||||
|
BASH_SHELL_NETWORK_DIRS=""
|
||||||
|
for domain in "${NETWORK_DOMAINS[@]}"; do
|
||||||
|
BASH_SHELL_NETWORK_DIRS+="${BASH_SHELL_NETWORK}/${domain} "
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
unset domain
|
||||||
|
export BASH_SHELL_NETWORK_DIRS
|
||||||
|
|
||||||
# will use $BASH_SHELL_HOST/<hostname> unless specifically set
|
# will use $BASH_SHELL_HOST/<hostname> unless specifically set
|
||||||
export BASH_SHELL_HOST=/opt/bash/shell/host
|
export BASH_SHELL_HOST=/opt/bash/shell/host
|
||||||
|
@ -56,5 +67,21 @@ export BASH_SHELL_HOST=/opt/bash/shell/host
|
||||||
# but can be user set below to $HOME/$BASH_SHELL_USER
|
# but can be user set below to $HOME/$BASH_SHELL_USER
|
||||||
# export BASH_SHELL_USER=<some directory under $HOME>
|
# export BASH_SHELL_USER=<some directory under $HOME>
|
||||||
|
|
||||||
# load and export module loading functions library
|
temp="
|
||||||
|
$BASH_SHELL_BASE
|
||||||
|
$BASH_SHELL_NETWORK/all
|
||||||
|
${BASH_SHELL_NETWORK_DIRS[@]}
|
||||||
|
$BASH_SHELL_HOST/all
|
||||||
|
$BASH_SHELL_HOST/$(hostname)
|
||||||
|
"
|
||||||
|
|
||||||
|
export BASH_SHELL_DIRS=$(echo $temp)
|
||||||
|
|
||||||
|
# env | grep BASH
|
||||||
|
# env | grep NETWORK_DIRS
|
||||||
|
# echo ---------------------------------
|
||||||
|
# echo $BASH_SHELL_DIRS
|
||||||
|
# echo ---------------------------------
|
||||||
|
|
||||||
|
# now load and export module loading functions library
|
||||||
source $BASH_SHELL_BASE/module.lib
|
source $BASH_SHELL_BASE/module.lib
|
||||||
|
|
10
startup.sh
10
startup.sh
|
@ -4,15 +4,7 @@ function startup_load () {
|
||||||
local SDIRS
|
local SDIRS
|
||||||
local SDIR
|
local SDIR
|
||||||
local DIRS
|
local DIRS
|
||||||
DIRS=( \
|
[[ $1 ]] && DIRS=("$1") || DIRS=("${BASH_SHELL_DIRS}")
|
||||||
$BASH_SHELL_BASE \
|
|
||||||
$BASH_SHELL_NETWORK/all \
|
|
||||||
$BASH_SHELL_NETWORK/$NETWORKNAME \
|
|
||||||
$BASH_SHELL_HOST/all \
|
|
||||||
$BASH_SHELL_HOST/$(hostname) \
|
|
||||||
)
|
|
||||||
echo directories ${DIRS[*]}
|
|
||||||
[[ $1 ]] && DIRS=("$1")
|
|
||||||
llog "startup directories to try ${DIRS[*]}"
|
llog "startup directories to try ${DIRS[*]}"
|
||||||
SDIRS=()
|
SDIRS=()
|
||||||
j=0
|
j=0
|
||||||
|
|
Reference in New Issue