Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update macOS installer and launchd file #805

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions contrib/macos/create-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,22 @@ cp contrib/macos/yggdrasil.plist pkgbuild/root/Library/LaunchDaemons
cat > pkgbuild/scripts/postinstall << EOF
#!/bin/sh

mkdir -p /usr/local/etc
conf_file=/usr/local/etc/yggdrasil.conf

russelldavies marked this conversation as resolved.
Show resolved Hide resolved
# 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
if [ -f /etc/yggdrasil.conf ];
if [ -f $conf_file ];
then
mkdir -p /Library/Preferences/Yggdrasil
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`
echo "Normalising /etc/yggdrasil.conf"
/usr/local/bin/yggdrasil -useconffile /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d` -normaliseconf > /etc/yggdrasil.conf
cp $conf_file /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d`
echo "Normalising $conf_file"
/usr/local/bin/yggdrasil -useconffile /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d` -normaliseconf > $conf_file
else
/usr/local/bin/yggdrasil -genconf > /etc/yggdrasil.conf
/usr/local/bin/yggdrasil -genconf > $conf_file
fi

# Unload existing Yggdrasil launchd service, if possible
Expand Down
16 changes: 7 additions & 9 deletions contrib/macos/yggdrasil.plist
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<dict>
<key>Label</key>
<string>yggdrasil</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/usr/local/bin/yggdrasil -useconffile /etc/yggdrasil.conf</string>
<string>/usr/local/bin/yggdrasil</string>
<string>-useconffile</string>
<string>/usr/local/etc/yggdrasil.conf</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>ProcessType</key>
<string>Interactive</string>
<key>StandardOutPath</key>
<string>/tmp/yggdrasil.stdout.log</string>
<string>/Library/Logs/yggdrasil.log</string>
<key>StandardErrorPath</key>
<string>/tmp/yggdrasil.stderr.log</string>
</dict>
<string>/Library/Logs/yggdrasil.log</string>
</dict>
</plist>