summaryrefslogtreecommitdiff
path: root/misc/dnetc
diff options
context:
space:
mode:
authorjmmv <jmmv>2003-04-09 16:16:06 +0000
committerjmmv <jmmv>2003-04-09 16:16:06 +0000
commitc3882e09e330a839f41369bd56e2e570890dd4ec (patch)
tree52a2eeb2552015ccf8721839dad931a51d618ea2 /misc/dnetc
parentaf8140cc740f01adbfe441b9838de44b174784d1 (diff)
downloadpkgsrc-c3882e09e330a839f41369bd56e2e570890dd4ec.tar.gz
Install a rc.d script to run this program at boot time, as an unprivileged
user. Bump PKGREVISION to 1. Closes my own PR pkg/18740.
Diffstat (limited to 'misc/dnetc')
-rw-r--r--misc/dnetc/Makefile6
-rw-r--r--misc/dnetc/PLIST3
-rw-r--r--misc/dnetc/files/dnetc.sh49
3 files changed, 56 insertions, 2 deletions
diff --git a/misc/dnetc/Makefile b/misc/dnetc/Makefile
index 835b603e6f4..1f46cc3a67f 100644
--- a/misc/dnetc/Makefile
+++ b/misc/dnetc/Makefile
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.2 2002/06/18 16:20:21 wiz Exp $
+# $NetBSD: Makefile,v 1.3 2003/04/09 16:16:06 jmmv Exp $
DISTNAME= ${DISTNAME_${OPSYS}_${MACHINE_ARCH}}
PKGNAME= dnetc-2.8015.469
+PKGREVISION= 1
CATEGORIES= misc
MASTER_SITES= http://http.distributed.net/pub/dcti/current-client/
@@ -13,6 +14,7 @@ ONLY_FOR_PLATFORM= Darwin-*-powerpc NetBSD-*-alpha NetBSD-*-arm32 \
NetBSD-*-i386 NetBSD-*-m68k NetBSD-*-sparc \
SunOS-*-sparc
NO_BUILD= YES
+USE_PKGINSTALL= YES
DISTNAME_Darwin_powerpc= dnetc-darwin-ppc
DISTNAME_NetBSD_m68k= dnetc-netbsd-68k
@@ -22,6 +24,8 @@ DISTNAME_NetBSD_i386= dnetc-netbsd-i386-elf
DISTNAME_NetBSD_sparc= dnetc-netbsd-sparc-elf
DISTNAME_SunOS_sparc= dnetc-solaris-sparc
+RCD_SCRIPTS= dnetc
+
do-extract:
@${MKDIR} ${WRKSRC}
@cd ${WRKSRC}; ${GTAR} -zxf ${DISTDIR}/${DISTFILES}
diff --git a/misc/dnetc/PLIST b/misc/dnetc/PLIST
index c0f0b8214ec..df66a17ca70 100644
--- a/misc/dnetc/PLIST
+++ b/misc/dnetc/PLIST
@@ -1,5 +1,6 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2002/06/15 08:10:58 shell Exp $
+@comment $NetBSD: PLIST,v 1.2 2003/04/09 16:16:06 jmmv Exp $
bin/dnetc
+etc/rc.d/dnetc
man/man1/dnetc.1
share/doc/dnetc/CHANGES.txt
share/doc/dnetc/dnetc.txt
diff --git a/misc/dnetc/files/dnetc.sh b/misc/dnetc/files/dnetc.sh
new file mode 100644
index 00000000000..b981733608c
--- /dev/null
+++ b/misc/dnetc/files/dnetc.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# $NetBSD: dnetc.sh,v 1.1 2003/04/09 16:16:06 jmmv Exp $
+#
+
+# PROVIDE: dnetc
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+dnetc_user="nobody"
+dnetc_group="nobody"
+dnetc_homedir="/var/db/dnetc"
+
+name="dnetc"
+rcvar=$name
+extra_commands="config"
+# XXX: We cannot use the full pathname to call dnetc's binary directly.
+# Doing so means it will not work properly.
+PATH=@PREFIX@/bin:/bin:/sbin:/usr/bin:/usr/sbin
+command="${name}"
+
+dnetc_config() {
+ if [ ! -d ${dnetc_homedir} ]; then
+ mkdir ${dnetc_homedir}
+ chmod 755 ${dnetc_homedir}
+ chown ${dnetc_user}:${dnetc_group} ${dnetc_homedir}
+ fi
+
+ su -fm ${dnetc_user} -c "cd ${dnetc_homedir} && exec ${command} -config"
+ return 0
+}
+
+dnetc_start() {
+ if [ ! -f ${dnetc_homedir}/dnetc.ini ]; then
+ run_rc_command config
+ fi
+
+ echo "Starting ${name}."
+ su -fm ${dnetc_user} -c "cd ${dnetc_homedir} && exec ${command} &" \
+ 2>/dev/null 1>/dev/null
+}
+
+config_cmd=dnetc_config
+start_cmd=dnetc_start
+
+load_rc_config $name
+run_rc_command "$1"