diff --git a/lib/install.sh b/lib/install.sh index ca661f3..9f43e29 100755 --- a/lib/install.sh +++ b/lib/install.sh @@ -32,7 +32,7 @@ function prepare_lxd { echo "define lxd and assign to user <$USER>" sudo groupadd --force "$NEW_GROUP" sudo usermod --append --groups "$NEW_GROUP" "$(whoami)" - exec sg "$NEW_GROUP" "exec '$0' $(printf "'%s' " SESSION_RELOAD_REQUIRED "$@")" + exec sg "$NEW_GROUP" exec "$0 $TARGET SESSION_RELOAD_REQUIRED $@" # no further processing because exec has been called! else echo "user <$USER> already belongs to group !" @@ -40,75 +40,65 @@ function prepare_lxd { sudo /opt/miaou-bash/tools/idem_apt_install lxd btrfs-progs + override_lxd_service + # test lxdbr0 if ! lxc network info lxdbr0 &>/dev/null; then + echo "bridge down, so initialization will use default preseed..." - sudo lxd init - # cat < found implies it has been already initialized!" fi @@ -118,7 +108,8 @@ function prepare_lxd { set_alias 'll' 'list -c ns4mDN' # test environment container hostname - local env_container_hostname=$(lxc profile get default environment.container_hostname) + local env_container_hostname + env_container_hostname=$(lxc profile get default environment.container_hostname) if [[ -z "$env_container_hostname" ]]; then env_container_hostname=$(hostname -s) if env | grep -q container_hostname; then @@ -137,12 +128,6 @@ function prepare_lxd { echo -n "subuid, subgid allowing <$(whoami)> ..." printf "root:$(id -u):1\n" | sudo tee -a /etc/subuid /etc/subgid PREFIX="" echoinfo DONE - - # root:1000:1 - # root:100000:65536 - # _lxd:100000:65536 - # :100000:65536 - else echo "subuid, subgid allowing <$(whoami)> already done!" fi @@ -156,8 +141,8 @@ function prepare_lxd { fi if [[ ! -d "$HOME/LXD/BACKUP" ]]; then - echo -n "$HOME/LXD/SHARED creating ... " - mkdir "$HOME/LXD/SHARED" -p + echo -n "$HOME/LXD/BACKUP creating ... " + mkdir "$HOME/LXD/BACKUP" -p PREFIX="" echoinfo DONE else echo "folder <$HOME/LXD/BACKUP> already created!" @@ -169,11 +154,11 @@ function set_alias { local name="$1" local command="$2" if ! lxc alias list -f csv | grep -q "^$name,"; then - echo -n "define lxc alias $name ..." + echo -n "defining new lxc alias <$name> ..." lxc alias add "$name" "$command" PREFIX="" echoinfo OK else - echo "lxc alias "$name" already defined!" + echo "lxc alias <$name> already defined!" fi } @@ -329,7 +314,7 @@ function extra_dev_desktop { : } -function override_lxd_service_to_reload_nftables { +function override_lxd_service { local PREFIX="lxd:override" if [[ ! -d /etc/systemd/system/lxd.service.d ]]; then @@ -338,8 +323,10 @@ function override_lxd_service_to_reload_nftables { cat <