2024-01-15 16:47:30 +03:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
cd $(dirname $0)
|
|
|
|
|
PATH=$PATH:$(dirname "$(pwd)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
source ../.pct-helpers
|
|
|
|
|
|
|
|
|
|
|
2024-01-27 16:13:38 +03:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
2024-01-27 16:39:44 +03:00
|
|
|
need ifreload
|
2024-01-27 16:13:38 +03:00
|
|
|
|
|
|
|
|
|
2024-01-15 16:47:30 +03:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
readConfig
|
|
|
|
|
|
|
|
|
|
|
2024-01-27 16:13:38 +03:00
|
|
|
DFL_WAN_PORT=${DFL_WAN_PORT:-enp5s0}
|
|
|
|
|
DFL_ADMIN_PORT=${DFL_ADMIN_PORT:-enp2s0}
|
|
|
|
|
|
|
|
|
|
DFL_HOST_ADMIN_IP=${PROXMOX_ADMIN_IP:-10.0.0.254/24}
|
|
|
|
|
|
2024-01-27 16:39:44 +03:00
|
|
|
|
2024-01-15 16:47:30 +03:00
|
|
|
SOFTWARE=(
|
2024-01-27 16:39:44 +03:00
|
|
|
ifupdown2
|
2024-01-15 16:47:30 +03:00
|
|
|
make
|
|
|
|
|
w3m links
|
2024-01-16 04:07:04 +03:00
|
|
|
tree
|
2024-01-15 16:47:30 +03:00
|
|
|
qrencode
|
|
|
|
|
htop iftop iotop
|
|
|
|
|
tmux
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2024-01-27 16:49:44 +03:00
|
|
|
# XXX
|
|
|
|
|
#readVars
|
|
|
|
|
|
|
|
|
|
|
2024-01-15 16:47:30 +03:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Tools
|
|
|
|
|
if xreadYes "# Update system?" UPDATE ; then
|
|
|
|
|
@ apt update
|
|
|
|
|
@ apt upgrade
|
|
|
|
|
fi
|
|
|
|
|
if xreadYes "# Install additional apps?" APPS ; then
|
|
|
|
|
@ apt install $(SOFTWARE[@])
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Networking
|
2024-01-27 16:17:12 +03:00
|
|
|
# XXX need to:
|
|
|
|
|
# - bootstrap this
|
2024-01-27 16:21:03 +03:00
|
|
|
# - setup the gate, ssh, and wireguard
|
2024-01-27 16:17:12 +03:00
|
|
|
# - inalize
|
2024-01-27 16:39:44 +03:00
|
|
|
# XXX /etc/hosts
|
2024-01-27 17:51:56 +03:00
|
|
|
# XXX save config???
|
2024-01-27 16:49:44 +03:00
|
|
|
# XXX should we do things in ./staging ???
|
2024-01-15 16:47:30 +03:00
|
|
|
if xreadYes "# Create bridges?" BRIDGES ; then
|
2024-01-27 16:13:38 +03:00
|
|
|
xread "WAN port: " WAN_PORT
|
|
|
|
|
xread "ADMIN port: " ADMIN_PORT
|
|
|
|
|
xread "Host ADMIN IP: " HOST_ADMIN_IP
|
|
|
|
|
xread "Gate ADMIN IP: " GATE_ADMIN_IP
|
2024-01-27 16:49:44 +03:00
|
|
|
readBridgeVars
|
|
|
|
|
|
|
|
|
|
@ cp /etc/network/interfaces{,.new}
|
2024-01-27 16:13:38 +03:00
|
|
|
|
2024-01-27 16:39:44 +03:00
|
|
|
BRIDGES="${\
|
|
|
|
|
cat bridges.tpl \
|
|
|
|
|
| expandPCTTemplate WAN_PORT ADMIN_PORT}"
|
|
|
|
|
|
|
|
|
|
# XXX add $BRIDGES to /etc/network/interfaces either before the
|
2024-01-27 16:13:38 +03:00
|
|
|
# source command or at the end...
|
|
|
|
|
# XXX
|
|
|
|
|
|
2024-01-27 16:49:44 +03:00
|
|
|
# review/apply setup...
|
2024-01-27 16:39:44 +03:00
|
|
|
echo "# Review updated: /etc/network/interfaces.new:"
|
|
|
|
|
@ cat /etc/network/interfaces.new
|
|
|
|
|
echo
|
|
|
|
|
if xreadYes "# Apply changes?" ; then
|
|
|
|
|
@ mv -b /etc/network/interfaces{.new,}
|
|
|
|
|
@ ifreload -a
|
|
|
|
|
fi
|
2024-01-15 16:47:30 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Firewall
|
2024-01-15 16:59:06 +03:00
|
|
|
if xreadYes "# Update firewall rules?" FIREWALL ; then
|
|
|
|
|
@ cp --backup -i templates/etc/pve/firewall/cluster.fw /etc/pve/firewall/
|
2024-01-15 16:47:30 +03:00
|
|
|
fi
|
|
|
|
|
|
2024-01-26 03:06:55 +03:00
|
|
|
showNotes
|
|
|
|
|
echo "# Done."
|
2024-01-15 16:47:30 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
# vim:set ts=4 sw=4 :
|