mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 06:05:06 +03:00
Update debian package to fix systemd disabling (not good for remote systems) and add group yggdrasil for admin socket/conf
This commit is contained in:
parent
ce98aac504
commit
e1c7983752
2 changed files with 19 additions and 8 deletions
|
@ -71,29 +71,39 @@ etc/systemd/system/*.service etc/systemd/system
|
|||
EOF
|
||||
cat > /tmp/$PKGNAME/debian/postinst << EOF
|
||||
#!/bin/sh
|
||||
|
||||
if ! getent group yggdrasil 2>&1 > /dev/null; then
|
||||
addgroup --system --quiet yggdrasil
|
||||
fi
|
||||
|
||||
if [ -f /etc/yggdrasil.conf ];
|
||||
then
|
||||
mkdir -p /var/backups
|
||||
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`
|
||||
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
|
||||
fi
|
||||
if command -v systemctl >/dev/null; then
|
||||
systemctl daemon-reload >/dev/null || true
|
||||
if [ -f /etc/systemd/system/multi-user.target.wants/yggdrasil.service ]; then
|
||||
echo "Starting Yggdrasil"
|
||||
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
|
||||
EOF
|
||||
cat > /tmp/$PKGNAME/debian/prerm << EOF
|
||||
#!/bin/sh
|
||||
if command -v systemctl >/dev/null; then
|
||||
if systemctl is-active --quiet yggdrasil; then
|
||||
echo "Stopping Yggdrasil"
|
||||
systemctl stop yggdrasil || true
|
||||
fi
|
||||
systemctl disable yggdrasil || true
|
||||
fi
|
||||
EOF
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue