Browse Source

Merge pull request #698 from atnaguzin/systemd

systemd unit, debian patch fix, makefile last-dist added, package log&pid folder edited
pull/700/head
orignal 8 years ago committed by GitHub
parent
commit
bc86b0345f
  1. 6
      Makefile
  2. 2
      contrib/debian/README
  3. 25
      contrib/debian/i2pd.service
  4. 2
      contrib/debian/i2pd.tmpfile
  5. 9
      debian/.gitignore
  6. 3
      debian/i2pd.default
  7. 8
      debian/i2pd.init
  8. 7
      debian/i2pd.openrc
  9. 2
      debian/i2pd.upstart
  10. 2
      debian/logrotate
  11. 11
      debian/patches/01-tune-build-opts.patch
  12. 4
      debian/postinst
  13. 4
      debian/postrm
  14. 3
      debian/rules

6
Makefile

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

2
contrib/debian/README vendored

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

25
contrib/debian/i2pd.service vendored

@ -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

2
contrib/debian/i2pd.tmpfile vendored

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

9
debian/.gitignore vendored

@ -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

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

8
debian/i2pd.init vendored

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

7
debian/i2pd.openrc vendored

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

2
debian/i2pd.upstart vendored

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

2
debian/logrotate vendored

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

11
debian/patches/01-tune-build-opts.patch vendored

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

4
debian/postinst vendored

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

4
debian/postrm vendored

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

3
debian/rules vendored

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

Loading…
Cancel
Save