From c898c0c874b90914902c6dd4db101b3063aaf43b Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 27 Jan 2024 16:49:44 +0300 Subject: [PATCH] cleanup... Signed-off-by: Alex A. Naanou --- .pct-helpers | 26 +++++++++++++++++--------- host/bridges.tpl | 12 ++++++------ host/make.sh | 11 +++++++++-- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/.pct-helpers b/.pct-helpers index d461420..0be1413 100644 --- a/.pct-helpers +++ b/.pct-helpers @@ -371,6 +371,8 @@ webAppConfig(){ # # readVars +# readCTHardwareVars +# readBridgeVars # # Variables this handles: # EMAIL @@ -396,22 +398,28 @@ webAppConfig(){ # TMP_PASS_LEN # ROOTPASS # +readCTHardwareVars(){ + # hardware... + xread "CPU cores: " CORES + xread "RAM (MB): " RAM + xread "SWAP (MB): " SWAP + xread "DRIVE (GB): " DRIVE +} +readBridgeVars(){ + # bridge config... + xread "WAN bridge: vmbr" WAN_BRIDGE + xread "LAN bridge: vmbr" LAN_BRIDGE + xread "ADMIN bridge: vmbr" ADMIN_BRIDGE +} readVars(){ xread -n "Email: " EMAIL xread -n "Domain: " DOMAIN xread "ID: " ID xread "Hostname: " CTHOSTNAME - # hardware... - xread "CPU cores: " CORES - xread "RAM (MB): " RAM - xread "SWAP (MB): " SWAP - xread "DRIVE (GB): " DRIVE + readCTHardwareVars - # bridge config... - xread "WAN bridge: vmbr" WAN_BRIDGE - xread "LAN bridge: vmbr" LAN_BRIDGE - xread "ADMIN bridge: vmbr" ADMIN_BRIDGE + readBridgeVars # gateway... # IPs can be: diff --git a/host/bridges.tpl b/host/bridges.tpl index aa04812..c6f4f4b 100644 --- a/host/bridges.tpl +++ b/host/bridges.tpl @@ -1,20 +1,20 @@ -auto vmbr0 -iface vmbr0 inet manual +auto vmbr${LAN_BRIDGE} +iface vmbr${LAN_BRIDGE} inet manual bridge-ports none bridge-stp off bridge-fd 0 #LAN -auto vmbr1 -iface vmbr2 inet manual +auto vmbr${WAN_BRIDGE} +iface vmbr${WAN_BRIDGE} inet manual bridge-ports ${WAN_PORT} bridge-stp off bridge-fd 0 #WAN -auto vmbr2 -iface vmbr3 inet static +auto vmbr${ADMIN_BRIDGE} +iface vmbr${ADMIN_BRIDGE} inet static address ${HOST_ADMIN_IP} gateway ${GATE_ADMIN_IPn} bridge-ports ${ADMIN_PORT} diff --git a/host/make.sh b/host/make.sh index 5e1d8f7..bbbfbe9 100644 --- a/host/make.sh +++ b/host/make.sh @@ -37,6 +37,10 @@ SOFTWARE=( ) +# XXX +#readVars + + #---------------------------------------------------------------------- # Tools @@ -54,22 +58,25 @@ fi # - setup the gate, ssh, and wireguard # - inalize # XXX /etc/hosts +# XXX should we do things in ./staging ??? if xreadYes "# Create bridges?" BRIDGES ; then xread "WAN port: " WAN_PORT xread "ADMIN port: " ADMIN_PORT xread "Host ADMIN IP: " HOST_ADMIN_IP xread "Gate ADMIN IP: " GATE_ADMIN_IP + readBridgeVars + + @ cp /etc/network/interfaces{,.new} BRIDGES="${\ cat bridges.tpl \ | expandPCTTemplate WAN_PORT ADMIN_PORT}" - @ cp /etc/network/interfaces{,.new} - # XXX add $BRIDGES to /etc/network/interfaces either before the # source command or at the end... # XXX + # review/apply setup... echo "# Review updated: /etc/network/interfaces.new:" @ cat /etc/network/interfaces.new echo