From a192b91eb72e77d3e15119ba76f092aca31ae903 Mon Sep 17 00:00:00 2001 From: Boyuan Yang <073plan@gmail.com> Date: Tue, 13 Oct 2015 23:35:23 +0800 Subject: [PATCH] add systemd service templates for debian Those new templates will be installed by dh_installinit. based on the work of @zh99998 for AUR. --- debian/README.Debian | 9 +++++---- debian/rules | 7 +++++++ debian/shadowsocks-libev-local@.service | 23 +++++++++++++++++++++++ debian/shadowsocks-libev-redir@.service | 23 +++++++++++++++++++++++ debian/shadowsocks-libev-server@.service | 23 +++++++++++++++++++++++ debian/shadowsocks-libev-tunnel@.service | 23 +++++++++++++++++++++++ 6 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 debian/shadowsocks-libev-local@.service create mode 100644 debian/shadowsocks-libev-redir@.service create mode 100644 debian/shadowsocks-libev-server@.service create mode 100644 debian/shadowsocks-libev-tunnel@.service diff --git a/debian/README.Debian b/debian/README.Debian index 7e5fdd16..75f51844 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,15 +1,16 @@ shadowsocks-libev for Debian ---------------------- -The Debian package has added systemd support. By default, the dpkg installer -will enable initscripts if the OS is using sysvinit, and systemd service unit -file if the OS is using systemd. This is done automatically. +The Debian package has added systemd support. A default server service which +reads the default configuration in /etc/default/shadowsocks-libev is installed +and enabled by default, plus some other service templates placed in +/lib/systemd/system, which can be used by users later. Another problem is that shadowsocks-libev is licensed under GPLv3+. This will conflict with OpenSSL License when linked against OpenSSL library. As a result, this package faces licensing problem. Use it at your own risk. - -- Boyuan Yang <073plan@gmail.com> Fri, 11 Sep 2015 19:08:30 +0800 + -- Boyuan Yang <073plan@gmail.com> Wed, 14 Oct 2015 09:18:50 +0800 (No special notes.) diff --git a/debian/rules b/debian/rules index e494abca..02c6a432 100755 --- a/debian/rules +++ b/debian/rules @@ -27,5 +27,12 @@ override_dh_auto_configure: dh_auto_configure -- \ --enable-shared +override_dh_installinit: + dh_installinit + dh_installinit --no-start --name=shadowsocks-libev-server@ + dh_installinit --no-start --name=shadowsocks-libev-tunnel@ + dh_installinit --no-start --name=shadowsocks-libev-redir@ + dh_installinit --no-start --name=shadowsocks-libev-local@ + %: dh $@ --with systemd diff --git a/debian/shadowsocks-libev-local@.service b/debian/shadowsocks-libev-local@.service new file mode 100644 index 00000000..ae06913a --- /dev/null +++ b/debian/shadowsocks-libev-local@.service @@ -0,0 +1,23 @@ +# This file is part of shadowsocks-libev. +# +# Shadowsocks-libev is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is a template unit file. Users may copy and rename the file into +# config directories to make new service instances. See systemd.unit(5) +# for details. + +[Unit] +Description=Shadowsocks-Libev Custom Client Service for %I +After=network.target + +[Service] +Type=simple +CapabilityBoundingSet=CAP_NET_BIND_SERVICE +ExecStart=/usr/bin/ss-local -c /etc/shadowsocks-libev/%i.json + +[Install] +WantedBy=multi-user.target + diff --git a/debian/shadowsocks-libev-redir@.service b/debian/shadowsocks-libev-redir@.service new file mode 100644 index 00000000..fee9125a --- /dev/null +++ b/debian/shadowsocks-libev-redir@.service @@ -0,0 +1,23 @@ +# This file is part of shadowsocks-libev. +# +# Shadowsocks-libev is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is a template unit file. Users may copy and rename the file into +# config directories to make new service instances. See systemd.unit(5) +# for details. + +[Unit] +Description=Shadowsocks-Libev Custom Client Service Redir Mode for %I +After=network.target + +[Service] +Type=simple +CapabilityBoundingSet=CAP_NET_BIND_SERVICE +ExecStart=/usr/bin/ss-redir -c /etc/shadowsocks-libev/%i.json + +[Install] +WantedBy=multi-user.target + diff --git a/debian/shadowsocks-libev-server@.service b/debian/shadowsocks-libev-server@.service new file mode 100644 index 00000000..9752bde3 --- /dev/null +++ b/debian/shadowsocks-libev-server@.service @@ -0,0 +1,23 @@ +# This file is part of shadowsocks-libev. +# +# Shadowsocks-libev is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is a template unit file. Users may copy and rename the file into +# config directories to make new service instances. See systemd.unit(5) +# for details. + +[Unit] +Description=Shadowsocks-Libev Custom Server Service for %I +After=network.target + +[Service] +Type=simple +CapabilityBoundingSet=CAP_NET_BIND_SERVICE +ExecStart=/usr/bin/ss-server -c /etc/shadowsocks-libev/%i.json + +[Install] +WantedBy=multi-user.target + diff --git a/debian/shadowsocks-libev-tunnel@.service b/debian/shadowsocks-libev-tunnel@.service new file mode 100644 index 00000000..7331551a --- /dev/null +++ b/debian/shadowsocks-libev-tunnel@.service @@ -0,0 +1,23 @@ +# This file is part of shadowsocks-libev. +# +# Shadowsocks-libev is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is a template unit file. Users may copy and rename the file into +# config directories to make new service instances. See systemd.unit(5) +# for details. + +[Unit] +Description=Shadowsocks-Libev Custom Client Service Tunnel Mode for %I +After=network.target + +[Service] +Type=simple +CapabilityBoundingSet=CAP_NET_BIND_SERVICE +ExecStart=/usr/bin/ss-tunnel -c /etc/shadowsocks-libev/%i.json + +[Install] +WantedBy=multi-user.target +