2 # Copyright 1999-2016 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
6 PIDFILE=${PIDFILE:-/run/gnunet/arm-service.pid}
8 PIDFILE=${PIDFILE:-/var/run/gnunet/arm-service.pid}
17 GNUNET_HOME="/var/lib/gnunet"
18 SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
23 chown $3 $1 2>/dev/null && chmod $2 $1
31 if [ -n "$(find ${GNUNET_HOME}/.local/share/gnunet -maxdepth 1 -name gnunet.conf -perm +0044)" ] ; then
32 eerror "${conf} must not be world or group readable. Try:"
33 eerror " chmod 600 ${conf}"
34 eerror " chown gnunet:gnunet ${conf}"
37 mkdir -p ${GNUNET_HOME}/.cache/gnunet
39 # taken from dangole's lede config.. thx!
40 local libexec="${GNUNET_PATH}/lib/gnunet/libexec" # why not /usr/libexec/gnunet ?
41 # not reliable enough:
42 #[ -e ${libexec}/.permfix ] && return
43 for helper in $SUID_ROOT_HELPERS; do
44 chmodown_execbin ${libexec}/gnunet-helper-$helper u+s
46 chmodown_execbin ${libexec}/gnunet-helper-dns 4750 root:gnunetdns
47 chmodown_execbin ${libexec}/gnunet-service-dns 2750 gnunet:gnunetdns
48 #touch ${libexec}/.permfix
52 checkconfig || return 1
54 local piddir=$(dirname ${PIDFILE})
55 if [ ! -d ${piddir} ] ; then
56 ebegin "Making ${piddir}"
59 ebegin "Changing permissions of ${piddir}"
60 chown gnunet:gnunet ${piddir}
64 ebegin "Starting ${SVCNAME}"
65 # shouldn't be necessary... but
66 start-stop-daemon --start --user gnunet --name gnunet --pidfile ${PIDFILE} \
67 --exec ${GNUNET_PATH}/lib/gnunet/libexec/gnunet-service-arm -- -d
68 # flags to be passed to the process appear after the double-dash
73 ebegin "Stopping ${SVCNAME}"
74 start-stop-daemon --stop --signal QUIT --pidfile ${PIDFILE}
78 rm -rf /tmp/gnunet-gnunet-runtime >/dev/null 2>&1
79 rm -rf /tmp/gnunet-system-runtime >/dev/null 2>&1