For Nexus Package creation
This commit is contained in:
1119
ext/installfiles/mac-nexus/Nexus.pkgproj
Executable file
1119
ext/installfiles/mac-nexus/Nexus.pkgproj
Executable file
File diff suppressed because it is too large
Load Diff
22
ext/installfiles/mac-nexus/com.backone.plist
Normal file
22
ext/installfiles/mac-nexus/com.backone.plist
Normal file
@@ -0,0 +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>
|
||||
<key>Label</key>
|
||||
<string>com.backone</string>
|
||||
<key>UserName</key>
|
||||
<string>root</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/Library/Application Support/BackOne/launch.sh</string>
|
||||
</array>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/Library/Application Support/BackOne</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/dev/null</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/dev/null</string>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
26
ext/installfiles/mac-nexus/get-proxy-settings.sh
Executable file
26
ext/installfiles/mac-nexus/get-proxy-settings.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Outputs host and port for system HTTP proxy or zeroes if none or not
|
||||
# configured.
|
||||
|
||||
export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
enabled=`system_profiler SPNetworkDataType|grep "HTTP Proxy Enabled"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'} 2>/dev/null`
|
||||
port=`system_profiler SPNetworkDataType|grep "HTTP Proxy Port"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'} 2>/dev/null`
|
||||
serv=`system_profiler SPNetworkDataType|grep "HTTP Proxy Server"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'} 2>/dev/null`
|
||||
|
||||
if [ "$enabled" = "Yes" ]; then
|
||||
if [ "$serv" ]; then
|
||||
if [ ! "$port" ]; then
|
||||
port=80
|
||||
fi
|
||||
|
||||
echo $serv $port
|
||||
else
|
||||
echo 0.0.0.0 0
|
||||
fi
|
||||
else
|
||||
echo 0.0.0.0 0
|
||||
fi
|
||||
|
||||
exit 0
|
||||
4
ext/installfiles/mac-nexus/launch.sh
Executable file
4
ext/installfiles/mac-nexus/launch.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
export PATH="/Library/Application Support/BackOne:/bin:/usr/bin:/sbin:/usr/sbin"
|
||||
/usr/bin/killall MacEthernetTapAgent >>/dev/null 2>&1
|
||||
exec backone
|
||||
51
ext/installfiles/mac-nexus/postinst.sh
Executable file
51
ext/installfiles/mac-nexus/postinst.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||
|
||||
cd "/Library/Application Support/BackOne"
|
||||
|
||||
if [ ! -f authtoken.secret ]; then
|
||||
head -c 1024 /dev/urandom | md5 | head -c 24 >authtoken.secret
|
||||
chown 0 authtoken.secret
|
||||
chgrp 0 authtoken.secret
|
||||
chmod 0600 authtoken.secret
|
||||
fi
|
||||
|
||||
if [ -f backone.pid ]; then
|
||||
kill `cat backone.pid`
|
||||
sleep 1
|
||||
killall MacEthernetTapAgent
|
||||
sleep 1
|
||||
killall -9 MacEthernetTapAgent
|
||||
sleep 1
|
||||
if [ -f backone.pid ]; then
|
||||
kill -9 `cat backone.pid`
|
||||
rm -f backone.pid
|
||||
fi
|
||||
fi
|
||||
launchctl load /Library/LaunchDaemons/com.backone.plist >>/dev/null 2>&1
|
||||
sleep 1
|
||||
|
||||
rm -f backone-cli backone-idtool
|
||||
ln -sf backone backone-cli
|
||||
ln -sf backone backone-idtool
|
||||
if [ ! -d /usr/local/bin ]; then
|
||||
mkdir -p /usr/local/bin
|
||||
fi
|
||||
cd /usr/local/bin
|
||||
rm -f backone-cli backone-idtool
|
||||
ln -sf "/Library/Application Support/BackOne/backone" backone-cli
|
||||
ln -sf "/Library/Application Support/BackOne/backone" backone-idtool
|
||||
|
||||
if [ -f /tmp/zt1-gui-restart.tmp ]; then
|
||||
for u in `cat /tmp/zt1-gui-restart.tmp`; do
|
||||
if [ -f '/Applications/BackOne.app/Contents/MacOS/BackOne' ]; then
|
||||
su $u -c '/usr/bin/open /Applications/BackOne.app &' >>/dev/null 2>&1 &
|
||||
else
|
||||
su $u -c '/usr/bin/open /Applications/BackOne.app &' >>/dev/null 2>&1 &
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -f /tmp/zt1-gui-restart.tmp
|
||||
|
||||
exit 0
|
||||
39
ext/installfiles/mac-nexus/preinst.sh
Executable file
39
ext/installfiles/mac-nexus/preinst.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
|
||||
rm -f /tmp/zt1-gui-restart.tmp
|
||||
for i in `ps axuwww | tr -s ' ' ',' | grep -F '/Applications/BackOne.app' | grep -F -v grep | cut -d , -f 1,2 | xargs`; do
|
||||
u=`echo $i | cut -d , -f 1`
|
||||
p=`echo $i | cut -d , -f 2`
|
||||
if [ ! -z "$u" -a "0$p" -gt 0 ]; then
|
||||
kill $p >>/dev/null 2>&1
|
||||
sleep 0.5
|
||||
kill -9 $p >>/dev/null 2>&1
|
||||
echo "$u" >>/tmp/zt1-gui-restart.tmp
|
||||
fi
|
||||
done
|
||||
for i in `ps axuwww | tr -s ' ' ',' | grep -F '/Applications/BackOne.app' | grep -F -v grep | cut -d , -f 1,2 | xargs`; do
|
||||
u=`echo $i | cut -d , -f 1`
|
||||
p=`echo $i | cut -d , -f 2`
|
||||
if [ ! -z "$u" -a "0$p" -gt 0 ]; then
|
||||
kill $p >>/dev/null 2>&1
|
||||
sleep 0.5
|
||||
kill -9 $p >>/dev/null 2>&1
|
||||
echo "$u" >>/tmp/zt1-gui-restart.tmp
|
||||
fi
|
||||
done
|
||||
chmod 0600 /tmp/zt1-gui-restart.tmp
|
||||
|
||||
cd "/Applications"
|
||||
rm -rf "BackOne.app"
|
||||
rm -rf "BackOne.app"
|
||||
|
||||
if [ -d '/Library/Application Support/BackOne' ]; then
|
||||
cd '/Library/Application Support/BackOne'
|
||||
# ensure that file locking doesn't cause issues with replacing the binary
|
||||
rm -f backone
|
||||
rm -f MacEthernetTapAgent
|
||||
fi
|
||||
|
||||
exit 0
|
||||
44
ext/installfiles/mac-nexus/uninstall.sh
Executable file
44
ext/installfiles/mac-nexus/uninstall.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
|
||||
if [ "$UID" -ne 0 ]; then
|
||||
echo "Must be run as root; try: sudo $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f '/Library/LaunchDaemons/com.backone.plist' ]; then
|
||||
echo 'BackOne does not seem to be installed.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /
|
||||
|
||||
echo 'Stopping any running BackOne service...'
|
||||
launchctl unload '/Library/LaunchDaemons/com.backone.plist' >>/dev/null 2>&1
|
||||
sleep 1
|
||||
killall -TERM zerotier-one >>/dev/null 2>&1
|
||||
sleep 1
|
||||
killall -KILL zerotier-one >>/dev/null 2>&1
|
||||
|
||||
echo "Removing BackOne files..."
|
||||
|
||||
rm -rf '/Applications/BackOne.app'
|
||||
rm -rf '/Applications/BackOne.app'
|
||||
rm -f '/usr/local/bin/backone' '/usr/local/bin/backone-idtool' '/usr/local/bin/backone-cli' '/Library/LaunchDaemons/com.backone.plist'
|
||||
|
||||
cd '/Library/Application Support/BackOne'
|
||||
if [ "`pwd`" = '/Library/Application Support/BackOne' ]; then
|
||||
rm -rf *.d *.sh *.log *.old *.kext *.conf *.pkg *.dmg *.pid *.port *.save *.bin planet backone-* devicemap
|
||||
fi
|
||||
|
||||
echo 'Uninstall complete.'
|
||||
echo
|
||||
echo 'Your identity and secret authentication token have been preserved in:'
|
||||
echo ' /Library/Application Support/BackOne'
|
||||
echo
|
||||
echo 'You can delete this folder and its contents if you do not intend to re-use'
|
||||
echo 'them.'
|
||||
echo
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user