moved reload_user, add editor function, add wheel to groups check

add follow links option to _find
user hostnamectl to get host name
master
David Kebler 2023-02-23 10:03:47 -08:00
parent 0d4481e291
commit c6dc8e4487
6 changed files with 25 additions and 24 deletions

View File

@ -21,6 +21,12 @@ reload_shell () {
source $BASH_SHELL_BASE/load.sh $@ source $BASH_SHELL_BASE/load.sh $@
} }
reload_user() {
save=$PWD
exec su -l $USER
cd $save
}
load_custom_shell_env () { load_custom_shell_env () {
[[ -f $BASH_SHELL_HOST/shell.env ]] && source $BASH_SHELL_HOST/shell.env [[ -f $BASH_SHELL_HOST/shell.env ]] && source $BASH_SHELL_HOST/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

View File

@ -1,15 +1,11 @@
#!/bin/bash #!/bin/bash
# 00 will get loaded first
##
user_reload() {
save=$PWD
exec su -l $USER
cd $save
}
if [[ ! $(command -v arch) ]]; then
function arch() {
uname -m
}
fi
function function_list { function function_list {
if [ $1 ]; then if [ $1 ]; then
@ -74,21 +70,17 @@ grep -rnswl $1 -e $2 | more
} }
# edit files # edit files
# set the system editor using EDITOR environment variable # echo set the system editor using EDITOR environment variable
editor() { ${EDITOR} $1; } edit() { ${EDITOR:-nano} $@; }
gedit() { ${GEDITOR:-xed} $@; }
add-repo-key () { add-repo-key () {
gpg --keyserver keyserver.ubuntu.com --recv-key $1 gpg --keyserver keyserver.ubuntu.com --recv-key $1
gpg -a --export $1 | sudo apt-key add - gpg -a --export $1 | sudo apt-key add -
} }
osinfo () {
hostnamectl
echo kernel: $(uname -r)
echo machine: $(arch)
cat /etc/os-release
cat /etc/upstream-release/lsb-release
}
alias ssudo="ssudo " alias ssudo="ssudo "

View File

@ -2,7 +2,7 @@
module_load system-path module_load system-path
# if sudo user then give access to these paths # if sudo user then give access to these paths
if [[ $(groups | grep sudo ) ]]; then if [[ $(groups | grep -e sudo -e wheel ) ]]; then
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
fi fi

View File

@ -1 +0,0 @@
module_load logit

View File

@ -76,7 +76,7 @@ local HIDDEN
declare OPTION declare OPTION
declare OPTARG declare OPTARG
declare OPTIND declare OPTIND
while getopts 't:p:d:e:n:f:h' OPTION; do while getopts 't:p:d:e:n:f:hl' OPTION; do
case "$OPTION" in case "$OPTION" in
t) t)
TYPE=$OPTARG TYPE=$OPTARG
@ -108,6 +108,10 @@ case "$OPTION" in
HIDDEN=true HIDDEN=true
# echo "SOURCING TO DEPTH (0=any)" "$DEPTH" # echo "SOURCING TO DEPTH (0=any)" "$DEPTH"
;; ;;
l)
LINKS=-L
;;
*) *)
echo unknown option $OPTION echo unknown option $OPTION
;; ;;
@ -134,7 +138,7 @@ fi
# echo dir $DIR # echo dir $DIR
local FIND local FIND
FIND="command find $DIR" FIND="command find $LINKS $DIR"
FIND+=$([ ! $DEPTH == 0 ] && echo " -maxdepth $DEPTH ") FIND+=$([ ! $DEPTH == 0 ] && echo " -maxdepth $DEPTH ")
# FIND+=" -type $([ $TYPE ] && echo "$TYPE" || echo "f")" # FIND+=" -type $([ $TYPE ] && echo "$TYPE" || echo "f")"
TYPE=${TYPE:-f} TYPE=${TYPE:-f}
@ -206,7 +210,7 @@ source_dir () {
debug source_dir passed arguments: $* debug source_dir passed arguments: $*
debug function: source_dir debug function: source_dir
local FILES local FILES
FILES=$(_find "$@") # find function FILES=$(_find -l "$@") # find function
# echo $FILES >&2 # echo $FILES >&2
[[ $? -ne 0 ]] && return 1 [[ $? -ne 0 ]] && return 1
for f in $FILES; do for f in $FILES; do

View File

@ -90,7 +90,7 @@ BASH_SHELL_ANY_NETWORK=$parent/any/network
export BASH_SHELL_DIRS export BASH_SHELL_DIRS
# machine specific shell # machine specific shell
BASH_SHELL_HOST=$parent/$(hostname) BASH_SHELL_HOST="$parent/$(hostnamectl hostname)"
# BASH_SHELL_HOST=<some directory> # BASH_SHELL_HOST=<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_HOST ]] && BASH_SHELL_DIRS+="$BASH_SHELL_HOST " && export BASH_SHELL_HOST