mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-17 09:01:49 +00:00
refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5f88f39dec
commit
044962d625
29
.pct-helpers
29
.pct-helpers
@ -216,20 +216,20 @@ xreadpass(){
|
|||||||
|
|
||||||
# Wait for /etc/inithooks.conf to be generated then cleared
|
# Wait for /etc/inithooks.conf to be generated then cleared
|
||||||
#
|
#
|
||||||
# tklWaitForSetup
|
# tklWaitForSetup ID
|
||||||
#
|
#
|
||||||
# for tkl inithooks doc see:
|
# for tkl inithooks doc see:
|
||||||
# https://www.turnkeylinux.org/docs/inithooks
|
# https://www.turnkeylinux.org/docs/inithooks
|
||||||
tklWaitForSetup(){
|
tklWaitForSetup(){
|
||||||
printf "# TKL setup, this may take a while"
|
printf "# TKL setup, this may take a while"
|
||||||
if [ -z $DRY_RUN ] ; then
|
if [ -z $DRY_RUN ] ; then
|
||||||
while ! $(lxc-attach $ID -- test -e /etc/inithooks.conf) ; do
|
while ! $(lxc-attach $1 -- test -e /etc/inithooks.conf) ; do
|
||||||
printf '.'
|
printf '.'
|
||||||
sleep ${TIMEOUT:=5}
|
sleep ${TIMEOUT:=5}
|
||||||
done
|
done
|
||||||
printf '+'
|
printf '+'
|
||||||
sleep ${TIMEOUT:=5}
|
sleep ${TIMEOUT:=5}
|
||||||
while ! [[ $(lxc-attach $ID -- cat /etc/inithooks.conf | wc -c) < 2 ]] ; do
|
while ! [[ $(lxc-attach $1 -- cat /etc/inithooks.conf | wc -c) < 2 ]] ; do
|
||||||
printf '.'
|
printf '.'
|
||||||
sleep ${TIMEOUT:=5}
|
sleep ${TIMEOUT:=5}
|
||||||
done
|
done
|
||||||
@ -483,6 +483,29 @@ pctCreateUbuntu(){
|
|||||||
@ lxc-attach $1 -- apt upgrade -y
|
@ lxc-attach $1 -- apt upgrade -y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# pctCreateTurnkey APP ID ARGS [PASS]
|
||||||
|
#
|
||||||
|
pctCreateTurnkey(){
|
||||||
|
local app=$1
|
||||||
|
shift
|
||||||
|
local TEMPLATE
|
||||||
|
getLatestTemplate '*-turnkey-'$app TEMPLATE
|
||||||
|
|
||||||
|
pctCreate $1 "$TEMPLATE" "$2" "$3"
|
||||||
|
|
||||||
|
tklWaitForSetup $1
|
||||||
|
|
||||||
|
sleep ${TIMEOUT:=5}
|
||||||
|
}
|
||||||
|
#
|
||||||
|
# pctUpdateTurnkey ID
|
||||||
|
#
|
||||||
|
pctUpdateTurnkey(){
|
||||||
|
@ lxc-attach $1 apt update
|
||||||
|
@ lxc-attach $1 -- apt upgrade -y
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# pctSet ID [ARGS [REBOOT]]
|
# pctSet ID [ARGS [REBOOT]]
|
||||||
|
|||||||
@ -70,11 +70,13 @@ echo "# Building config..."
|
|||||||
buildAssets
|
buildAssets
|
||||||
|
|
||||||
echo "# Creating CT..."
|
echo "# Creating CT..."
|
||||||
getLatestTemplate '.*-turnkey-nextcloud' TEMPLATE
|
pctCreateTurnkey 'nextcloud' $ID "$OPTS_STAGE_1" "$PASS"
|
||||||
pctCreate $ID "$TEMPLATE" "$OPTS_STAGE_1" "$PASS"
|
|
||||||
sleep ${TIMEOUT:=5}
|
|
||||||
|
|
||||||
tklWaitForSetup
|
#getLatestTemplate '.*-turnkey-nextcloud' TEMPLATE
|
||||||
|
#pctCreate $ID "$TEMPLATE" "$OPTS_STAGE_1" "$PASS"
|
||||||
|
#sleep ${TIMEOUT:=5}
|
||||||
|
#
|
||||||
|
#tklWaitForSetup $ID
|
||||||
|
|
||||||
echo "# Starting TKL UI..."
|
echo "# Starting TKL UI..."
|
||||||
# XXX might be a good idea to reaaad stuff from config...
|
# XXX might be a good idea to reaaad stuff from config...
|
||||||
@ -109,8 +111,7 @@ echo "# Disabling fail2ban..."
|
|||||||
@ lxc-attach $ID systemctl disable fail2ban
|
@ lxc-attach $ID systemctl disable fail2ban
|
||||||
|
|
||||||
echo "# Updating system..."
|
echo "# Updating system..."
|
||||||
@ lxc-attach $ID apt update
|
pctUpdateTurnkey $ID
|
||||||
@ lxc-attach $ID -- apt upgrade -y
|
|
||||||
|
|
||||||
echo "# Post config..."
|
echo "# Post config..."
|
||||||
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user