diff --git a/install.sh b/install.sh index d28a723..abbe482 100755 --- a/install.sh +++ b/install.sh @@ -4,7 +4,7 @@ BASEDIR=$PWD function usage { - echo 'usage: --host | --containers | --full' + echo 'usage: --host | --containers | --full | --one-container ' exit -1 } @@ -61,17 +61,26 @@ function install_containers { # install inside active LXC containers if [[ -f '/snap/bin/lxc' ]]; then for container in `/snap/bin/lxc list -c n --format csv`; do - echo "pushed to $container" - /snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r - /snap/bin/lxc exec "$container" -- sh -c "cd /opt/debian-bash && ./install.sh --host" + install_one_container $container + # echo "pushed to $container" + # /snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r + # /snap/bin/lxc exec "$container" -- sh -c "cd /opt/debian-bash && ./install.sh --host" + # echo done fi } function install_one_container { - echo "install container " + CT=$1 + echo "install container <$CT>" echo ------------------------- + # install inside one active LXC container + if [[ -f '/snap/bin/lxc' ]]; then + echo "pushed to $CT" + /snap/bin/lxc file push /opt/debian-bash "${CT}/opt/" -r + /snap/bin/lxc exec "$CT" -- sh -c "cd /opt/debian-bash && ./install.sh --host" + fi } PARAM1=$1 @@ -83,6 +92,14 @@ case $PARAM1 in "--containers") install_containers ;; + "--one-container") + CT=$2 + if [ ! -z $CT ]; then + install_one_container $CT + else + usage + fi + ;; "--full") install_host install_containers