|
@ -1,10 +1,20 @@ |
|
|
#!/bin/bash |
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
[ `id -u` -ne 0 ] && echo 'root privilege required' && exit 1 |
|
|
|
|
|
|
|
|
|
|
|
BASEDIR=$PWD |
|
|
BASEDIR=$PWD |
|
|
|
|
|
|
|
|
if [[ ! $BASEDIR == '/opt/debian-bash' ]]; then |
|
|
|
|
|
|
|
|
function usage { |
|
|
|
|
|
echo 'usage: --host | --containers | --full' |
|
|
|
|
|
exit -1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function install_host { |
|
|
|
|
|
echo "install host" |
|
|
|
|
|
echo -------------- |
|
|
|
|
|
|
|
|
|
|
|
[ `id -u` -ne 0 ] && echo 'root privilege required' && exit 1 |
|
|
|
|
|
|
|
|
|
|
|
if [[ ! $BASEDIR == '/opt/debian-bash' ]]; then |
|
|
# download and filfull /opt/debian-bash, then run it from folder |
|
|
# download and filfull /opt/debian-bash, then run it from folder |
|
|
|
|
|
|
|
|
rm -rf /opt/debian-bash |
|
|
rm -rf /opt/debian-bash |
|
@ -15,11 +25,11 @@ if [[ ! $BASEDIR == '/opt/debian-bash' ]]; then |
|
|
tar -xzf master.tar.gz |
|
|
tar -xzf master.tar.gz |
|
|
mv debian-bash /opt/ |
|
|
mv debian-bash /opt/ |
|
|
cd /opt/debian-bash |
|
|
cd /opt/debian-bash |
|
|
./install.sh |
|
|
|
|
|
|
|
|
./install.sh -- |
|
|
rm -rf $TEMP |
|
|
rm -rf $TEMP |
|
|
exit 0 |
|
|
exit 0 |
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
|
#remove /etc/skel/.bashrc |
|
|
#remove /etc/skel/.bashrc |
|
|
rm /etc/skel/.bashrc |
|
|
rm /etc/skel/.bashrc |
|
@ -39,6 +49,20 @@ else |
|
|
fi |
|
|
fi |
|
|
done |
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
source /etc/bash.bashrc |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function install_containers { |
|
|
|
|
|
echo "install containers" |
|
|
|
|
|
echo -------------------- |
|
|
|
|
|
|
|
|
# install inside active LXC containers |
|
|
# install inside active LXC containers |
|
|
if [[ -f '/snap/bin/lxc' ]]; then |
|
|
if [[ -f '/snap/bin/lxc' ]]; then |
|
|
for container in `/snap/bin/lxc list -c n --format csv`; do |
|
|
for container in `/snap/bin/lxc list -c n --format csv`; do |
|
@ -48,5 +72,29 @@ else |
|
|
done |
|
|
done |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
source /etc/bash.bashrc |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function install_one_container { |
|
|
|
|
|
echo "install container <ONE>" |
|
|
|
|
|
echo ------------------------- |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PARAM1=$1 |
|
|
|
|
|
|
|
|
|
|
|
case $PARAM1 in |
|
|
|
|
|
"--host") |
|
|
|
|
|
install_host |
|
|
|
|
|
;; |
|
|
|
|
|
"--containers") |
|
|
|
|
|
install_containers |
|
|
|
|
|
;; |
|
|
|
|
|
"--full") |
|
|
|
|
|
install_host |
|
|
|
|
|
install_containers |
|
|
|
|
|
;; |
|
|
|
|
|
*) |
|
|
|
|
|
usage |
|
|
|
|
|
;; |
|
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
|