pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

gnunet: more work on rc.d service



Module Name:	pkgsrc-wip
Committed By:	ng0 <ng0%n0.is@localhost>
Pushed By:	ng0
Date:		Thu Feb 28 21:06:29 2019 +0000
Changeset:	cff70cd9c669b2ec5b60417486a87b8127e559ff

Modified Files:
	gnunet/files/gnunet.in
Added Files:
	gnunet/MESSAGE

Log Message:
gnunet: more work on rc.d service

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=cff70cd9c669b2ec5b60417486a87b8127e559ff

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 gnunet/MESSAGE         | 19 +++++++++++++++++++
 gnunet/files/gnunet.in | 48 ++++++++++++++++++++++++++++++++++--------------
 2 files changed, 53 insertions(+), 14 deletions(-)

diffs:
diff --git a/gnunet/MESSAGE b/gnunet/MESSAGE
new file mode 100644
index 0000000000..848877adf7
--- /dev/null
+++ b/gnunet/MESSAGE
@@ -0,0 +1,19 @@
+===========================================================================
+$NetBSD$
+
+To enable this package, put the following into your /etc/rc.conf:
+
+	gnunet=YES
+
+and ensure that
+
+	${RCD_SCRIPTS_DIR}/gnunet start
+
+is run at the appropriate time.
+Each GNUnet user should be added to the ${GNUNET_GROUP}.
+
+Read the documentation (info gnunet) and provided example
+files as well as the man pages to learn how to customize
+your peer configuration. An online documentation is
+provided at https://docs.gnunet.org/.
+===========================================================================
diff --git a/gnunet/files/gnunet.in b/gnunet/files/gnunet.in
index 44523acd83..4f5ae08e38 100755
--- a/gnunet/files/gnunet.in
+++ b/gnunet/files/gnunet.in
@@ -17,32 +17,35 @@ name="gnunet"
 rcvar=$name
 command="@PREFIX@/bin/gnunet-arm"
 required_files="@PKG_SYSCONFDIR@/gnunet.conf"
-start_cmd="gnunet_start"
-stop_cmd="gnunet_stop"
 pidfile="@PKG_HOME@/${name}.pid"
-restart_cmd="gnunet_stop ; gnunet_start"
-extra_commands="reload"
-
 : ${gnunet_user:=@GNUNET_USER@}
 : ${gnunet_group:=@GNUNET_GROUP@}
 : ${gnunet_home:=@PKG_HOME@}
 : ${gnunetdns_group:=@GNUNETDNS_GROUP@}
 
-gnunet_chdir="${gnunet_home}"
-gnunet_env="HOME=${gnunet_home}"
+extra_commands="reload"
+start_cmd="gnunet_start"
+start_precmd="gnunet_precmd"
+stop_cmd="gnunet_stop"
+restart_cmd="gnunet_stop ; gnunet_start"
+restart_precmd="gnunet_precmd"
+reload_cmd="gnunet_reload"
+
 
-checkconfig()
+gnunet_precmd()
 {
 	if [ -n "$(find @PKG_HOME@/.local/share/gnunet -maxdepth 1 -name gnunet.conf -perm +0044)" ]; then
 		echo "@PKG_HOME@/.local/share/gnunet/gnunet.conf"
 		echo "must not be world or group readable, use"
 		echo "chmod 600" 
-		echo "and chown gnunet:gnunet"
+		echo "and chown @GNUNET_USER@:@GNUNET_GROUP@"
+	fi
+	if [ ! -d ${gnunet_home}/.cache/gnunet ]; then
+		mkdir -p ${gnunet_home}/.cache/gnunet
 	fi
-	mkdir -p @PKG_HOME@/.cache/gnunet
 }
 
-gnunet_start ()
+gnunet_start()
 {
 	@ECHO@ "Starting ${name}."
 	doit="@SU@ -m ${gnunet_user} -c '${command} ${command_args}'"
@@ -62,10 +65,27 @@ gnunet_stop()
 	rm -rf /tmp/gnunet-system-runtime 2>/dev/null 2>&1
 }
 
-if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]
-then
+if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
 	load_rc_config $name
 	run_rc_command "$1"
 else
-	eval ${start_cmd}
+	pidfile="${gnunet_home}/${name}.pid"
+	case "$1" in
+	restart)
+		eval ${restart_precmd}
+		eval ${restart_cmd}
+		;;
+	stop)
+		if [ -r "${pidfile}" ]; then
+			eval ${stop_cmd}
+		fi
+		;;
+	reload)
+		eval ${reload_cmd}
+		;;
+	*)
+		eval ${start_precmd}
+		eval ${start_cmd}
+		;;
+	esac
 fi


Home | Main Index | Thread Index | Old Index