mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Merge 573574c8b6 into d0b5352db3
				
					
				
			This commit is contained in:
		
						commit
						142b1538b6
					
				
					 2 changed files with 18 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue