Compare commits

...

3 Commits

Author SHA1 Message Date
a4a818721a cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-01-31 18:02:52 +03:00
a58233d0ea minor fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-01-31 17:36:47 +03:00
306f0ddc4c added dns config + refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-01-31 17:26:58 +03:00
5 changed files with 68 additions and 11 deletions

View File

@ -286,6 +286,40 @@ xreadpass(){
}
# Review changes in PATH.new, then edit/apply changes to PATH
#
# reviewApplyChanges PATH
#
# NOTE: if changes are not applied this will return non-zero making this
# usable in conditionals...
reviewApplyChanges(){
local file=$1
echo "# Review updated: ${file}.new:"
@ cat ${file}.new
echo '---'
local res
while true ; do
read -ep "# [a]pply, [e]dit, [s]kip? " res
case "${res,,}" in
a|apply)
break
;;
e|edit)
${EDITOR} "${file}"
;;
s|skip)
echo "# file saved as: ${file}.new"
return 1
;;
*)
echo "ERROR: unknown command: \"$res\"" >&2
continue
;;
esac
done
@ mv -b "${file}"{.new,}
}
#----------------------------------------------------------------------

View File

@ -52,7 +52,7 @@ if xreadYes "# Install additional apps?" APPS ; then
@ apt install ${SOFTWARE[@]}
fi
# Networking
# Bridges...
# XXX need to:
# - bootstrap this
# - setup the gate, ssh, and wireguard
@ -88,25 +88,40 @@ if xreadYes "# Create bridges?" BRIDGES ; then
cat bridges.tpl \
| expandPCTTemplate WAN_PORT ADMIN_PORT)"
# XXX add $BRIDGES to /etc/network/interfaces either before the
# source command or at the end...
# XXX
if [ -z "$DRY_RUN" ] ; then
# XXX add $BRIDGES to /etc/network/interfaces either before the
# source command or at the end...
# XXX
echo
fi
# review/apply setup...
echo "# Review updated: /etc/network/interfaces.new:"
@ cat /etc/network/interfaces.new
echo
if xreadYes "# Apply changes?" ; then
@ mv -b /etc/network/interfaces{.new,}
if reviewApplyChanges /etc/network/interfaces ; then
@ ifreload -a
fi
fi
echo "# Building config..."
# XXX do we need any extra vars here???
buildAssets
# DNS
if xreadYes "# Update DNS?" DNS ; then
file=/etc/resolv.conf
@ cp "staging/${file}" "${file}".new
reviewApplyChanges "${file}"
fi
# Firewall
if xreadYes "# Update firewall rules?" FIREWALL ; then
@ cp --backup -i templates/etc/pve/firewall/cluster.fw /etc/pve/firewall/
file=/etc/pve/firewall/cluster.fw
@ cp "staging/${file}" "${file}".new
reviewApplyChanges "${file}"
fi
showNotes
echo "# Done."

View File

@ -0,0 +1,4 @@
search srv
nameserver 127.0.0.1
nameserver ${NS_LAN_IPn}
nameserver 8.8.8.8

View File

@ -1,5 +1,9 @@
#!/usr/bin/bash
#----------------------------------------------------------------------
#
# XXX disable password login...
#
#----------------------------------------------------------------------
cd $(dirname $0)
PATH=$PATH:$(dirname "$(pwd)")