This commit is contained in:
Russell Davies 2025-04-06 14:48:49 +00:00 committed by GitHub
commit 005ecbac26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 14 deletions

View file

@ -46,16 +46,22 @@ cp contrib/macos/yggdrasil.plist pkgbuild/root/Library/LaunchDaemons
cat > pkgbuild/scripts/postinstall << EOF cat > pkgbuild/scripts/postinstall << EOF
#!/bin/sh #!/bin/sh
mkdir -p /usr/local/etc
conf_file=/usr/local/etc/yggdrasil.conf
# Handle old path
[ -f /etc/yggdrasil.conf ] && mv /etc/yggdrasil.conf $conf_file
# Normalise the config if it exists, generate it if it doesn't # Normalise the config if it exists, generate it if it doesn't
if [ -f /etc/yggdrasil.conf ]; if [ -f $conf_file ];
then then
mkdir -p /Library/Preferences/Yggdrasil mkdir -p /Library/Preferences/Yggdrasil
echo "Backing up configuration file to /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d`" echo "Backing up configuration file to /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d`"
cp /etc/yggdrasil.conf /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d` cp $conf_file /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d`
echo "Normalising /etc/yggdrasil.conf" echo "Normalising $conf_file"
/usr/local/bin/yggdrasil -useconffile /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d` -normaliseconf > /etc/yggdrasil.conf /usr/local/bin/yggdrasil -useconffile /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d` -normaliseconf > $conf_file
else else
/usr/local/bin/yggdrasil -genconf > /etc/yggdrasil.conf /usr/local/bin/yggdrasil -genconf > $conf_file
fi fi
# Unload existing Yggdrasil launchd service, if possible # Unload existing Yggdrasil launchd service, if possible

View file

@ -6,19 +6,17 @@
<string>yggdrasil</string> <string>yggdrasil</string>
<key>ProgramArguments</key> <key>ProgramArguments</key>
<array> <array>
<string>sh</string> <string>/usr/local/bin/yggdrasil</string>
<string>-c</string> <string>-useconffile</string>
<string>/usr/local/bin/yggdrasil -useconffile /etc/yggdrasil.conf</string> <string>/usr/local/etc/yggdrasil.conf</string>
</array> </array>
<key>KeepAlive</key> <key>KeepAlive</key>
<true/> <true/>
<key>RunAtLoad</key> <key>RunAtLoad</key>
<true/> <true/>
<key>ProcessType</key>
<string>Interactive</string>
<key>StandardOutPath</key> <key>StandardOutPath</key>
<string>/tmp/yggdrasil.stdout.log</string> <string>/Library/Logs/yggdrasil.log</string>
<key>StandardErrorPath</key> <key>StandardErrorPath</key>
<string>/tmp/yggdrasil.stderr.log</string> <string>/Library/Logs/yggdrasil.log</string>
</dict> </dict>
</plist> </plist>