Update zerotier2.sh

This commit is contained in:
Michael
2022-09-20 17:04:39 +01:00
committed by GitHub
parent 979956d000
commit 0e061bd309

View File

@@ -36,38 +36,36 @@ echo "Status: Installing ${appName} using script version ${scriptver}" >> ${logf
echo "Status: Downloading ZeroTier" >> ${logfile}
echo "Status: Downloading ZeroTier" >> ${deplog}
# Using 1.8.3 version to stop the continual prompts for credentials
curl -o /Library/Caches/com.purplecomputing.mdm/Apps/ZT.pkg https://download.zerotier.com/RELEASES/1.8.3/dist/ZeroTierOne.pkg
#curl -o /Library/Caches/com.purplecomputing.mdm/Apps/ZT.pkg https://download.zerotier.com/dist/ZeroTier%20One.pkg
curl -o /Library/Caches/com.purplecomputing.mdm/Apps/ZT.pkg https://download.zerotier.com/dist/ZeroTier%20One.pkg
echo "Status: Running the installer" >> ${logfile}
echo "Status: Running the installer" >> ${deplog}
installer -pkg /Library/Caches/com.purplecomputing.mdm/Apps/ZT.pkg -target /
sleep 5
# Kill off the ZeroTier.app and then ZeroTier auth copy processes
echo "Status: Killing Processes" >> ${logfile}
echo "Status: Killing Processes" >> ${deplog}
app-pid=$(ps aux | grep 'ZeroTier' | grep -v 'grep' | grep -v 'security' | awk '{print$2}')
auth-pid=$(ps aux | grep 'ZeroTier' | grep 'security' | grep -v 'grep' | awk '{print$2}');
kill -9 $app-pid
kill -9 $auth-pid
#This sleep is functional and is needed to allow the processes to close properly before reopening the application
sleep 5
# # Kill off the ZeroTier.app and then ZeroTier auth copy processes
# echo "Status: Killing Processes" >> ${logfile}
# echo "Status: Killing Processes" >> ${deplog}
# app-pid=$(ps aux | grep 'ZeroTier' | grep -v 'grep' | grep -v 'security' | awk '{print$2}')
# auth-pid=$(ps aux | grep 'ZeroTier' | grep 'security' | grep -v 'grep' | awk '{print$2}');
# kill -9 $app-pid
# kill -9 $auth-pid
# #This sleep is functional and is needed to allow the processes to close properly before reopening the application
# sleep 5
# Now start the ZeroTier.app again as user and we then only enter the admin credentials once
echo "Status: Re-opening ZeroTier" >> ${logfile}
echo "Status: Re-opening ZeroTier" >> ${deplog}
sudo -u $(stat -f "%Su" /dev/console) open /Applications/ZeroTier.app
sleep 5
# # Now start the ZeroTier.app again as user and we then only enter the admin credentials once
# echo "Status: Re-opening ZeroTier" >> ${logfile}
# echo "Status: Re-opening ZeroTier" >> ${deplog}
# sudo -u $(stat -f "%Su" /dev/console) open /Applications/ZeroTier.app
# sleep 5
echo "Status: Cleaning up after the installer" >> ${logfile}
echo "Status: Cleaning up after the installer" >> ${deplog}
rm -rf /Library/Caches/com.purplecomputing.mdm/Apps/ZT.pkg
sleep 2
echo "Status: Joining ZeroTier to network ${@}" >> ${logfile}
echo "Status: Joining ZeroTier to network ${@}" >> ${deplog}
/usr/local/bin/zerotier-cli join $@
# echo "Status: Joining ZeroTier to network ${@}" >> ${logfile}
# echo "Status: Joining ZeroTier to network ${@}" >> ${deplog}
# /usr/local/bin/zerotier-cli join $@
exit 0
exit 0