mirror of
https://github.com/flynx/proxmox-utils.git
synced 2026-10-04 13:28:38 +00:00
Compare commits
No commits in common. "f3d3b3fe323681603aa531281a3fd07459c71a79" and "fc7d23b8603014db4d15660cd999211dd65b49c0" have entirely different histories.
f3d3b3fe32
...
fc7d23b860
60
.pct-helpers
60
.pct-helpers
@ -302,81 +302,33 @@ xreadpass(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Like cat but a prettier...
|
|
||||||
#
|
|
||||||
# listFile PATH
|
|
||||||
#
|
|
||||||
listFile(){
|
|
||||||
if [ -e "$1" ] ; then
|
|
||||||
echo "--- $1 ---"
|
|
||||||
cat "$1"
|
|
||||||
echo '---'
|
|
||||||
else
|
|
||||||
echo "$FUNCNAME: $1: No such file or directory."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Review changes in PATH.new, then edit/apply changes to PATH
|
# Review changes in PATH.new, then edit/apply changes to PATH
|
||||||
#
|
#
|
||||||
# reviewApplyChanges PATH [apply|edit|skip]
|
# reviewApplyChanges PATH
|
||||||
#
|
|
||||||
#
|
#
|
||||||
# NOTE: if changes are not applied this will return non-zero making this
|
# NOTE: if changes are not applied this will return non-zero making this
|
||||||
# usable in conditionals...
|
# usable in conditionals...
|
||||||
reviewApplyChanges(){
|
reviewApplyChanges(){
|
||||||
local file=$1
|
local file=$1
|
||||||
if ! [ -e "$file".new ] ; then
|
|
||||||
echo "$FUNCNAME: $1: No such file or directory."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# default option...
|
|
||||||
local dfl=
|
|
||||||
local a=a
|
|
||||||
local e=e
|
|
||||||
local s=s
|
|
||||||
case "${2,,}" in
|
|
||||||
a|apply)
|
|
||||||
a=A
|
|
||||||
dfl=a
|
|
||||||
;;
|
|
||||||
e|edit)
|
|
||||||
e=E
|
|
||||||
dfl=e
|
|
||||||
;;
|
|
||||||
s|skip)
|
|
||||||
s=S
|
|
||||||
dfl=s
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "# Review updated: ${file}.new:"
|
echo "# Review updated: ${file}.new:"
|
||||||
listFile ${file}.new
|
@ cat ${file}.new
|
||||||
|
echo '---'
|
||||||
local res
|
local res
|
||||||
while true ; do
|
while true ; do
|
||||||
read -ep "# [$a]pply, [$e]dit, [$s]kip? " res
|
read -ep "# [a]pply, [e]dit, [s]kip? " res
|
||||||
if [ -z $res ] ; then
|
|
||||||
if [ -z $dfl ] ; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
res=$dfl
|
|
||||||
fi
|
|
||||||
case "${res,,}" in
|
case "${res,,}" in
|
||||||
a|apply)
|
a|apply)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
e|edit)
|
e|edit)
|
||||||
${EDITOR} "${file}.new"
|
${EDITOR} "${file}.new"
|
||||||
listFile ${file}.new
|
|
||||||
;;
|
;;
|
||||||
s|skip)
|
s|skip)
|
||||||
echo "# Changes kept as: ${file}.new"
|
echo "# file saved as: ${file}.new"
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: Unknown command: \"$res\"" >&2
|
echo "ERROR: unknown command: \"$res\"" >&2
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
7
Makefile
7
Makefile
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
EDITOR ?= nano
|
EDITOR ?= vim
|
||||||
|
|
||||||
|
|
||||||
# CTs...
|
# CTs...
|
||||||
@ -94,10 +94,7 @@ bootstrap-clean: host-bootstrap-clean
|
|||||||
|
|
||||||
# Finalize: reconect admin port/bridge correctly...
|
# Finalize: reconect admin port/bridge correctly...
|
||||||
.PHONY: finalize
|
.PHONY: finalize
|
||||||
finalize: gate-bootstrap-clean
|
finalize: bootstrap-clean gate-bootstrap-clean
|
||||||
# cleanup: stage 1...
|
|
||||||
make host-bootstrap-clean
|
|
||||||
# cleanup: stage 2...
|
|
||||||
make host-bootstrap-clean
|
make host-bootstrap-clean
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
93
README.md
93
README.md
@ -3,20 +3,18 @@
|
|||||||
A set of scripts for automating setup and tasks in proxmox.
|
A set of scripts for automating setup and tasks in proxmox.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- CT updates
|
- revise defaults
|
||||||
- backup/restore
|
|
||||||
- mail
|
|
||||||
- which is better?
|
|
||||||
- Makefile (a-la ./wireguard/templates/root/Makefile)
|
|
||||||
- shell (a-la ./shadow/templates/root/update-shadowsocks.sh)
|
|
||||||
- separate templates/assets into distribution and user directories
|
- separate templates/assets into distribution and user directories
|
||||||
...this is needed to allow the user to change the configs without the
|
...this is needed to allow the user to change the configs without the
|
||||||
fear of them being overwritten by git (similar to how config is handlerd)
|
fear of them being overwritten by git (similar to how config is handlerd)
|
||||||
|
- might be a good idea to export a specific ct script that can be used
|
||||||
|
for updates for that ct
|
||||||
<!-- START doctoc -->
|
- which is better?
|
||||||
<!-- END doctoc -->
|
- Makefile (a-la wireguard)
|
||||||
|
- shell (a-la shadow)
|
||||||
|
- ct updates
|
||||||
|
- backup/restore
|
||||||
|
- mail
|
||||||
|
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
@ -118,9 +116,6 @@ Three ways of access to the ADMIN network are provided:
|
|||||||
|
|
||||||
Install Proxmox and connect it to your device/network.
|
Install Proxmox and connect it to your device/network.
|
||||||
|
|
||||||
Proxmox will need to have access to the internet to download assets and
|
|
||||||
updates.
|
|
||||||
|
|
||||||
|
|
||||||
#### Notes
|
#### Notes
|
||||||
|
|
||||||
@ -137,13 +132,6 @@ This setup will use three IP addresses:
|
|||||||
|
|
||||||
### Semi-automated setup
|
### Semi-automated setup
|
||||||
|
|
||||||
Open a terminal on the host (`ssh` or via the UI).
|
|
||||||
|
|
||||||
Optionally, set a desired default editor via:
|
|
||||||
```shell
|
|
||||||
export EDITOR=nano
|
|
||||||
```
|
|
||||||
|
|
||||||
Download the [`bootstrap.sh`](./scripts/bootstrap.sh) script and execute it:
|
Download the [`bootstrap.sh`](./scripts/bootstrap.sh) script and execute it:
|
||||||
```shell
|
```shell
|
||||||
curl 'https://raw.githubusercontent.com/flynx/proxmox-utils/refs/heads/master/scripts/bootstrap.sh' | sudo bash
|
curl 'https://raw.githubusercontent.com/flynx/proxmox-utils/refs/heads/master/scripts/bootstrap.sh' | sudo bash
|
||||||
@ -174,69 +162,22 @@ make finalize
|
|||||||
```
|
```
|
||||||
|
|
||||||
This will
|
This will
|
||||||
- Setup firewall rules.
|
- detach the host from any external ports and make it accessible only
|
||||||
Note that the firewall will not be enabled, this should be done manually
|
|
||||||
after rule review.
|
|
||||||
- Detach the host from any external ports and make it accessible only
|
|
||||||
from the internal network.
|
from the internal network.
|
||||||
See: [Architecture](#architecture) and [Bootstrapping](#bootstrapping)
|
See: [Architecture](#architecture) and [Bootstrapping](#bootstrapping)
|
||||||
|
- setup firewall rules.
|
||||||
|
Note that the firewall will not be enabled, this should be done manually
|
||||||
|
after rule review.
|
||||||
|
|
||||||
|
|
||||||
This will break the ssh connection when done, reconnect via the WAN port
|
*Note that the ADMIN port is configured for direct connections only (DHCP),
|
||||||
to continue (see: [Accessing the host](#accessing-the-host)), or connect
|
connecting it to a configured network can lead to unexpected behavior.*
|
||||||
directly to the ADMIN port (DHCP) and ssh into `$HOST_ADMIN_IP` (default: 10.0.0.254).
|
|
||||||
|
|
||||||
|
|
||||||
_Note that the ADMIN port is configured for direct connections only (DHCP),
|
|
||||||
connecting it to a configured network can lead to unexpected behavior._
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Accessing the host
|
#### Accessing the host
|
||||||
|
|
||||||
The simplest way is to connect to `wireguard` VPN and open http://pve.adm:8006
|
|
||||||
in a browser (a profile was created during the setup process and stored
|
|
||||||
in the `/root/clients/` directory on the `wireguard` CT).
|
|
||||||
|
|
||||||
The second approach is to `ssh` to either:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
ssh -p 23 <user>@<WAN_IP>
|
|
||||||
```
|
|
||||||
|
|
||||||
or:
|
|
||||||
```shell
|
|
||||||
ssh <user>@<WAN_SSH_IP>
|
|
||||||
```
|
|
||||||
|
|
||||||
The later will also work if the `gate` CT is down or not accessible.
|
|
||||||
|
|
||||||
|
|
||||||
And from the `ssh` CT:
|
|
||||||
```shell
|
|
||||||
ssh root@pve
|
|
||||||
```
|
|
||||||
|
|
||||||
_WARNING: NEVER store any ssh keys on the `ssh` CT, use `ssh-agent` instead!_
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
|
|
||||||
XXX
|
XXX
|
||||||
|
|
||||||
The following CT's interfaces can not be configured in the Proxmox UI:
|
|
||||||
- `gate`
|
|
||||||
- `ns`
|
|
||||||
- `nextcloud`
|
|
||||||
- `wireguard`
|
|
||||||
|
|
||||||
This is done mostly to keep Proxmox from touching the `hostname $(hostname)`
|
|
||||||
directive (used by the DNS server to assigned predefined IP's) and in
|
|
||||||
the case of `gate` and `wireguard` to keep it from touching the additional
|
|
||||||
bridges or interfaces defined.
|
|
||||||
(XXX this restriction may be lifted in the future)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Setup additional services
|
#### Setup additional services
|
||||||
|
|
||||||
@ -271,8 +212,6 @@ XXX traefik rules
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Manual setup
|
### Manual setup
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#----------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Global config file
|
# Global config file
|
||||||
#
|
#
|
||||||
@ -16,68 +16,7 @@
|
|||||||
# It is not recomended to set passwords here or in other config files.
|
# It is not recomended to set passwords here or in other config files.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
# These options need to be revised or changed...
|
|
||||||
# (remove "DFL_" prefix to disable promting)
|
|
||||||
#
|
|
||||||
|
|
||||||
# Domain and email configuration
|
|
||||||
#
|
|
||||||
DFL_DOMAIN=example.com
|
|
||||||
DFL_EMAIL=user@example.com
|
|
||||||
|
|
||||||
|
|
||||||
# Network configuration...
|
|
||||||
#
|
|
||||||
# NOTE: it is simpler to statically assign these than to configure DHCP
|
|
||||||
# plus port forewarding to the dynamically assigned IP.
|
|
||||||
# NOTE: if installing on a different network than the target, these can
|
|
||||||
# be changed for target deployment in:
|
|
||||||
# - gate CT's /etc/network/interfaces (NOT in the Proxmox UI)
|
|
||||||
# - ssh CT's network configuration (Proxmox UI)
|
|
||||||
DFL_WAN_IP=192.168.1.101/24
|
|
||||||
DFL_WAN_GATE=192.168.1.252
|
|
||||||
|
|
||||||
# IP used for fail-safe conection to the ADMIN network
|
|
||||||
DFL_WAN_SSH_IP=192.168.1.102/24
|
|
||||||
|
|
||||||
|
|
||||||
# Web app/service domain configuration
|
|
||||||
#
|
|
||||||
# Here two optional variables are provided per service:
|
|
||||||
# - <SERVICE>_DOMAIN=...
|
|
||||||
# Overrides the $DOMAIN option above for <SERVICE>
|
|
||||||
# - <SERVICE>_SUBDOMAIN=...
|
|
||||||
# Sets the subdomain of $DOMAIN (or $<SERVICE>_DOMAIN) for <SERVICE>
|
|
||||||
|
|
||||||
# Nextcloud
|
|
||||||
#NEXTCLOUD_DOMAIN=
|
|
||||||
NEXTCLOUD_SUBDOMAIN=nc.
|
|
||||||
|
|
||||||
# Gitea
|
|
||||||
#GITEA_DOMAIN=
|
|
||||||
#GITEA_SUBDOMAIN=git.
|
|
||||||
|
|
||||||
|
|
||||||
# Extra options passed to each CT when created.
|
|
||||||
#
|
|
||||||
# This can be used for passing in ssh keys, etc...
|
|
||||||
#
|
|
||||||
# see:
|
|
||||||
# man pct
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# DFL_PCT_EXTRA="--ssh-public-keys /path/to/autohrized_keys"
|
|
||||||
#
|
|
||||||
DFL_PCT_EXTRA=SKIP
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Options afetr this point are sane defaults and in the general case
|
|
||||||
# can be left as-is.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Bootsrap configuration...
|
# Bootsrap configuration...
|
||||||
#
|
#
|
||||||
@ -98,21 +37,70 @@ BOOTSTRAP_BRIDGE=0
|
|||||||
# bridges with numbers greater than X (10 in the example below)
|
# bridges with numbers greater than X (10 in the example below)
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# ADMIN_BRIDGE=_admin
|
# WAN_BRIDGE=0
|
||||||
# WAN_BRIDGE=_wan
|
# ADMIN_BRIDGE=3
|
||||||
# LAN_BRIDGE=_lan
|
# LAN_BRIDGE=10
|
||||||
#
|
#
|
||||||
ADMIN_BRIDGE=_admin
|
ADMIN_BRIDGE=_admin
|
||||||
WAN_BRIDGE=_wan
|
WAN_BRIDGE=_wan
|
||||||
LAN_BRIDGE=_lan
|
LAN_BRIDGE=_lan
|
||||||
|
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# NOTE: it is simpler to statically assign these than to configure dhcp
|
||||||
|
# plus port forewarding to the dynamically assigned IP.
|
||||||
|
DFL_WAN_IP=192.168.1.101/24
|
||||||
|
DFL_WAN_GATE=192.168.1.252
|
||||||
|
|
||||||
|
DFL_WAN_SSH_IP=192.168.1.102/24
|
||||||
|
|
||||||
|
|
||||||
|
# Domain and email configuration
|
||||||
|
#
|
||||||
|
DOMAIN=example.com
|
||||||
|
EMAIL=user@example.com
|
||||||
|
|
||||||
|
|
||||||
|
# Web app/service domain configuration
|
||||||
|
#
|
||||||
|
# Here two optional variables are provided per service:
|
||||||
|
# - <SERVICE>_DOMAIN=...
|
||||||
|
# Overrides the $DOMAIN option above for <SERVICE>
|
||||||
|
# - <SERVICE>_SUBDOMAIN=...
|
||||||
|
# Sets the subdomain of $DOMAIN (or $<SERVICE>_DOMAIN) for <SERVICE>
|
||||||
|
#
|
||||||
|
|
||||||
|
# Nextcloud
|
||||||
|
#NEXTCLOUD_DOMAIN=
|
||||||
|
NEXTCLOUD_SUBDOMAIN=nc.
|
||||||
|
|
||||||
|
# Gitea
|
||||||
|
#GITEA_DOMAIN=
|
||||||
|
#GITEA_SUBDOMAIN=git.
|
||||||
|
|
||||||
|
|
||||||
|
# Extra options passed to each CT created.
|
||||||
|
#
|
||||||
|
# This can be used for passing in ssh keys, etc...
|
||||||
|
#
|
||||||
|
# see:
|
||||||
|
# man pct
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# DFL_PCT_EXTRA="--ssh-public-keys /path/to/autohrized_keys"
|
||||||
|
#
|
||||||
|
DFL_PCT_EXTRA=SKIP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Options afetr this point are sane defaults and in the general case
|
||||||
|
# can be left as-is.
|
||||||
|
#
|
||||||
|
|
||||||
# host
|
# host
|
||||||
HOST_ADMIN_IP=10.0.0.254/24
|
HOST_ADMIN_IP=10.0.0.254/24
|
||||||
|
|
||||||
|
|
||||||
# Nameserver
|
# Nameserver
|
||||||
NS_HOSTNAME=ns
|
NS_HOSTNAME=ns
|
||||||
NS_ID=100
|
NS_ID=100
|
||||||
@ -122,7 +110,6 @@ NS_LAN_IP=10.1.1.1/24
|
|||||||
RESERVE_NS_ID=101
|
RESERVE_NS_ID=101
|
||||||
TEMPLATE_NS_ID=200
|
TEMPLATE_NS_ID=200
|
||||||
|
|
||||||
|
|
||||||
# Gateway / Reverse proxy
|
# Gateway / Reverse proxy
|
||||||
GATE_HOSTNAME=gate
|
GATE_HOSTNAME=gate
|
||||||
GATE_ID=110
|
GATE_ID=110
|
||||||
@ -133,5 +120,4 @@ RESERVE_GATE_ID=111
|
|||||||
TEMPLATE_GATE_ID=210
|
TEMPLATE_GATE_ID=210
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|||||||
@ -25,8 +25,8 @@ RAM=128
|
|||||||
SWAP=$RAM
|
SWAP=$RAM
|
||||||
DRIVE=0.5
|
DRIVE=0.5
|
||||||
|
|
||||||
#DFL_WAN_IP=${DFL_WAN_IP}
|
DFL_WAN_IP=${DFL_WAN_IP}
|
||||||
#DFL_WAN_GATE=${DFL_WAN_GATE}
|
DFL_WAN_GATE=${DFL_WAN_GATE}
|
||||||
|
|
||||||
# XXX revise...
|
# XXX revise...
|
||||||
DFL_ADMIN_IP=${GATE_ADMIN_IP:=${DFL_ADMIN_IP:=10.0.0.2/24}}
|
DFL_ADMIN_IP=${GATE_ADMIN_IP:=${DFL_ADMIN_IP:=10.0.0.2/24}}
|
||||||
|
|||||||
50
host/make.sh
50
host/make.sh
@ -49,23 +49,9 @@ BRIDGES_TPL=${BRIDGES_TPL:-bridges.tpl}
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Bootstrap...
|
# Bootstrap...
|
||||||
|
|
||||||
# cleanup...
|
|
||||||
if ! [ -z $BOOTSTRAP_CLEAN ] ; then
|
if ! [ -z $BOOTSTRAP_CLEAN ] ; then
|
||||||
@ cp "$INTERFACES"{,.bak}
|
@ cp "$INTERFACES"{,.bak}
|
||||||
|
|
||||||
__finalize(){
|
|
||||||
if reviewApplyChanges "$INTERFACES" apply ; 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
|
|
||||||
# clear self to avoid a second deffered execution...
|
|
||||||
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}
|
||||||
@ -76,9 +62,6 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
|
|||||||
DFL_DNS=1
|
DFL_DNS=1
|
||||||
DFL_FIREWALL=SKIP
|
DFL_FIREWALL=SKIP
|
||||||
|
|
||||||
# NOTE: in general this is non-destructive and can be done inline.
|
|
||||||
__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}
|
||||||
@ -89,8 +72,6 @@ if ! [ -z $BOOTSTRAP_CLEAN ] ; then
|
|||||||
DFL_DNS=SKIP
|
DFL_DNS=SKIP
|
||||||
DFL_FIREWALL=1
|
DFL_FIREWALL=1
|
||||||
|
|
||||||
# NOTE: __finalize is deferred to just before reboot...
|
|
||||||
|
|
||||||
REBOOT=1
|
REBOOT=1
|
||||||
|
|
||||||
# done
|
# done
|
||||||
@ -98,6 +79,15 @@ 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}
|
||||||
@ -117,20 +107,20 @@ fi
|
|||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
# system...
|
# System...
|
||||||
if xreadYes "# Update system?" UPDATE ; then
|
if xreadYes "# Update system?" UPDATE ; then
|
||||||
@ apt update
|
@ apt update
|
||||||
@ apt upgrade
|
@ apt upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# tools...
|
# Tools...
|
||||||
if xreadYes "# Install additional apps?" APPS ; then
|
if xreadYes "# Install additional apps?" APPS ; then
|
||||||
@ apt install ${SOFTWARE[@]}
|
@ apt install ${SOFTWARE[@]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# bridges...
|
# Bridges...
|
||||||
if xreadYes "# Create bridges?" BRIDGES ; then
|
if xreadYes "# Create bridges?" BRIDGES ; then
|
||||||
xread "WAN port: " WAN_PORT
|
xread "WAN port: " WAN_PORT
|
||||||
xread "ADMIN port: " ADMIN_PORT
|
xread "ADMIN port: " ADMIN_PORT
|
||||||
@ -213,7 +203,7 @@ if xreadYes "# Create bridges?" BRIDGES ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# interfaces
|
# interfaces
|
||||||
if reviewApplyChanges "$INTERFACES" apply ; then
|
if reviewApplyChanges "$INTERFACES" ; then
|
||||||
# XXX this must be done in nohup to avoid breaking on connection lost...
|
# 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...
|
||||||
@ -231,7 +221,7 @@ if xreadYes "# Update /etc/hosts?" HOSTS ; then
|
|||||||
@ sed -i \
|
@ sed -i \
|
||||||
-e 's/^[^#].* \(pve.local.*\)$/'${HOST_ADMIN_IP/\/*}' \1/' \
|
-e 's/^[^#].* \(pve.local.*\)$/'${HOST_ADMIN_IP/\/*}' \1/' \
|
||||||
/etc/hosts.new
|
/etc/hosts.new
|
||||||
reviewApplyChanges /etc/hosts apply
|
reviewApplyChanges /etc/hosts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -250,7 +240,7 @@ if xreadYes "# Update DNS?" DNS ; then
|
|||||||
build
|
build
|
||||||
file=/etc/resolv.conf
|
file=/etc/resolv.conf
|
||||||
@ cp "staging/${file}" "${file}".new
|
@ cp "staging/${file}" "${file}".new
|
||||||
reviewApplyChanges "${file}" apply
|
reviewApplyChanges "${file}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -259,7 +249,7 @@ if xreadYes "# Update firewall rules?" FIREWALL ; then
|
|||||||
build
|
build
|
||||||
file=/etc/pve/firewall/cluster.fw
|
file=/etc/pve/firewall/cluster.fw
|
||||||
@ cp "staging/${file}" "${file}".new
|
@ cp "staging/${file}" "${file}".new
|
||||||
reviewApplyChanges "${file}" apply
|
reviewApplyChanges "${file}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -267,14 +257,6 @@ showNotes
|
|||||||
echo "# Done."
|
echo "# Done."
|
||||||
|
|
||||||
|
|
||||||
# finalize...
|
|
||||||
if [[ $( type -t __finalize ) == "function" ]] ; then
|
|
||||||
echo "# Finalizing ${INTERFACES}..."
|
|
||||||
__finalize
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# reboot...
|
|
||||||
if ! [ -z $REBOOT ] ; then
|
if ! [ -z $REBOOT ] ; then
|
||||||
echo "# Rebooting..."
|
echo "# Rebooting..."
|
||||||
@ reboot
|
@ reboot
|
||||||
|
|||||||
@ -24,10 +24,10 @@ readConfig
|
|||||||
DFL_ID=${DFL_ID:=120}
|
DFL_ID=${DFL_ID:=120}
|
||||||
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=ssh}
|
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=ssh}
|
||||||
|
|
||||||
DFL_CORES=${DFL_SSH_CORES:=1}
|
DFL_CORES=${DFL_CORES:=1}
|
||||||
DFL_RAM=${DFL_SSH_RAM:=512}
|
DFL_RAM=${DFL_RAM:=1024}
|
||||||
DFL_SWAP=${DFL_SSH_SWAP:=${DFL_RAM}}
|
DFL_SWAP=${DFL_SWAP:=${DFL_RAM}}
|
||||||
DFL_DRIVE=${DFL_SSH_DRIVE:=16}
|
DFL_DRIVE=${DFL_DRIVE:=16}
|
||||||
|
|
||||||
WAN_IP=SKIP
|
WAN_IP=SKIP
|
||||||
WAN_GATE=SKIP
|
WAN_GATE=SKIP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user