From 25ef084bd057e049c766d44159e85cad0eba5cd2 Mon Sep 17 00:00:00 2001 From: Robert Coleman <154176+rjocoleman@users.noreply.github.com> Date: Thu, 10 Oct 2024 23:25:06 +1300 Subject: [PATCH] use a config file for dnsmasq --- root/defaults/dnsmasq.conf | 5 +++++ root/etc/supervisor.conf | 2 +- root/init.sh | 14 ++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 root/defaults/dnsmasq.conf diff --git a/root/defaults/dnsmasq.conf b/root/defaults/dnsmasq.conf new file mode 100644 index 0000000..8b5f16e --- /dev/null +++ b/root/defaults/dnsmasq.conf @@ -0,0 +1,5 @@ +# TFTP config +enable-tftp +user=nbxyz +tftp-secure +tftp-root=/config/menus diff --git a/root/etc/supervisor.conf b/root/etc/supervisor.conf index 142e043..7fbe308 100644 --- a/root/etc/supervisor.conf +++ b/root/etc/supervisor.conf @@ -22,7 +22,7 @@ directory=/app priority = 3 [program:dnsmasq] -command=/usr/sbin/dnsmasq --port=0 --keep-in-foreground --enable-tftp --user=nbxyz --tftp-secure --tftp-root=/config/menus %(ENV_TFTPD_OPTS)s +command=/usr/sbin/dnsmasq --conf-file=/config/dnsmasq/dnsmasq.conf --port=0 --keep-in-foreground %(ENV_TFTPD_OPTS)s stdout_logfile=/config/tftpd.log redirect_stderr=true priority = 4 diff --git a/root/init.sh b/root/init.sh index 2eec0d7..b777e51 100755 --- a/root/init.sh +++ b/root/init.sh @@ -5,15 +5,21 @@ mkdir -p \ /assets \ /config/nginx/site-confs \ /config/log/nginx \ + /config/dnsmasq \ /run \ /var/lib/nginx/tmp/client_body \ /var/tmp/nginx # copy config files -[[ ! -f /config/nginx/nginx.conf ]] && \ +[[ ! -f /config/nginx/nginx.conf ]] && cp /defaults/nginx.conf /config/nginx/nginx.conf -[[ ! -f /config/nginx/site-confs/default ]] && \ - envsubst < /defaults/default > /config/nginx/site-confs/default +[[ ! -f /config/nginx/site-confs/default ]] && + envsubst /config/nginx/site-confs/default + +# create dnsmasq config +if [[ ! -f /config/dnsmasq/dnsmasq.conf ]]; then + cp /defaults/dnsmasq.conf /config/dnsmasq/dnsmasq.conf +fi # Ownership chown -R nbxyz:nbxyz /assets @@ -67,7 +73,7 @@ if [[ ! -f /config/menus/remote/menu.ipxe ]]; then /config/menus/remote/netboot.xyz-arm64-snponly.efi -sL \ "https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64-snponly.efi" # layer and cleanup - echo -n "${MENU_VERSION}" > /config/menuversion.txt + echo -n "${MENU_VERSION}" >/config/menuversion.txt cp -r /config/menus/remote/* /config/menus rm -f /tmp/menus.tar.gz fi