From 6784b7addcc8f211c4c2299c0ed906731c99439a Mon Sep 17 00:00:00 2001 From: Goacid Date: Tue, 9 Feb 2016 10:30:53 +0100 Subject: [PATCH 1/2] Tund startup script for systemd --- etc/init/tund.service | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 etc/init/tund.service diff --git a/etc/init/tund.service b/etc/init/tund.service new file mode 100644 index 0000000..26e0984 --- /dev/null +++ b/etc/init/tund.service @@ -0,0 +1,9 @@ +[Unit] +Description=Tund tunnel +Documentation=https://github.com/aphyr/tund + +[Service] +Type=simple +ExecStart=/usr/local/bin/tund +StandardOutput=null +Restart=on-failure From e19f56819f45756f68b8bb5474ec66be2f030cf3 Mon Sep 17 00:00:00 2001 From: Goacid Date: Tue, 9 Feb 2016 10:42:39 +0100 Subject: [PATCH 2/2] Add systemd support --- bin/setup | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/setup b/bin/setup index de7fdc9..b904298 100755 --- a/bin/setup +++ b/bin/setup @@ -9,15 +9,21 @@ BIN_DIR=/usr/local/bin install -m 700 -o root -g root -D "${DIR}/bin/tund" "${BIN_DIR}/tund" # Install upstart script -if [ -d "/etc/init" ] +if [[ $(sudo stat /proc/1/exe |grep systemd) ]] then - install -m 644 -o root -g root "${DIR}/etc/init/tund.conf" /etc/init/tund.conf + install -m 644 -o root -g root "${DIR}/etc/init/tund.service" }/etc/systemd/system/tund.service else - install -m 755 -o root -g root "${DIR}/etc/init.d/tund" /etc/init.d/tund - update-rc.d tund defaults + if [[ $(sudo stat /proc/1/exe |grep init) ]] + if [ -d "/etc/init" ] + then + install -m 644 -o root -g root "${DIR}/etc/init/tund.conf" /etc/init/tund.conf + else + install -m 755 -o root -g root "${DIR}/etc/init.d/tund" /etc/init.d/tund + update-rc.d tund defaults + fi + fi fi - if [ ! -e "${ETC_DIR}/key" ] then if [ ! -e "${DIR}/etc/key" ]