From ccd3e699094b001d7bc736bbcddba9d9cc1cf104 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 7 Dec 2006 18:24:32 +0000 Subject: * Write out svscan.sh startup file * Write out tinydns zone data --- packages/tinydns/tinydns.inc | 73 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 5 deletions(-) (limited to 'packages/tinydns/tinydns.inc') diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 38aa33b9..87483120 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -35,15 +35,73 @@ function tinydns_custom_php_install_command() { /* setup daemon tools service area */ exec("pw useradd Gtinydns"); exec("pw useradd Gdnslog"); + + $fd = fopen("/usr/local/etc/rc.d/svscan.sh", "w"); + + $svscan = <<&1 | /usr/local/bin/readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................ &" > /dev/null +} + +svscan_stop_post () { + echo "Stopping svscan." + find -L "\$svscan_servicedir" -mindepth 1 -maxdepth 2 -type d \( \! -path "\$svscan_servicedir/*/*" -or -name 'log' \) -print0 | xargs -0 /usr/local/bin/svc -dx +} + +run_rc_command "\$1" + +EOD; + + fwrite($fd, $svscan); + fclose($fd); conf_mount_ro(); } function tinydns_custom_php_deinstall_command() { global $g, $config; conf_mount_rw(); - /* destroyh all daemontools items */ - exec("pw userdelete Gtinydns"); - exec("pw userdelete Gdnslog"); + /* destroy all daemontools items */ + exec("/usr/sbin/pw userdelete Gtinydns"); + exec("/usr/sbin/pw userdelete Gdnslog"); conf_mount_ro(); } @@ -59,10 +117,15 @@ function tinydns_custom_php_changeip_command() { } function tinydns_create_zone_file() { - $fd = fopen("/service/tinydns/root/data", "w"); global $g, $config; conf_mount_rw(); - + $fd = fopen("/service/tinydns/root/data", "w"); + foreach($config['installedpackages']['tinydnsdomains'] as $domain) { + fwrite($fd, $domain['recordtype'] . ":" . $domain['hostname'] . "\n"); + } + fclose($fd); + /* tell tinydns to reload zone file */ + exec("cd /service/tinydns/root && /usr/local/bin/tinydns-data"); conf_mount_ro(); } -- cgit v1.2.3