aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-12-07 18:24:32 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-12-07 18:24:32 +0000
commitccd3e699094b001d7bc736bbcddba9d9cc1cf104 (patch)
tree439dc05caccbb4e205b69732a17e5e9111bc65c9
parentd438d535e8c180e10ca4d6fcd78f2b4ae95880e6 (diff)
downloadpfsense-packages-ccd3e699094b001d7bc736bbcddba9d9cc1cf104.tar.gz
pfsense-packages-ccd3e699094b001d7bc736bbcddba9d9cc1cf104.tar.bz2
pfsense-packages-ccd3e699094b001d7bc736bbcddba9d9cc1cf104.zip
* Write out svscan.sh startup file
* Write out tinydns zone data
-rw-r--r--packages/tinydns/tinydns.inc73
1 files changed, 68 insertions, 5 deletions
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 = <<<EOD
+
+#!/bin/sh
+#
+# PROVIDE: svscan
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD
+
+MINSEGMENT=10240
+MAXSEGMENT=20480
+MAXFILESIZE=10240
+MAXFD=100
+MAXCHILD=40
+
+# ulimits
+ulimit -d \${MINSEGMENT}
+ulimit -f \${MAXFILESIZE}
+ulimit -m \${MAXSEGMENT}
+ulimit -n \${MAXFD}
+ulimit -s \${MINSEGMENT}
+ulimit -u \${MAXCHILD}
+
+. /etc/rc.subr
+
+name="svscan"
+rcvar=`set_rcvar`
+command="/usr/local/bin/svscan"
+svscan_enable=\${svscan_enable-"NO"}
+svscan_servicedir=\${svscan_servicedir-"/var/service"}
+
+start_cmd="svscan_start"
+stop_postcmd="svscan_stop_post"
+
+load_rc_config \$name
+
+required_dirs="\${svscan_servicedir}"
+
+svscan_start () {
+ echo "Starting svscan."
+ /usr/bin/env \
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
+ /usr/sbin/daemon -f /bin/sh -c "\$command \$svscan_servicedir 2>&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();
}