tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-10-19 15:32:56 +03:00
parent 8b8822d944
commit 93b066d37f
2 changed files with 34 additions and 15 deletions

View File

@ -41,6 +41,7 @@ REBOOT=${REBOOT:=1}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Bootstrap cleanup... # Bootstrap cleanup...
# NOTE: this is intentionally handled before the bootstrap...
if ! [ -z $BOOTSTRAP_CLEAN ] ; then if ! [ -z $BOOTSTRAP_CLEAN ] ; then
#ID=${ID:-${DFL_ID}} #ID=${ID:-${DFL_ID}}

View File

@ -19,6 +19,7 @@ need ifreload
readConfig readConfig
DFL_WAN_PORT=${DFL_WAN_PORT:-enp5s0} DFL_WAN_PORT=${DFL_WAN_PORT:-enp5s0}
DFL_ADMIN_PORT=${DFL_ADMIN_PORT:-enp2s0} DFL_ADMIN_PORT=${DFL_ADMIN_PORT:-enp2s0}
@ -35,9 +36,9 @@ SOFTWARE=(
tmux tmux
) )
# XXX INTERFACES=/etc/network/interfaces
BRIDGES_TPL=bridges.tpl BRIDGES_TPL=bridges.tpl
#BRIDGES_TPL=bootstrap-bridges.tpl
# XXX # XXX
#readVars #readVars
@ -46,13 +47,18 @@ BRIDGES_TPL=bridges.tpl
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Bootstrap... # Bootstrap...
if ! [ -z $BOOTSTRAP_CLEAN ] ; then if ! [ -z $BOOTSTRAP_CLEAN ] \
# XXX switch admin interface IP and Gateway to admin net... && [ -e "$INTERFACES".clean ] ; then
# @ cp "$INTERFACES"{,.bak}
# update ADMIN_BRIDGE: @ cp "$INTERFACES"{.clean,.new}
# - set gateway if reviewApplyChanges "$INTERFACES" ; then
# - set bridge port to admin port # XXX this must be done in nohup to avoid breaking on connection lost...
# XXX if ! @ ifreload -a ; then
# reset settings back if ifreload fails...
@ cp "$INTERFACES"{.bak,}
@ ifreload -a
fi
fi
exit exit
fi fi
@ -65,7 +71,7 @@ if ! [ -z $BOOTSTRAP ] ; then
DFL_BOOTSTRAP_ADMIN_PORT=${DFL_BOOTSTRAP_ADMIN_PORT:-none} DFL_BOOTSTRAP_ADMIN_PORT=${DFL_BOOTSTRAP_ADMIN_PORT:-none}
xread "Bootstrap port: " BOOTSTRAP_ADMIN_PORT xread "Bootstrap port: " BOOTSTRAP_ADMIN_PORT
BRIDGES_TPL=bootstrap-bridges.tpl BRIDGES_BOOTSTRAP_TPL=bootstrap-bridges.tpl
fi fi
@ -96,8 +102,6 @@ if xreadYes "# Create bridges?" BRIDGES ; then
xread "Gate ADMIN IP: " GATE_ADMIN_IP xread "Gate ADMIN IP: " GATE_ADMIN_IP
readBridgeVars readBridgeVars
INTERFACES=/etc/network/interfaces
# check if new bridges already exist in interfaces... # check if new bridges already exist in interfaces...
if [ -e "$INTERFACES" ] \ if [ -e "$INTERFACES" ] \
&& grep -q \ && grep -q \
@ -128,16 +132,30 @@ if xreadYes "# Create bridges?" BRIDGES ; then
WAN_PORT ADMIN_PORT BOOTSTRAP_ADMIN_PORT \ WAN_PORT ADMIN_PORT BOOTSTRAP_ADMIN_PORT \
HOST_ADMIN_IP GATE_ADMIN_IP)" HOST_ADMIN_IP GATE_ADMIN_IP)"
[ -z $BRIDGES_BOOTSTRAP_TPL ] \
|| BRIDGES_BOOTSTRAP="$(\
cat "$BRIDGES_BOOTSTRAP_TPL" \
| expandPCTTemplate \
LAN_BRIDGE WAN_BRIDGE ADMIN_BRIDGE \
WAN_PORT ADMIN_PORT BOOTSTRAP_ADMIN_PORT \
HOST_ADMIN_IP GATE_ADMIN_IP)"
if [ -z "$DRY_RUN" ] ; then if [ -z "$DRY_RUN" ] ; then
# XXX add $BRIDGES to "$INTERFACES" either before the # write both bootstrap and clean bridge configurations...
# source command or at the end... if ! [ -z $BRIDGES_BOOTSTRAP ] ; then
# XXX @ cp "$INTERFACES"{.new,.clean}
echo "$BRIDGES" >> "$INTERFACES".clean
BRIDGES="$BRIDGES_BOOTSTRAP"
fi
echo "$BRIDGES" >> "$INTERFACES".new echo "$BRIDGES" >> "$INTERFACES".new
else else
echo "$BRIDGES" echo "$BRIDGES"
fi fi
if reviewApplyChanges "$INTERFACES" ; then if reviewApplyChanges "$INTERFACES" ; then
# XXX this must be done in nohup to avoid breaking on connection lost...
if ! @ ifreload -a ; then if ! @ ifreload -a ; then
# reset settings back if ifreload fails... # reset settings back if ifreload fails...
@ cp "$INTERFACES"{.bak,} @ cp "$INTERFACES"{.bak,}