mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-17 09:01:49 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3963fdd97e
commit
da2837a80d
117
.pct-helpers
117
.pct-helpers
@ -49,6 +49,7 @@ would-like(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Fill section...
|
||||
#
|
||||
@ -148,6 +149,7 @@ hostname2ct(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
normpath(){
|
||||
@ -161,34 +163,9 @@ normpath(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# pveGetLatestTemplate PATTERN [VAR]
|
||||
#
|
||||
# see:
|
||||
# https://pve.proxmox.com/wiki/Linux_Container
|
||||
pveGetLatestTemplate(){
|
||||
if [ $DRY_RUN ] ; then
|
||||
[ -z $2 ] \
|
||||
|| eval "$2=${CT_TEMPLATE:-\\\$CT_TEMPLATE}"
|
||||
return
|
||||
fi
|
||||
|
||||
#@ pveam update
|
||||
|
||||
local templates=($(pveam available | grep -o ''${1}'.*$'))
|
||||
local latest=${templates[-1]}
|
||||
|
||||
@ pveam download local ${latest}
|
||||
|
||||
latest=$(pveam list local | grep -o "^.*$latest")
|
||||
#latest=($(ls /var/lib/vz/template/cache/${1}*))
|
||||
|
||||
[ -z $2 ] \
|
||||
|| eval "$2=${latest}"
|
||||
}
|
||||
|
||||
#
|
||||
# xread [-n] MSG VAR
|
||||
#
|
||||
@ -286,32 +263,8 @@ xreadpass(){
|
||||
}
|
||||
|
||||
|
||||
# Wait for /etc/inithooks.conf to be generated then cleared
|
||||
#
|
||||
# tklWaitForSetup ID
|
||||
#
|
||||
# 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 $1 -- test -e /etc/inithooks.conf) ; do
|
||||
printf '.'
|
||||
sleep ${TIMEOUT:=5}
|
||||
done
|
||||
printf '+'
|
||||
sleep ${TIMEOUT:=5}
|
||||
while ! [[ $(lxc-attach $1 -- cat /etc/inithooks.conf | wc -c) < 2 ]] ; do
|
||||
printf '.'
|
||||
sleep ${TIMEOUT:=5}
|
||||
done
|
||||
else
|
||||
printf '.+..'
|
||||
fi
|
||||
printf 'ready.\n'
|
||||
sleep ${TIMEOUT:=5}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# readConfig
|
||||
@ -341,6 +294,7 @@ readConfig(){
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# saveConfig [-d|-a] CONFIG VAR ..
|
||||
#
|
||||
@ -376,6 +330,7 @@ saveConfig(){
|
||||
} >> "$cfg"
|
||||
}
|
||||
|
||||
|
||||
saveLastRunConfig(){
|
||||
local cfg=config.last-run
|
||||
echo "# Saving config to: config.last-run"
|
||||
@ -387,7 +342,10 @@ saveLastRunConfig(){
|
||||
saveConfig -d -a "$cfg" ${XREAD_VARS[@]}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# webAppConfig NAME
|
||||
#
|
||||
webAppConfig(){
|
||||
local name=${1^^}
|
||||
eval "${name}_SUBDOMAIN=\${${name}_SUBDOMAIN:=\${DFL_SUB${name}_DOMAIN}}
|
||||
@ -403,6 +361,7 @@ webAppConfig(){
|
||||
DOMAIN=
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# readVars
|
||||
#
|
||||
@ -621,6 +580,9 @@ buildAssets(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# pctPushAssets ID
|
||||
#
|
||||
@ -629,6 +591,33 @@ pctPushAssets(){
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# pveGetLatestTemplate PATTERN [VAR]
|
||||
#
|
||||
# see:
|
||||
# https://pve.proxmox.com/wiki/Linux_Container
|
||||
pveGetLatestTemplate(){
|
||||
if [ $DRY_RUN ] ; then
|
||||
[ -z $2 ] \
|
||||
|| eval "$2=${CT_TEMPLATE:-\\\$CT_TEMPLATE}"
|
||||
return
|
||||
fi
|
||||
|
||||
#@ pveam update
|
||||
|
||||
local templates=($(pveam available | grep -o ''${1}'.*$'))
|
||||
local latest=${templates[-1]}
|
||||
|
||||
@ pveam download local ${latest}
|
||||
|
||||
latest=$(pveam list local | grep -o "^.*$latest")
|
||||
#latest=($(ls /var/lib/vz/template/cache/${1}*))
|
||||
|
||||
[ -z $2 ] \
|
||||
|| eval "$2=${latest}"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# pctCreate ID TEMPLATE ARGS [PASS]
|
||||
#
|
||||
@ -700,6 +689,31 @@ pctCreateTurnkey(){
|
||||
|
||||
sleep ${TIMEOUT:=5}
|
||||
}
|
||||
# Wait for /etc/inithooks.conf to be generated then cleared
|
||||
#
|
||||
# tklWaitForSetup ID
|
||||
#
|
||||
# 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 $1 -- test -e /etc/inithooks.conf) ; do
|
||||
printf '.'
|
||||
sleep ${TIMEOUT:=5}
|
||||
done
|
||||
printf '+'
|
||||
sleep ${TIMEOUT:=5}
|
||||
while ! [[ $(lxc-attach $1 -- cat /etc/inithooks.conf | wc -c) < 2 ]] ; do
|
||||
printf '.'
|
||||
sleep ${TIMEOUT:=5}
|
||||
done
|
||||
else
|
||||
printf '.+..'
|
||||
fi
|
||||
printf 'ready.\n'
|
||||
sleep ${TIMEOUT:=5}
|
||||
}
|
||||
#
|
||||
# pctUpdateTurnkey ID
|
||||
#
|
||||
@ -747,5 +761,6 @@ pctSetNotes(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# vim:set ts=4 sw=4 nowrap :
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user