From be9b161d72172e732a5fd62ecfb368e5e3deee00 Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Wed, 25 Jun 2025 12:09:58 -0700 Subject: [PATCH] Add wild-dnsmasq-install.sh script for DNSMasq setup and remove transfer-setup-bundle.sh --- .../wild-dnsmasq-install.sh | 19 +++++++++++++++++++ setup/dnsmasq/bin/transfer-setup-bundle.sh | 14 -------------- 2 files changed, 19 insertions(+), 14 deletions(-) rename setup/dnsmasq/bin/create-setup-bundle.sh => bin/wild-dnsmasq-install.sh (80%) delete mode 100755 setup/dnsmasq/bin/transfer-setup-bundle.sh diff --git a/setup/dnsmasq/bin/create-setup-bundle.sh b/bin/wild-dnsmasq-install.sh similarity index 80% rename from setup/dnsmasq/bin/create-setup-bundle.sh rename to bin/wild-dnsmasq-install.sh index 02ee702..d9a6d81 100755 --- a/setup/dnsmasq/bin/create-setup-bundle.sh +++ b/bin/wild-dnsmasq-install.sh @@ -10,6 +10,8 @@ WILDCLOUD_ROOT=$(wild-config wildcloud.root) || exit 1 # --- +# Create setup bundle. + DNSMASQ_SETUP_DIR="${WC_ROOT}/setup/dnsmasq" BUNDLE_DIR="${DNSMASQ_SETUP_DIR}/setup-bundle" mkdir -p "${BUNDLE_DIR}" @@ -66,3 +68,20 @@ wget http://boot.ipxe.org/arm64-efi/ipxe.efi -O ${FTPD_DIR}/ipxe-arm64.efi cp "${DNSMASQ_SETUP_DIR}/nginx.conf" "${BUNDLE_DIR}/nginx.conf" cp "${DNSMASQ_SETUP_DIR}/dnsmasq.conf" "${BUNDLE_DIR}/dnsmasq.conf" cp "${DNSMASQ_SETUP_DIR}/bin/setup.sh" "${BUNDLE_DIR}/setup.sh" + +# Copy setup bundle to DNSMasq server. +# This is the server that will run DNSMasq and serve PXE boot files. + +SERVER_HOST=$(wild-config cloud.dns.ip) || exit 1 +SETUP_DIR="${WC_HOME}/setup/dnsmasq/setup-bundle" +DESTINATION_DIR="~/dnsmasq-setup" + +echo "Copying DNSMasq setup files to ${SERVER_HOST}:${DESTINATION_DIR}..." +scp -r ${SETUP_DIR}/* root@${SERVER_HOST}:${DESTINATION_DIR} + +# Run setup script on the DNSMasq server. +echo "Running setup script on ${SERVER_HOST}..." +ssh root@${SERVER_HOST} "bash -s" < "${SETUP_DIR}/setup.sh" || { + echo "Error: Failed to run setup script on ${SERVER_HOST}" + exit 1 +} \ No newline at end of file diff --git a/setup/dnsmasq/bin/transfer-setup-bundle.sh b/setup/dnsmasq/bin/transfer-setup-bundle.sh deleted file mode 100755 index 9687393..0000000 --- a/setup/dnsmasq/bin/transfer-setup-bundle.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Check if WC_HOME is set -if [ -z "${WC_HOME:-}" ]; then - echo "Error: WC_HOME environment variable not set. Run \`source ./env.sh\`." - exit 1 -fi - -SERVER_HOST=$(wild-config cloud.dns.ip) || exit 1 -SETUP_DIR="${WC_HOME}/setup/dnsmasq/setup-bundle" -DESTINATION_DIR="~/dnsmasq-setup" - -echo "Copying DNSMasq setup files to ${SERVER_HOST}:${DESTINATION_DIR}..." -scp -r ${SETUP_DIR}/* root@${SERVER_HOST}:${DESTINATION_DIR}