summaryrefslogtreecommitdiff
path: root/japanese/ebnetd/files/ndtpd.sh.sample
diff options
context:
space:
mode:
authorMunechika SUMIKAWA <sumikawa@FreeBSD.org>2000-01-22 06:40:20 +0000
committerMunechika SUMIKAWA <sumikawa@FreeBSD.org>2000-01-22 06:40:20 +0000
commitaa85e6e0da4ebef243abd2f6222e8c0287b93eb3 (patch)
treeaf396999612f5073dfca73fc2f9273a4374642bc /japanese/ebnetd/files/ndtpd.sh.sample
parentOne more fixing PLIST. (diff)
Upgrade to 2.3.6.
Changes (from PR): - japanese/ndtpd o Set default syslog file for `/var/log/ndtpd.log'. o Change the default working directory `/var/ndtpd' to `/var/run/ndtpd'. * It will created by `${PREFIX}/etc/rc.d/ndtpd.sh' (even if the user select "Inetd mode" !) * Lock files and a PID file are created under it. o Support some arguments in the startup script: ${PREFIX}/etc/rc.d/ndtpd.sh start|stop|kill|restart|status|terminate o Separate the session to build `ndtpd.sh.sample' from `post-install' into `post-build'. o Don't configure EB sybsystem in NDTPD. - japanese/eb o Don't configure ZLIB sybsystem in EB. o Don't define CONFIGURE_ENV. * Suggested by Michael's last commit to japanese/ndtpd/Makefile. PR: 16117 Submitted by: Kazu TAKAMUNE <takamune@avrl.mei.co.jp>
Notes
Notes: svn path=/head/; revision=24906
Diffstat (limited to 'japanese/ebnetd/files/ndtpd.sh.sample')
-rw-r--r--japanese/ebnetd/files/ndtpd.sh.sample62
1 files changed, 48 insertions, 14 deletions
diff --git a/japanese/ebnetd/files/ndtpd.sh.sample b/japanese/ebnetd/files/ndtpd.sh.sample
index 17a62fc0aab8..bbf4f41b7508 100644
--- a/japanese/ebnetd/files/ndtpd.sh.sample
+++ b/japanese/ebnetd/files/ndtpd.sh.sample
@@ -1,15 +1,49 @@
-#!/bin/sh -
-#
-# NDTPD: rc-file for FreeBSD.
-#
-
-### NDTPD options: ###
-ndtpd_program=@prefix@/sbin/ndtpd # path to ndtpd.
-ndtpd_enable=YES # Run ndtpd (or NO).
-ndtpd_flags= # Flags to ndtpd (if enabled).
-### End of NDTPD options: ###
-
-if [ "x${ndtpd_enable}" = xYES -a -x ${ndtpd_program} ]; then
- echo -n " ndtpd"
- ${ndtpd_program} ${ndtpd_flags}
+#!/bin/sh -e -
+# startup script for ndtpd
+
+# Usage: ndtpd.sh [kill|restart|status|terminate|stop|start]
+
+command=$1
+standalone=YES # Run ndtpd as a standalone daemon.
+#standalone=NO # Run ndtpd as a child of inetd.
+
+GetDirective() {
+ directive=$1
+
+ awk '/^[ ]*'${directive}'[ ]+/ {print $2; exit}' ${conf}
+}
+
+MakeWorkingDirectory() {
+ user="`GetDirective user`"
+ group="`GetDirective group`"
+ work="`GetDirective work-path`"
+
+ rm -rf ${work:=@rundir@/ndtpd}
+ eval install -d ${user:+-o ${user}} ${group:+-g ${group}} ${work}
+}
+
+conf=@prefix@/etc/ndtpd.conf
+
+[ -f ${conf} ] || exit
+ndtpcheck || exit
+
+if [ "${standalone}" = YES ]; then
+ ctrl=ndtpcontrol
+ start="echo -n ' ndtpd'; ndtpd"
+else
+ ctrl="echo 'Error: inetd invokes ndtpd.' >&2; false"
fi
+
+case "${command}" in
+kill|restart|status|terminate)
+ eval ${ctrl} ${command};;
+
+stop)
+ eval ${ctrl} terminate;;
+
+start|*)
+ MakeWorkingDirectory
+ eval ${start};;
+esac
+
+exit