From a3438490552bb4493b9b8a9abee29a0e64c14f48 Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Fri, 20 Jan 2023 18:21:18 -0800 Subject: [PATCH] minor fix on user install script --- install/install.sh | 2 +- install/scripts/copy-user.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) mode change 100644 => 100755 install/scripts/copy-user.sh diff --git a/install/install.sh b/install/install.sh index 063f129..f4943a2 100644 --- a/install/install.sh +++ b/install/install.sh @@ -10,7 +10,7 @@ uci_bash_shell_install () { [[ $EUID -ne 0 ]] && usesudo=sudo $usersudo $SHELL $install_dir/scripts/copy-etc.sh $usersudo $SHELL $install_dir/scripts/copy-root.sh - [[ $(id -u $1 2> /dev/null) ]] && $usersudo $SHELL $install_dir/scripts/copy-user.sh "$@" + [[ $1 ]] && [[ $(id -u $1 2> /dev/null) ]] && $usersudo $SHELL $install_dir/scripts/copy-user.sh "$@" } # # if script was executed then call the function diff --git a/install/scripts/copy-user.sh b/install/scripts/copy-user.sh old mode 100644 new mode 100755 index e150976..6ce62c8 --- a/install/scripts/copy-user.sh +++ b/install/scripts/copy-user.sh @@ -4,6 +4,7 @@ local user; local user_home; local subdir; local dir 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 ]] @@ -36,11 +37,11 @@ fi echo -e "*********** create UCI BASH Shell directories for user in $dir *******" sdir=$user_home/$subdir subdirs="alias env ssh/config ssh/mounts /startup" -for dir in $BASH_SHELL_BASE/.bash-shell-include; do - echo mkdir -p $sdir/$dir +for dir in $(cat $BASH_SHELL_BASE/.bash-shell-include); do + mkdir -p $sdir/$dir done +chown -R $user:$user $sdir } -echo chown -R $user:$user $sdir # # if script was executed then call the function (return 0 2>/dev/null) || uci_bash_shell_user_create "$@" \ No newline at end of file