From a13395e20501804f39a7c0dcd1db5d69a24b039e Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Sat, 21 Jan 2023 08:18:40 -0800 Subject: [PATCH] fix: dont tee load log (llog) to console -shows on container boot --- env/history.env | 1 - functions/01-basic | 1 + install/files/etc/profile | 4 ++-- install/scripts/copy-user.sh | 10 +--------- load.sh | 7 ++----- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/env/history.env b/env/history.env index 37fef9c..5b77271 100644 --- a/env/history.env +++ b/env/history.env @@ -1,7 +1,6 @@ # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth - # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 diff --git a/functions/01-basic b/functions/01-basic index 38ff1c2..ef82422 100644 --- a/functions/01-basic +++ b/functions/01-basic @@ -94,4 +94,5 @@ fsudo () # run a function as sudo [[ "$(type -t $1)" == "function" ]] && ARGS="$@" && sudo bash -c "$(declare -f $1); $ARGS" } + alias ssudo="ssudo " \ No newline at end of file diff --git a/install/files/etc/profile b/install/files/etc/profile index aa5f38b..9484057 100644 --- a/install/files/etc/profile +++ b/install/files/etc/profile @@ -64,9 +64,9 @@ else mkdir -p $HOME/logs touch $LOGIN_LOG llog () { - echo "$@" 2>&1 | tee -a $LOGIN_LOG + echo "$@" >> $LOGIN_LOG 2>&1 } - export -f llog + export -f llog llog "$(env | grep BASH)" echo "$(date)" > $LOGIN_LOG llog "non-interactive login shell for $USER" diff --git a/install/scripts/copy-user.sh b/install/scripts/copy-user.sh index 6ce62c8..f6d0d4a 100755 --- a/install/scripts/copy-user.sh +++ b/install/scripts/copy-user.sh @@ -5,8 +5,6 @@ install_dir=${install_dir:-"$(dirname $(dirname $(realpath "${BASH_SOURCE:-$0}") [[ $1 == "-d" ]] && { shift; subdir=test; shift; } || subdir=shell user=${1:-$USER} -echo $subdir $user $USER - [[ $(id -u $user 2> /dev/null) -eq 0 ]] [[ $(id -u $user 2> /dev/null) -eq 0 ]] && echo user is root use root user copy script, exiting && return 1 [[ ! $(id -u $user) -ge 1000 ]] && echo "no user $user or user not a regular" && return 2 @@ -16,8 +14,7 @@ echo $subdir $user $USER user_home=$( getent passwd $user | cut -d: -f6 ) [[ ! $user_home ]] && echo no user home directory for $user in which to install shell files, exiting && return 4 - -echo $subdir $user $USER $user_home $dir +# echo DEBUG: $subdir $user $USER $user_home $dir echo -e "*********** copying UCI BASH Shell .profile and bash_profile and .bashrc for user: $user *******" files=$(find $install_dir/files/user -type f) @@ -25,13 +22,8 @@ for file in $files; do install -C -m 660 -o $user -g ${2:-$user} $file $user_home done -# sed -i 's/BASH_SHELL_USER_DIR=/export "$user_home\/$dir/' $user_home/.bashrc - if [[ ! subdir == "shell" ]]; then echo "export BASH_SHELL_USER_DIR=$user_home/$subdir" >> $user_home/.ucishell -# var="export BASH_SHELL_USER_DIR=" -# using $dir -# sed -i "s:${var}*.:${var}${dir}:" $user_home/.bashrc fi echo -e "*********** create UCI BASH Shell directories for user in $dir *******" diff --git a/load.sh b/load.sh index 44e32f0..5c29443 100755 --- a/load.sh +++ b/load.sh @@ -23,7 +23,7 @@ reload_shell () { load_custom_shell_env () { [[ -f $BASH_SHELL_HOST/shell.env ]] && source $BASH_SHELL_HOST/shell.env - [[ -f $HOME/${BASH_SHELL_USER:-shell}/shell.env ]] && source $HOME/${BASH_SHELL_USER:-shell}/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 } @@ -51,8 +51,6 @@ load_shell_host_user_dev () { ###################### START LOAD SCRIPT ############################# -load_custom_shell_env - ([[ $BASH_ENV ]] && [[ ! $- == *i* ]] && [[ $BASH_USE_ALIAS ]]) && shopt -s expand_aliases # process the base directory by default @@ -77,7 +75,7 @@ module_load shell-process-directory # as set in shell.env for dir in ${1:-$BASH_SHELL_DIRS}; do # env | grep BASH - # echo base $dir + # echo loading dir $dir shell_process_directory $dir [[ "$dir" = "$BASH_SHELL_BASE" ]] && export BASH_SHELL_BASE_LOADED=true done @@ -101,4 +99,3 @@ export BASH_SHELL_LOADED=true # Note: $HOME/shell or $HOME/BASH_SHELL_USER are processed via $HOME/.bashrc -