preparing for per-ct configuration...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-10-24 22:32:27 +03:00
parent bce1839e2e
commit 3b04382faf

View File

@ -12,6 +12,8 @@ CT_DIR=${CT_DIR:=/etc/pve/lxc/}
EDITOR=${EDITOR:-nano} EDITOR=${EDITOR:-nano}
LAST_RUN_CONFIG=config.last-run
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -406,9 +408,9 @@ readConfig(){
[ -e ./config ] \ [ -e ./config ] \
&& source ./config && source ./config
# XXX is this the right priority for this??? # XXX is this the right priority for this???
[ -e ./config.last-run ] \ [ -e ./$LAST_RUN_CONFIG ] \
&& [ -z $CLEAN_RUN ] \ && [ -z $CLEAN_RUN ] \
&& source ./config.last-run && source ./$LAST_RUN_CONFIG
[ -e "$CONFIG" ] \ [ -e "$CONFIG" ] \
&& source $CONFIG && source $CONFIG
#eval "${__ENV[@]}" #eval "${__ENV[@]}"
@ -454,14 +456,16 @@ saveConfig(){
saveLastRunConfig(){ saveLastRunConfig(){
local cfg=config.last-run local cfg=$LAST_RUN_CONFIG
echo "# Saving config to: config.last-run" local ct_cfg=$ID-$CTHOSTNAME.cfg
echo "# Saving config to: $cfg and $ct_cfg"
{ {
echo "#" echo "#"
echo "# This file is auto-generated, any changes here will be overwritten." echo "# This file is auto-generated, any changes here will be overwritten."
echo "#" echo "#"
} > "$cfg" } > "$cfg"
saveConfig -d -a "$cfg" ${XREAD_VARS[@]} saveConfig -d -a "$cfg" ${XREAD_VARS[@]}
cp "$cfg" "$ct_cfg"
} }