]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
rc.d/NetBSD/rakka: proper daemonization
authorPHO <pho@cielonegro.org>
Thu, 18 Feb 2010 13:16:31 +0000 (22:16 +0900)
committerPHO <pho@cielonegro.org>
Thu, 18 Feb 2010 13:16:31 +0000 (22:16 +0900)
rc.d/NetBSD/rakka.in

index 444b824cb86eaf6cdd4f1d1abfa55c639a0ecf96..437478f65c00ccbb54a36f88da95679bee1224ab 100644 (file)
@@ -7,14 +7,24 @@
 # -----------------------------------------------------
 
 # PROVIDE: rakka
-# REQUIRE: DAEMON
+# REQUIRE: NETWORKING
 
 . /etc/rc.subr
 
 name="rakka"
 rcvar=$name
-command="@RAKKA_BINDIR@/rakka"
+command="/tmp/launch_rakka.$$"
+procname="@RAKKA_BINDIR@/rakka"
 pidfile="@RAKKA_LOCALSTATEDIR@/pid"
 
+# Dirty hack: rakka can't daemonize itself because of Haskell's
+# forkProcess limitation.
+trap "unlink '$command'" EXIT
+cat <<'EOF' >"$command"
+#!/bin/sh
+@RAKKA_BINDIR@/rakka $@ &
+EOF
+chmod +x "$command"
+
 load_rc_config $name
 run_rc_command "$1"