fix bugs in install scripts

master
Kebler Network System Administrator 2023-01-18 18:36:28 -08:00
parent bcba8bbfd4
commit 96bb6113d7
3 changed files with 9 additions and 10 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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 "$@"
(return 0 2>/dev/null) || uci_bash_shell_user_create "$@"