mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
* add 'i2pd' user (#313)
This commit is contained in:
parent
3676304751
commit
8f218141f4
1
debian/control
vendored
1
debian/control
vendored
@ -17,6 +17,7 @@ Vcs-Browser: https://github.com/PurpleI2P/i2pd.git
|
||||
|
||||
Package: i2pd
|
||||
Architecture: any
|
||||
Pre-Depends: adduser
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Recommends: privoxy
|
||||
Suggests: tor
|
||||
|
16
debian/i2pd.init
vendored
16
debian/i2pd.init
vendored
@ -16,9 +16,9 @@ NAME=i2pd # Introduce the short server's name here
|
||||
DAEMON=/usr/sbin/$NAME # Introduce the server's location here
|
||||
DAEMON_OPTS="" # Arguments to run the daemon with
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
I2PCONF=/etc/$NAME/i2pd.conf
|
||||
TUNCONF=/etc/$NAME/tunnels.conf
|
||||
USER="i2pd"
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x $DAEMON ] || exit 0
|
||||
@ -36,16 +36,20 @@ do_start()
|
||||
# 2 if daemon could not be started
|
||||
|
||||
if [ "x$I2PD_ENABLED" != "xyes" ]; then
|
||||
log_warning_msg "disabled in config"
|
||||
log_warning_msg "$NAME disabled in config"
|
||||
return 2
|
||||
fi
|
||||
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||
touch "$PIDFILE"
|
||||
chown -f $USER:adm "$PIDFILE"
|
||||
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid "$USER" --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid "$USER" -- \
|
||||
--service=1 --daemon=1 --log=1 --conf=$I2PCONF --tunnelscfg=$TUNCONF \
|
||||
--port=$I2PD_PORT $DAEMON_OPTS \
|
||||
--port=$I2PD_PORT $DAEMON_OPTS > /dev/null 2>&1 \
|
||||
|| return 2
|
||||
return $?
|
||||
}
|
||||
|
||||
# Function that stops the daemon/service
|
||||
@ -115,7 +119,7 @@ case "$1" in
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
36
debian/postinst
vendored
Executable file
36
debian/postinst
vendored
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
I2PDHOME='/var/lib/i2pd'
|
||||
I2PDUSER='i2pd'
|
||||
|
||||
case "$1" in
|
||||
configure|reconfigure)
|
||||
# Older versions of adduser created the home directory.
|
||||
# The version of adduser in Debian unstable does not.
|
||||
# Create user and group as a system user.
|
||||
getent passwd ${I2PDUSER} > /dev/null 2>&1
|
||||
if [ $? -eq 2 ]; then
|
||||
adduser --system --quiet --group --home $I2PDHOME $I2PDUSER
|
||||
else
|
||||
groupadd -f $I2PDUSER || true
|
||||
usermod -s "/bin/false" -e 1 $I2PDUSER > /dev/null || true
|
||||
fi
|
||||
|
||||
touch /var/log/i2pd.log
|
||||
chown -f ${I2PDUSER}:adm /var/log/i2pd.log
|
||||
mkdir -p -m0750 $I2PDHOME
|
||||
chown -f -R ${I2PDUSER}:${I2PDUSER} ${I2PDHOME}
|
||||
;;
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
echo "Aborting upgrade"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "postinst called with unknown argument '$1'" >&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
12
debian/postrm
vendored
Executable file
12
debian/postrm
vendored
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$1" = "purge" ]; then
|
||||
rm -f /etc/default/i2pd /var/log/i2pd.log
|
||||
rm -rf /var/lib/i2pd
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user