|
@ -1,9 +1,19 @@ |
|
|
#!/bin/bash |
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
[ `id -u` -ne 0 ] && echo 'root privilege required' && exit 1 |
|
|
|
|
|
|
|
|
|
|
|
BASEDIR=$PWD |
|
|
BASEDIR=$PWD |
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
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 |
|
|
|
|
|
|
|
@ -15,7 +25,7 @@ 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 |
|
|
|
|
|
|
|
@ -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 |
|
|
|
|
|
|
|
|
|
|
|
|