5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 21:10:29 +00:00

Merge remote-tracking branch 'origin/develop' into metadata

This commit is contained in:
Neil Alexander 2018-12-14 22:33:00 +00:00
commit affddfb2fe
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
2 changed files with 31 additions and 8 deletions

View File

@ -52,8 +52,11 @@ Architecture: $PKGARCH
Replaces: $PKGREPLACES Replaces: $PKGREPLACES
Conflicts: $PKGREPLACES Conflicts: $PKGREPLACES
Maintainer: Neil Alexander <neilalexander@users.noreply.github.com> Maintainer: Neil Alexander <neilalexander@users.noreply.github.com>
Description: Debian yggdrasil package Description: Yggdrasil Network
Binary yggdrasil package for Debian and Ubuntu Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6
network. It is lightweight, self-arranging, supported on multiple platforms and
allows pretty much any IPv6-capable application to communicate securely with
other Yggdrasil nodes.
EOF EOF
cat > /tmp/$PKGNAME/debian/copyright << EOF cat > /tmp/$PKGNAME/debian/copyright << EOF
Please see https://github.com/yggdrasil-network/yggdrasil-go/ Please see https://github.com/yggdrasil-network/yggdrasil-go/
@ -68,21 +71,40 @@ etc/systemd/system/*.service etc/systemd/system
EOF EOF
cat > /tmp/$PKGNAME/debian/postinst << EOF cat > /tmp/$PKGNAME/debian/postinst << EOF
#!/bin/sh #!/bin/sh
if ! getent group yggdrasil 2>&1 > /dev/null; then
addgroup --system --quiet yggdrasil
fi
if [ -f /etc/yggdrasil.conf ]; if [ -f /etc/yggdrasil.conf ];
then then
mkdir -p /var/backups mkdir -p /var/backups
echo "Backing up configuration file to /var/backups/yggdrasil.conf.`date +%Y%m%d`" echo "Backing up configuration file to /var/backups/yggdrasil.conf.`date +%Y%m%d`"
cp /etc/yggdrasil.conf /var/backups/yggdrasil.conf.`date +%Y%m%d` cp /etc/yggdrasil.conf /var/backups/yggdrasil.conf.`date +%Y%m%d`
echo "Normalising /etc/yggdrasil.conf" echo "Normalising and updating /etc/yggdrasil.conf"
/usr/bin/yggdrasil -useconffile /var/backups/yggdrasil.conf.`date +%Y%m%d` -normaliseconf > /etc/yggdrasil.conf /usr/bin/yggdrasil -useconffile /var/backups/yggdrasil.conf.`date +%Y%m%d` -normaliseconf > /etc/yggdrasil.conf
chgrp yggdrasil /etc/yggdrasil.conf
if command -v systemctl >/dev/null; then
systemctl daemon-reload >/dev/null || true
systemctl enable yggdrasil || true
systemctl start yggdrasil || true
fi
else
echo "Generating initial configuration file /etc/yggdrasil.conf"
echo "Please familiarise yourself with this file before starting Yggdrasil"
/usr/bin/yggdrasil -genconf > /etc/yggdrasil.conf
chgrp yggdrasil /etc/yggdrasil.conf
fi fi
systemctl enable yggdrasil
systemctl start yggdrasil
EOF EOF
cat > /tmp/$PKGNAME/debian/prerm << EOF cat > /tmp/$PKGNAME/debian/prerm << EOF
#!/bin/sh #!/bin/sh
systemctl disable yggdrasil if command -v systemctl >/dev/null; then
systemctl stop yggdrasil if systemctl is-active --quiet yggdrasil; then
systemctl stop yggdrasil || true
fi
systemctl disable yggdrasil || true
fi
EOF EOF
cp yggdrasil /tmp/$PKGNAME/usr/bin/ cp yggdrasil /tmp/$PKGNAME/usr/bin/

View File

@ -4,6 +4,7 @@ Wants=network.target
After=network.target After=network.target
[Service] [Service]
Group=yggdrasil
ProtectHome=true ProtectHome=true
ProtectSystem=true ProtectSystem=true
SyslogIdentifier=yggdrasil SyslogIdentifier=yggdrasil
@ -12,7 +13,7 @@ ExecStartPre=/bin/sh -ec "if ! test -s /etc/yggdrasil.conf; \
yggdrasil -genconf > /etc/yggdrasil.conf; \ yggdrasil -genconf > /etc/yggdrasil.conf; \
echo 'WARNING: A new /etc/yggdrasil.conf file has been generated.'; \ echo 'WARNING: A new /etc/yggdrasil.conf file has been generated.'; \
fi" fi"
ExecStart=/bin/sh -c "exec yggdrasil -useconf < /etc/yggdrasil.conf" ExecStart=/usr/bin/yggdrasil -useconffile /etc/yggdrasil.conf
Restart=always Restart=always
[Install] [Install]