Skip to content

Instantly share code, notes, and snippets.

@wolfy1339
Forked from iczero/tinc-dist.sh
Last active March 4, 2020 20:12
Show Gist options
  • Save wolfy1339/95b580288dc50b12b40cb996a688b2a6 to your computer and use it in GitHub Desktop.
Save wolfy1339/95b580288dc50b12b40cb996a688b2a6 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 --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