systemd unit, debian patch fix, makefile last-dist added, package log&pid folder edited

This commit is contained in:
atnaguzin 2016-11-03 19:08:21 +03:00
parent 4b983300fe
commit 8b0ce30dfc
14 changed files with 69 additions and 19 deletions

View File

@ -14,7 +14,6 @@ USE_STATIC := no
USE_MESHNET := no
USE_UPNP := no
ifeq ($(WEBSOCKETS),1)
NEEDED_CXXFLAGS += -DWITH_EVENTS
DAEMON_SRC += Websocket.cpp
@ -95,10 +94,15 @@ strip: $(I2PD) $(SHLIB_CLIENT) $(SHLIB)
strip $^
LATEST_TAG=$(shell git describe --tags --abbrev=0 openssl)
BRANCH=$(shell git branch --no-color | cut -c 3-)
dist:
git archive --format=tar.gz -9 --worktree-attributes \
--prefix=i2pd_$(LATEST_TAG)/ $(LATEST_TAG) -o i2pd_$(LATEST_TAG).tar.gz
last-dist:
git archive --format=tar.gz -9 --worktree-attributes \
--prefix=i2pd_$(LATEST_TAG)/ $(BRANCH) -o ../i2pd_$(LATEST_TAG).orig.tar.gz
doxygen:
doxygen -s docs/Doxyfile

2
contrib/debian/README Normal file
View File

@ -0,0 +1,2 @@
This forder contain systemd unit files.
To use systemd daemon control, place files from this directory to debian folder.

View File

@ -0,0 +1,25 @@
[Unit]
Description=I2P Router written in C++
After=network.target
[Service]
User=i2pd
Group=i2pd
Type=forking
ExecStart=/usr/sbin/i2pd --conf=/etc/i2pd/i2pd.conf --pidfile=/var/run/i2pd/i2pd.pid --logfile=/var/log/i2pd/i2pd.log --daemon --service
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/var/run/i2pd/i2pd.pid
### Uncomment, if auto restart needed
#Restart=on-failure
### Use SIGINT for gracefull stop daemon.
# i2pd stops accepting new tunnels and waits ~10 min while old ones do not die.
KillSignal=SIGINT
TimeoutStopSec=10m
# If you have problems with hunging i2pd, you can try enable this
#LimitNOFILE=4096
PrivateDevices=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,2 @@
d /var/run/i2pd 0755 i2pd i2pd - -
d /var/log/i2pd 0755 i2pd i2pd - -

9
debian/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
files
i2pd-dbg.substvars
i2pd-dbg/
i2pd.postinst.debhelper
i2pd.postrm.debhelper
i2pd.prerm.debhelper
i2pd.substvars
i2pd/

3
debian/i2pd.default vendored
View File

@ -6,3 +6,6 @@ I2PD_ENABLED="yes"
# Additional options that are passed to the Daemon.
# see possible switches in /usr/share/doc/i2pd/configuration.md.gz
DAEMON_OPTS=""
# If you have problems with hunging i2pd, you can try enable this
#ulimit -n 4096

8
debian/i2pd.init vendored
View File

@ -15,10 +15,10 @@ DESC=i2pd # Introduce a short description here
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
PIDFILE=/var/run/$NAME/$NAME.pid
I2PCONF=/etc/$NAME/i2pd.conf
TUNCONF=/etc/$NAME/tunnels.conf
LOGFILE=/var/log/$NAME.log
LOGFILE=/var/log/$NAME/$NAME.log
USER="i2pd"
# Exit if the package is not installed
@ -41,9 +41,11 @@ do_start()
return 2
fi
test -e /var/run/i2pd || install -m 755 -o i2pd -g i2pd -d /var/run/i2pd
touch "$PIDFILE"
chown -f $USER:adm "$PIDFILE"
test -e /var/log/i2pd || install -m 755 -o i2pd -g i2pd -d /var/log/i2pd
touch "$LOGFILE"
chown -f $USER:adm "$LOGFILE"
@ -99,7 +101,7 @@ case "$1" in
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
reload)
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg $?

7
debian/i2pd.openrc vendored
View File

@ -1,7 +1,7 @@
#!/sbin/openrc-run
pidfile="/var/run/i2pd.pid"
logfile="/var/log/i2pd.log"
pidfile="/var/run/i2pd/i2pd.pid"
logfile="/var/log/i2pd/i2pd.log"
mainconf="/etc/i2pd/i2pd.conf"
tunconf="/etc/i2pd/tunnels.conf"
@ -32,9 +32,6 @@ start_pre() {
checkpath -f -o i2pd:adm $logfile
checkpath -f -o i2pd:adm $pidfile
if [ -n "$I2PD_PORT" -a "$I2PD_PORT" -gt 0 ]; then
command_args="$command_args --port=$I2PD_PORT"
fi
if [ -n "$DAEMON_OPTS" ]; then
command_args="$command_args $DAEMON_OPTS"
fi

2
debian/i2pd.upstart vendored
View File

@ -4,6 +4,6 @@ start on runlevel [2345]
stop on runlevel [016] or unmounting-filesystem
# these can be overridden in /etc/init/i2pd.override
env LOGFILE="/var/log/i2pd.log"
env LOGFILE="/var/log/i2pd/i2pd.log"
exec /usr/sbin/i2pd --daemon --service --log=file --logfile=$LOGFILE

2
debian/logrotate vendored
View File

@ -1,4 +1,4 @@
/var/log/i2pd.log {
/var/log/i2pd/i2pd.log {
rotate 6
daily
missingok

View File

@ -1,5 +1,5 @@
diff --git a/Makefile b/Makefile
index 7d04ba0..33ee184 100644
index b6fc795..abc3ace 100644
--- a/Makefile
+++ b/Makefile
@@ -9,10 +9,10 @@ DEPS := obj/make.dep
@ -10,8 +10,7 @@ index 7d04ba0..33ee184 100644
+USE_AESNI := no
USE_STATIC := no
USE_MESHNET := no
-USE_UPNP := no
+USE_UPNP := yes
ifeq ($(UNAME),Darwin)
DAEMON_SRC += DaemonLinux.cpp
USE_UPNP := no
ifeq ($(WEBSOCKETS),1)
NEEDED_CXXFLAGS += -DWITH_EVENTS

4
debian/postinst vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
LOGFILE='/var/log/i2pd.log'
LOGFILE='/var/log/i2pd/i2pd.log'
I2PDHOME='/var/lib/i2pd'
I2PDUSER='i2pd'
@ -17,6 +17,8 @@ case "$1" in
adduser --system --quiet --group --home $I2PDHOME $I2PDUSER
fi
mkdir -p -m0750 /var/log/i2pd
chown -f ${I2PDUSER}:adm /var/log/i2pd
touch $LOGFILE
chmod 640 $LOGFILE
chown -f ${I2PDUSER}:adm $LOGFILE

4
debian/postrm vendored
View File

@ -2,9 +2,11 @@
set -e
if [ "$1" = "purge" ]; then
rm -f /etc/default/i2pd /var/log/i2pd.log
rm -f /etc/default/i2pd
rm -rf /etc/i2pd
rm -rf /var/lib/i2pd
rm -rf /var/log/i2pd
rm -rf /var/run/i2pd
fi
#DEBHELPER#

3
debian/rules vendored
View File

@ -15,3 +15,6 @@ PREFIX=/usr
override_dh_strip:
dh_strip --dbg-package=i2pd-dbg
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info