From 54a795136823059579acf08483113b489c7f26b6 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 13 Mar 2024 21:03:52 -0700 Subject: [PATCH] tinydns: refactor djb installers into include/djb --- tnpi/ns2.cadillac.net.sh | 148 ++++----------------------------------- 1 file changed, 14 insertions(+), 134 deletions(-) diff --git a/tnpi/ns2.cadillac.net.sh b/tnpi/ns2.cadillac.net.sh index 6e1eee20..539a9d80 100755 --- a/tnpi/ns2.cadillac.net.sh +++ b/tnpi/ns2.cadillac.net.sh @@ -1,79 +1,13 @@ #!/bin/sh -. mail-toaster.sh || exit +set -e + +. mail-toaster.sh +. include/djb.sh export JAIL_START_EXTRA="" export JAIL_CONF_EXTRA="" - -install_tinydns() -{ - tell_status "installing djbdns" - stage_pkg_install rsync daemontools || exit - - if [ ! -d "$STAGE_MNT/data/home" ]; then - mkdir "$STAGE_MNT/data/home" || exit - fi - stage_exec pw useradd tinydns -d /data/home/tinydns -m - - tell_status "installing ucspi-tcp with IPv6" - stage_make_conf sysutils_ucspi-tcp_SET 'sysutils_ucspi-tcp_SET=IPV6' - stage_port_install sysutils/ucspi-tcp || exit - - tell_status "installing djbdns with IPv6" - stage_make_conf dns_djbdns_SET 'dns_djbdns_SET=IP6' - stage_port_install dns/djbdns || exit -} - -configure_svscan() -{ - if [ ! -d "$STAGE_MNT/var/service" ]; then - tell_status "creating default service dir" - mkdir -p "$STAGE_MNT/var/service" || exit - fi - - if [ ! -d "$STAGE_MNT/data/service" ]; then - tell_status "creating local service dir" - mkdir -p "$STAGE_MNT/data/service" || exit - fi -} - -configure_tinydns4() -{ - tell_status "creating tinydns server" - stage_exec tinydns-conf tinydns bin /var/service/tinydns "$(get_jail_ip stage)" - tee "$STAGE_MNT/var/service/tinydns/run" <&1 - -# logging disabled -exec 1>/dev/null 2>&1 - -exec envuidgid tinydns envdir ./env softlimit -d300000 /usr/local/bin/tinydns -EO_TINYDNS_RUN - - echo "/data/root" > "$STAGE_MNT/var/service/tinydns/env/ROOT" || exit -} - -configure_tinydns6() -{ - tell_status "creating tinydns IPv6 server" - stage_exec tinydns-conf tinydns bin /var/service/tinydns-v6 "$(get_jail_ip6 stage)" - tee "$STAGE_MNT/var/service/tinydns-v6/run" <&1 - -# logging disabled -exec 1>/dev/null 2>&1 - -exec envuidgid tinydns envdir ./env softlimit -d300000 /usr/local/bin/tinydns -EO_TINYDNS_RUN - - echo "/data/root" > "$STAGE_MNT/var/service/tinydns-v6/env/ROOT" || exit -} +export JAIL_FSTAB="" configure_tinydns() { @@ -81,18 +15,20 @@ configure_tinydns() configure_tinydns4 configure_tinydns_data configure_tinydns6 + stage_sysrc sshd_enable="YES" } configure_tinydns_data() { - if [ -d "$ZFS_DATA_MNT/ns2.cadillac.net/root" ]; then + _data_root="$ZFS_DATA_MNT/ns2.cadillac.net/root" + if [ -d "$_data_root" ]; then tell_status "tinydns data already configured" return fi tell_status "configuring tinydns data" - mv "$STAGE_MNT/var/service/tinydns/root" "$ZFS_DATA_MNT/ns2.cadillac.net/root" - tee -a "$ZFS_DATA_MNT/ns2.cadillac.net/root/data" <&1 - -# logging disabled -exec 1>/dev/null 2>&1 - -exec envdir ./env sh -c ' - exec envuidgid tinydns softlimit -d300000 tcpserver -vDRHl0 -x tcp.cdb -- "$IP" 53 /usr/local/bin/axfrdns -' -EO_AXFRDNS_RUN - - tee "$STAGE_MNT/var/service/axfrdns/tcp" <&1 - -# logging disabled -exec 1>/dev/null 2>&1 - -exec envdir ./env sh -c ' - exec envuidgid tinydns softlimit -d300000 tcpserver -vDRHl0 -x tcp.cdb -- "$IP" 53 /usr/local/bin/axfrdns -' -EO_AXFRDNS_RUN - - tee "$STAGE_MNT/var/service/axfrdns-v6/tcp" <