31 lines
1.0 KiB
Bash
31 lines
1.0 KiB
Bash
#!/bin/bash
|
|
# assumes that bash is installed
|
|
#!/bin/bash
|
|
# must! be run as sudo
|
|
|
|
install_shell_base () {
|
|
# TODO have a cross distro package install
|
|
module_load distro
|
|
set_distro
|
|
|
|
[[ ! $(command -v git) ]] && echo git must be installed first && $INSTALL_PKGS git
|
|
# TODO, avoid which in all scripts. or put which in environment if not on machine
|
|
[[ ! $(command -v which) ]] && echo 'which' must be installed first && $INSTALL_PKGS which
|
|
echo $USER, $EUID
|
|
[[ ! $EUID -eq 0 ]] && { echo ERROR script must be run as root; return 2; }
|
|
echo I am ROOT, now running script
|
|
echo UCI user: $1
|
|
# TODO make the repo and clone values dynamic or bundle current base on sending machine a archive
|
|
mkdir -p /shell/base
|
|
git clone https://git.kebler.net/bash/shell-base.git /shell/base
|
|
chown -R ${1:-$1000}:${1:-1000} /shell
|
|
chmod -R +r /shell
|
|
|
|
/bin/bash /shell/base/install/install.sh ${1:-1000}
|
|
}
|
|
|
|
# # if script was executed then call the function
|
|
( return 0 2>/dev/null ) || install_shell_base $@
|
|
|
|
|