From 7dda3a28e712aeef65dba2b7fb2f9b5dd31db964 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 8 Jan 2024 04:15:19 +0300 Subject: [PATCH] testing... Signed-off-by: Alex A. Naanou --- .pct-helpers | 11 +++++++---- gate-traefik/make.sh | 1 + nextcloud/make.sh | 39 +++++++++------------------------------ ns/make.sh | 1 + ssh/make.sh | 1 + syncthing/make.sh | 1 + 6 files changed, 20 insertions(+), 34 deletions(-) diff --git a/.pct-helpers b/.pct-helpers index f845d1f..2a259f9 100644 --- a/.pct-helpers +++ b/.pct-helpers @@ -205,27 +205,30 @@ xreadpass(){ } +# Wait for /etc/inithooks.conf to be generated then cleared # # tklWaitForSetup # +# for tkl inithooks doc see: +# https://www.turnkeylinux.org/docs/inithooks tklWaitForSetup(){ printf "# TKL setup, this may take a while" if [ -z $DRY_RUN ] ; then while ! $(lxc-attach $ID -- test -e /etc/inithooks.conf) ; do printf '.' - sleep 5 + sleep ${TIMEOUT:=5} done printf '+' - sleep 5 + sleep ${TIMEOUT:=5} while ! [[ $(lxc-attach $ID -- cat /etc/inithooks.conf | wc -c) < 2 ]] ; do printf '.' - sleep 5 + sleep ${TIMEOUT:=5} done else printf '.+..' fi printf 'ready.\n' - sleep 5 + sleep ${TIMEOUT:=5} } diff --git a/gate-traefik/make.sh b/gate-traefik/make.sh index 69c2503..9e566e0 100755 --- a/gate-traefik/make.sh +++ b/gate-traefik/make.sh @@ -51,6 +51,7 @@ OPTS_STAGE_1="\ --storage local-lvm \ --rootfs local-lvm:$DRIVE \ --unprivileged 1 \ + --features nesting=1 \ ${PCT_EXTRA} \ " diff --git a/nextcloud/make.sh b/nextcloud/make.sh index cbaeb97..0713e3b 100755 --- a/nextcloud/make.sh +++ b/nextcloud/make.sh @@ -49,7 +49,7 @@ OPTS_STAGE_1="\ --storage local-lvm \ --rootfs local-lvm:$DRIVE \ --unprivileged 1 \ - --features nesting=1 + --features nesting=1 \ ${PCT_EXTRA} \ " @@ -68,29 +68,6 @@ getLatestTemplate '.*-turnkey-nextcloud' TEMPLATE pctCreate $ID "$TEMPLATE" "$OPTS_STAGE_1" "$PASS" sleep ${TIMEOUT:=5} -# hooking into tkl init process: -# - wait for /etc/inithooks.conf to be generated by: -# /usr/lib/inithooks/firstboot.d/29preseed -# this file existion would mean that the first stage of setup is -# done and we can do: -# lxc-attach $ID -- bash --login exit -# to launch interactive setup... -# XXX can we get console/log output while poling??? -# - inject a script into the chain to do our stuff -# Q: can we reuse tkl's scripts??? -# -# * another strategy would be generate our own inithooks.conf but -# this would require us to mount the ct volume before first boot... -# see: -# https://forum.proxmox.com/threads/pct-push-when-lxc-is-offline.116786/ -# * might be usefull to do both to: -# - maximize compatibility / change tolerance (tkl ui) (???) -# - skip dialogs we do not use... -# ...i.e. poll-patch-ui -# -# for tkl inithooks doc see: -# https://www.turnkeylinux.org/docs/inithooks - tklWaitForSetup echo "# Starting TKL UI..." @@ -98,14 +75,16 @@ echo "# Starting TKL UI..." echo "# Updating config..." # add gate IP to trusted_proxies... -@ lxc-attach $ID -- sed -i \ - -e "/trusted_domains/i\ 'trusted_proxies' =>\n array (\n '${GATE_LAN_IP}/32',\n )," \ - /var/www/nextcloud/config/config.php +@ lxc-attach $ID -- bash -c "\ + sed -i \ + -e \"/trusted_domains/i\ 'trusted_proxies' =>\n array (\n '${GATE_LAN_IP}/32',\n ),\" \ + /var/www/nextcloud/config/config.php" # add self IP to trusted_domains -- enable setup from local network... IP=${DRY_RUN:=$(lxc-attach $ID -- hostname -I)} -@ lxc-attach $ID -- sed -z -i \ - -e "s/\(trusted_domains[^)]*\)/\1 2 => '${IP/ *}',\n /" \ - /var/www/nextcloud/config/config.php +@ lxc-attach $ID -- bash -c "\ + sed -z -i \ + -e \"s/\(trusted_domains[^)]*\)/\1 2 => '${IP/ *}',\n /\" \ + /var/www/nextcloud/config/config.php" echo "# Copying assets..." @ pct-push-r $ID ./assets / diff --git a/ns/make.sh b/ns/make.sh index 8500e64..e899d19 100755 --- a/ns/make.sh +++ b/ns/make.sh @@ -50,6 +50,7 @@ OPTS_STAGE_1="\ --storage local-lvm \ --rootfs local-lvm:$DRIVE \ --unprivileged 1 \ + --features nesting=1 \ ${PCT_EXTRA} \ " diff --git a/ssh/make.sh b/ssh/make.sh index a933245..d761d00 100755 --- a/ssh/make.sh +++ b/ssh/make.sh @@ -50,6 +50,7 @@ OPTS_STAGE_1="\ --storage local-lvm \ --rootfs local-lvm:$DRIVE \ --unprivileged 1 \ + --features nesting=1 \ ${PCT_EXTRA} \ " diff --git a/syncthing/make.sh b/syncthing/make.sh index 9c7e026..54dd958 100755 --- a/syncthing/make.sh +++ b/syncthing/make.sh @@ -49,6 +49,7 @@ OPTS_STAGE_1="\ --storage local-lvm \ --rootfs local-lvm:$DRIVE \ --unprivileged 1 \ + --features nesting=1 \ ${PCT_EXTRA} \ "