Last active
October 13, 2021 13:29
-
-
Save iczero/0b34bc56f2225fa5d35a5d6ed3eafd38 to your computer and use it in GitHub Desktop.
Build a binary tarball of tinc
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 -j8 | |
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 ../dist.tar.gz * | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment