From 96bb6113d74bf2229ae67e13936c36e028146b00 Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Wed, 18 Jan 2023 18:36:28 -0800 Subject: [PATCH] fix bugs in install scripts --- install/install.sh | 6 +++--- install/scripts/copy-root.sh | 2 +- install/scripts/copy-user.sh | 11 +++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/install/install.sh b/install/install.sh index c6ef3d3..063f129 100644 --- a/install/install.sh +++ b/install/install.sh @@ -8,9 +8,9 @@ uci_bash_shell_install () { echo "Detected The UCI BASH Shell install directory: BASH_INSTALL_DIR=$install_dir" echo "Detected The UCI BASH Shell base directory: BASH_SHELL_BASE=$BASH_SHELL_BASE" [[ $EUID -ne 0 ]] && usesudo=sudo - $usersudo $SHELL $BASH_SHELL_BASE/install/script/copy-etc.sh - echo $usersudo $SHELL $BASH_SHELL_BASE/install/script/copy-root.sh - [[ $(id -u $1 2> /dev/null) ]] && echo $usersudo $SHELL $BASH_SHELL_BASE/install/script/copy-user.sh $1 + $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 "$@" } # # if script was executed then call the function diff --git a/install/scripts/copy-root.sh b/install/scripts/copy-root.sh index 317cd19..0845730 100755 --- a/install/scripts/copy-root.sh +++ b/install/scripts/copy-root.sh @@ -3,7 +3,7 @@ uci_bash_shell_root_copy () { echo -e "************ copying uci shell .profile and .bashrc files to /root ********" group=root -files=$(find $BASH_SHELL_BASE/setup/root/ -type f) +files=$(find $install_dir/files/root -type f) for file in $files; do install -m 640 -o root -g $group $file /root; done } diff --git a/install/scripts/copy-user.sh b/install/scripts/copy-user.sh index fda3eb1..6963b95 100644 --- a/install/scripts/copy-user.sh +++ b/install/scripts/copy-user.sh @@ -1,6 +1,6 @@ #!/bin/bash -uci_bash_shelluser_copy () { +uci_bash_shell_user_create () { local user; local user_home; local dir user=${1:-$USER} dir=${2:-shell} @@ -12,10 +12,9 @@ user_home=$( getent passwd $user | cut -d: -f6 ) [[ ! $user_home ]] && echo no user home directory in which to install shell files, exiting && return 4 echo -e "*********** copying UCI BASH Shell .profile and bash_profile and .bashrc for user: $user *******" -mkdir -P -files=$(find $Install_dir/files/user -type f) +files=$(find $install_dir/files/user -type f) for file in $files; do -install -C -m 660 -o $user -g $user $file $user_home +install -C -m 660 -o $user -g ${2:-$user} $file $user_home done sed -i '/[[ $BASH_SHELL_BASE_LOADED = true ]]/ i\ BASH_SHELL_USER_DIR='$dir'' $user_home/.bashrc @@ -23,9 +22,9 @@ sed -i '/[[ $BASH_SHELL_BASE_LOADED = true ]]/ i\ BASH_SHELL_USER_DIR='$dir'' $u dir=$user_home/$dir echo -e "*********** create UCI BASH Shell directories for user in $dir *******" mkdir -p $dir/env $dir/functions $dir/modules $dir/ssh/config $dir/ssh/mounts $dir/startup -chown -R $user:$user $dir +chown -R $user:${2:-$user} $dir } # # if script was executed then call the function -(return 0 2>/dev/null) || uci_bash_shelluser "$@" \ No newline at end of file +(return 0 2>/dev/null) || uci_bash_shell_user_create "$@" \ No newline at end of file