-
-
Save wolfy1339/95b580288dc50b12b40cb996a688b2a6 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 --owner=root --group=root -cvzf ../dist.tar.gz * | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment