Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
9 changes: 9 additions & 0 deletions etc/init/tund.service
Original file line number Diff line number Diff line change
@@ -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