2 # Copyright 1999-2016 Gentoo Authors
3 # Copyright 2016 - 2019 ng0, lynX
4 # Distributed under the terms of the GNU General Public License v2
5 # SPDX-License-Identifier: GPL2.0
8 PIDFILE=${PIDFILE:-/run/gnunet/arm-service.pid}
10 PIDFILE=${PIDFILE:-/var/run/gnunet/arm-service.pid}
19 GNUNET_HOME="/var/lib/gnunet"
20 SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
25 chown $3 $1 2>/dev/null && chmod $2 $1
33 if [ -n "$(find ${GNUNET_HOME}/.local/share/gnunet -maxdepth 1 -name gnunet.conf -perm +0044)" ] ; then
34 eerror "${conf} must not be world or group readable. Try:"
35 eerror " chmod 600 ${conf}"
36 eerror " chown gnunet:gnunet ${conf}"
39 mkdir -p ${GNUNET_HOME}/.cache/gnunet
41 # taken from dangole's lede config.. thx!
42 local libexec="${GNUNET_PATH}/lib/gnunet/libexec" # why not /usr/libexec/gnunet ?
43 # not reliable enough:
44 #[ -e ${libexec}/.permfix ] && return
45 for helper in $SUID_ROOT_HELPERS; do
46 chmodown_execbin ${libexec}/gnunet-helper-$helper u+s
48 chmodown_execbin ${libexec}/gnunet-helper-dns 4750 root:gnunetdns
49 chmodown_execbin ${libexec}/gnunet-service-dns 2750 gnunet:gnunetdns
50 #touch ${libexec}/.permfix
54 checkconfig || return 1
56 local piddir=$(dirname ${PIDFILE})
57 if [ ! -d ${piddir} ] ; then
58 ebegin "Making ${piddir}"
61 ebegin "Changing permissions of ${piddir}"
62 chown gnunet:gnunet ${piddir}
66 ebegin "Starting ${SVCNAME}"
67 # shouldn't be necessary... but
68 start-stop-daemon --start --user gnunet --name gnunet --pidfile ${PIDFILE} \
69 --exec ${GNUNET_PATH}/lib/gnunet/libexec/gnunet-service-arm -- -d
70 # flags to be passed to the process appear after the double-dash
75 ebegin "Stopping ${SVCNAME}"
76 start-stop-daemon --stop --signal QUIT --pidfile ${PIDFILE}
80 rm -rf /tmp/gnunet-gnunet-runtime >/dev/null 2>&1
81 rm -rf /tmp/gnunet-system-runtime >/dev/null 2>&1