minor fix on user install script

master
Kebler Network System Administrator 2023-01-20 18:21:18 -08:00
parent 1bce77c432
commit a343849055
2 changed files with 5 additions and 4 deletions

View File

@ -10,7 +10,7 @@ uci_bash_shell_install () {
[[ $EUID -ne 0 ]] && usesudo=sudo [[ $EUID -ne 0 ]] && usesudo=sudo
$usersudo $SHELL $install_dir/scripts/copy-etc.sh $usersudo $SHELL $install_dir/scripts/copy-etc.sh
$usersudo $SHELL $install_dir/scripts/copy-root.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 # # if script was executed then call the function

7
install/scripts/copy-user.sh Normal file → Executable file
View File

@ -4,6 +4,7 @@ local user; local user_home; local subdir; local dir
install_dir=${install_dir:-"$(dirname $(dirname $(realpath "${BASH_SOURCE:-$0}")))"} install_dir=${install_dir:-"$(dirname $(dirname $(realpath "${BASH_SOURCE:-$0}")))"}
[[ $1 == "-d" ]] && { shift; subdir=test; shift; } || subdir=shell [[ $1 == "-d" ]] && { shift; subdir=test; shift; } || subdir=shell
user=${1:-$USER} user=${1:-$USER}
echo $subdir $user $USER echo $subdir $user $USER
[[ $(id -u $user 2> /dev/null) -eq 0 ]] [[ $(id -u $user 2> /dev/null) -eq 0 ]]
@ -36,11 +37,11 @@ fi
echo -e "*********** create UCI BASH Shell directories for user in $dir *******" echo -e "*********** create UCI BASH Shell directories for user in $dir *******"
sdir=$user_home/$subdir sdir=$user_home/$subdir
subdirs="alias env ssh/config ssh/mounts /startup" subdirs="alias env ssh/config ssh/mounts /startup"
for dir in $BASH_SHELL_BASE/.bash-shell-include; do for dir in $(cat $BASH_SHELL_BASE/.bash-shell-include); do
echo mkdir -p $sdir/$dir mkdir -p $sdir/$dir
done done
chown -R $user:$user $sdir
} }
echo chown -R $user:$user $sdir
# # if script was executed then call the function # # if script was executed then call the function
(return 0 2>/dev/null) || uci_bash_shell_user_create "$@" (return 0 2>/dev/null) || uci_bash_shell_user_create "$@"