Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-10-21 19:15:53 +03:00
parent b7f56623d9
commit 66b2b7ea7f
2 changed files with 36 additions and 25 deletions

View File

@ -93,25 +93,26 @@ bootstrap-clean: host-bootstrap-clean
# Finalize: reconect admin port/bridge correctly...
.PHONY: _finalize
_finalize: bootstrap-clean gate-bootstrap-clean
.PHONY: finalize
finalize: gate-bootstrap-clean
make host-bootstrap-clean
make host-bootstrap-clean
.PHONY: finalize
finalize:
###
### This will break the connection to the server, to continue:
### - Detach the ADMIN port,
### - Connect the WAN port,
### - $ ssh <user>@<WAN_SSH_IP>
### from there:
### $ ssh root@pve
### then:
### # tmux a
### - When done this will reboot the system.
###
tmux new-session 'make _finalize'
#.PHONY: finalize
#finalize:
# ###
# ### This will break the connection to the server, to continue:
# ### - Detach the ADMIN port,
# ### - Connect the WAN port,
# ### - $ ssh <user>@<WAN_SSH_IP>
# ### from there:
# ### $ ssh root@pve
# ### then:
# ### # tmux a
# ### - When done this will reboot the system.
# ###
# tmux new-session 'make _finalize'

View File

@ -52,6 +52,18 @@ BRIDGES_TPL=${BRIDGES_TPL:-bridges.tpl}
if ! [ -z $BOOTSTRAP_CLEAN ] ; then
@ cp "$INTERFACES"{,.bak}
__finalize(){
if reviewApplyChanges "$INTERFACES" ; then
# XXX this must be done in nohup to avoid breaking on connection lost...
if ! @ ifreload -a ; then
# reset settings back if ifreload fails...
@ cp "$INTERFACES"{.bak,}
@ ifreload -a
fi
fi
unset -f __finalize
}
# stage 1: bootstrap -> clean
if [ -e "$INTERFACES".clean ] ; then
@ mv "$INTERFACES"{.clean,.new}
@ -62,6 +74,8 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
DFL_DNS=1
DFL_FIREWALL=SKIP
__finalize
# stage 2: clean -> final
elif [ -e "$INTERFACES".final ] ; then
@ mv "$INTERFACES"{.final,.new}
@ -79,15 +93,6 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
exit
fi
if reviewApplyChanges "$INTERFACES" ; then
# XXX this must be done in nohup to avoid breaking on connection lost...
if ! @ ifreload -a ; then
# reset settings back if ifreload fails...
@ cp "$INTERFACES"{.bak,}
@ ifreload -a
fi
fi
# Bootstrap...
elif ! [ -z $BOOTSTRAP ] ; then
DFL_BOOTSTRAP_PORT=${DFL_BOOTSTRAP_PORT:-none}
@ -257,6 +262,11 @@ showNotes
echo "# Done."
if [[ $( type -t __finalize ) == function ]] ; then
__finalize
fi
if ! [ -z $REBOOT ] ; then
echo "# Rebooting..."
@ reboot