From fb38fe23e69b9eebb0056a0aa3a88544a7c1b62b Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Tue, 10 May 2022 11:59:30 -0400 Subject: [PATCH] Added MAC ADDRESS pinning. Signed-off-by: Derek Smith --- defaults.sh | 4 ++++ domain_init.sh | 5 +++++ git | 1 - provision_lxc.sh | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) delete mode 120000 git diff --git a/defaults.sh b/defaults.sh index 15b9001..e25d212 100644 --- a/defaults.sh +++ b/defaults.sh @@ -135,3 +135,7 @@ export NEXTCLOUD_DB_IMAGE="$DEFAULT_DB_IMAGE" export GITEA_IMAGE="gitea/gitea:latest" export GITEA_DB_IMAGE="$DEFAULT_DB_IMAGE" + +export WWW_MAC_ADDRESS= +export BTCPAY_MAC_ADDRESS= +export UMBREL_MAC_ADDRESS= \ No newline at end of file diff --git a/domain_init.sh b/domain_init.sh index efd2674..a2bf3a3 100755 --- a/domain_init.sh +++ b/domain_init.sh @@ -60,6 +60,11 @@ elif [ "$VPS_HOSTING_TARGET" = lxd ]; then export RUN_BACKUP=false # create a base image if needed and instantiate a VM. + if [ -z "$MAC_ADDRESS_TO_PROVISION" ]; then + echo "ERROR: You MUST define a MAC Address for all your machines." + exit 1 + fi + ./provision_lxc.sh fi diff --git a/git b/git deleted file mode 120000 index 0899c29..0000000 --- a/git +++ /dev/null @@ -1 +0,0 @@ -git \ No newline at end of file diff --git a/provision_lxc.sh b/provision_lxc.sh index 3482a23..c82be69 100755 --- a/provision_lxc.sh +++ b/provision_lxc.sh @@ -109,6 +109,7 @@ if ! lxc image list --format csv "$VM_NAME" | grep -q "$VM_NAME"; then # let's PIN the HW address for now so we don't exhaust IP # and so we can set DNS internally. + lxc config set "$VM_NAME" "volatile.enp5s0.hwaddr=$MAC_ADDRESS_TO_PROVISION" lxc start "$VM_NAME"