Last active
October 14, 2021 21:51
-
-
Save JeDaYoshi/29c569930560138158fb28f3ecf37924 to your computer and use it in GitHub Desktop.
tinc build script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
if [[ $EUID -ne 0 ]]; then | |
fakeroot $0 | |
exit $? | |
fi | |
umask 022 | |
VERSION=$(git rev-parse --short HEAD) | |
autoreconf -fsi | |
./configure --prefix=/opt/tinc | |
make -j2 | |
rm -rf dist | |
DESTDIR=$(realpath dist) make install | |
cd dist | |
mkdir -p opt/tinc/etc/tinc | |
mkdir -p opt/tinc/var/run | |
mkdir -p etc/systemd/system | |
cat <<EOF >etc/systemd/system/tinc@.service | |
[Unit] | |
Description=Tinc net %i | |
[Service] | |
Type=forking | |
WorkingDirectory=/opt/tinc/etc/tinc/%i | |
ExecStart=/opt/tinc/sbin/tincd -n %i | |
ExecReload=/opt/tinc/sbin/tincd -n %i -kHUP | |
KillMode=mixed | |
TimeoutStopSec=5 | |
Restart=always | |
RestartSec=60 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
echo $VERSION > opt/tinc/version | |
tar cvzf ../tinc-dist.tar.gz * | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment