Skip to content

Instantly share code, notes, and snippets.

@iczero
Last active October 13, 2021 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iczero/0b34bc56f2225fa5d35a5d6ed3eafd38 to your computer and use it in GitHub Desktop.
Save iczero/0b34bc56f2225fa5d35a5d6ed3eafd38 to your computer and use it in GitHub Desktop.
Build a binary tarball of tinc
#!/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