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

View File

@ -52,6 +52,18 @@ BRIDGES_TPL=${BRIDGES_TPL:-bridges.tpl}
if ! [ -z $BOOTSTRAP_CLEAN ] ; then if ! [ -z $BOOTSTRAP_CLEAN ] ; then
@ cp "$INTERFACES"{,.bak} @ 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 # stage 1: bootstrap -> clean
if [ -e "$INTERFACES".clean ] ; then if [ -e "$INTERFACES".clean ] ; then
@ mv "$INTERFACES"{.clean,.new} @ mv "$INTERFACES"{.clean,.new}
@ -62,6 +74,8 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
DFL_DNS=1 DFL_DNS=1
DFL_FIREWALL=SKIP DFL_FIREWALL=SKIP
__finalize
# stage 2: clean -> final # stage 2: clean -> final
elif [ -e "$INTERFACES".final ] ; then elif [ -e "$INTERFACES".final ] ; then
@ mv "$INTERFACES"{.final,.new} @ mv "$INTERFACES"{.final,.new}
@ -79,15 +93,6 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
exit exit
fi 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... # Bootstrap...
elif ! [ -z $BOOTSTRAP ] ; then elif ! [ -z $BOOTSTRAP ] ; then
DFL_BOOTSTRAP_PORT=${DFL_BOOTSTRAP_PORT:-none} DFL_BOOTSTRAP_PORT=${DFL_BOOTSTRAP_PORT:-none}
@ -257,6 +262,11 @@ showNotes
echo "# Done." echo "# Done."
if [[ $( type -t __finalize ) == function ]] ; then
__finalize
fi
if ! [ -z $REBOOT ] ; then if ! [ -z $REBOOT ] ; then
echo "# Rebooting..." echo "# Rebooting..."
@ reboot @ reboot