mirror of
https://github.com/PurpleComputing/mdmscripts.git
synced 2026-02-03 14:13:27 +00:00
Merge branch 'main' of https://github.com/PurpleComputing/mdmscripts
This commit is contained in:
34
Helpers/purple-helpers.sh
Executable file
34
Helpers/purple-helpers.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Remove Old Files
|
||||||
|
echo Making App Support Directories
|
||||||
|
mkdir -p /Library/Application\ Support/Purple/
|
||||||
|
echo Cleaning App Support Cache and Log Directories
|
||||||
|
rm -rf /Library/Application\ Support/Purple/*
|
||||||
|
|
||||||
|
# Pull latest files
|
||||||
|
echo Downloading Image Files
|
||||||
|
curl -o /Library/Application\ Support/Purple/logo.png https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/PurpleLogos/logo.png
|
||||||
|
curl -o /Library/Application\ Support/Purple/logo-dark.png https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/PurpleLogos/logo-dark.png
|
||||||
|
curl -o /Library/Application\ Support/Purple/purple-icon.png https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/PurpleLogos/purple-icon.png
|
||||||
|
echo Downloading Scripts
|
||||||
|
curl -o /Library/Application\ Support/Purple/launch-dep.sh https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/Helpers/launch-dep.sh
|
||||||
|
curl -o /Library/Application\ Support/Purple/launch-dep-en.sh https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/Helpers/launch-dep-en.sh
|
||||||
|
echo Making Cache and Log Directories
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/Scripts
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/Apps
|
||||||
|
mkdir -p /Library/Logs/com.purplecomputing.mdm/
|
||||||
|
mkdir -p /tmp/purple-logs/
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/Logs/
|
||||||
|
echo Linking Log Folders
|
||||||
|
ln -s /Library/Logs/com.purplecomputing.mdm/ /tmp/purple-logs/
|
||||||
|
ln -s /Library/Logs/com.purplecomputing.mdm/ /Library/Caches/com.purplecomputing.mdm/Logs/
|
||||||
|
|
||||||
|
touch /var/tmp/depnotify.log
|
||||||
|
|
||||||
|
# Give full permissions
|
||||||
|
chmod -R 777 /Library/Application\ Support/Purple/
|
||||||
|
chmod -R 777 /Library/Caches/com.purplecomputing.mdm/
|
||||||
|
chmod -R 777 /Library/Logs/com.purplecomputing.mdm/
|
||||||
|
chmod 777 /var/tmp/depnotify.log
|
||||||
77
MDM-Script-Pull.md
Normal file → Executable file
77
MDM-Script-Pull.md
Normal file → Executable file
@@ -2,23 +2,82 @@
|
|||||||
```
|
```
|
||||||
## PURPLE GITHUB PULL TEMPLATE ##
|
## PURPLE GITHUB PULL TEMPLATE ##
|
||||||
##-------------------------------##
|
##-------------------------------##
|
||||||
## SET PERMISSIONS ##
|
|
||||||
chmod 777 -R /tmp
|
|
||||||
##-------------------------------##
|
##-------------------------------##
|
||||||
## SET VARIABLES ##
|
## SET VARIABLES ##
|
||||||
|
|
||||||
SCRIPTNAME=[[fix-outlook-spotlight.sh]]
|
SCRIPTNAME=[[fix-outlook-spotlight.sh]]
|
||||||
REPO=[[troubleshooting]]
|
REPO=[[troubleshooting]]
|
||||||
BRANCH=[[main]]
|
BRANCH=[[main]]
|
||||||
|
APPNAME='APPNAME'
|
||||||
|
|
||||||
|
##-------------------------------##
|
||||||
|
## PREFLIGHT SCRIPT ##
|
||||||
|
##-------------------------------##
|
||||||
|
|
||||||
|
# CLEAN UP PREVIOUS FILES
|
||||||
|
rm -rf /Library/Caches/com.purplecomputing.mdm/Scripts/$SCRIPTNAME
|
||||||
|
rm -rf /Library/Caches/com.purplecomputing.mdm/Scripts/brandDEPinstall.sh
|
||||||
|
rm -rf /Library/Caches/com.purplecomputing.mdm/Scripts/.appinstallname
|
||||||
|
|
||||||
|
# REMOVE APPS AND FILES
|
||||||
|
killall $APPNAME
|
||||||
|
rm -rf /Applications/$APPNAME.app
|
||||||
|
|
||||||
|
# UPDATE PURPLE HELPERS
|
||||||
|
curl -o /Library/Caches/com.purplecomputing.mdm/Scripts/purple-helpers.sh https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/Helpers/purple-helpers.sh
|
||||||
|
chmod +x /Library/Caches/com.purplecomputing.mdm/Scripts/purple-helpers.sh
|
||||||
|
/Library/Caches/com.purplecomputing.mdm/Scripts/purple-helpers.sh >> /Library/Caches/com.purplecomputing.mdm/Logs/purple-helpers.log
|
||||||
|
sleep 2s
|
||||||
|
rm -rf purple-helpers.sh
|
||||||
|
|
||||||
|
##-------------------------------##
|
||||||
|
## DEPNOTIFY WINDOW ##
|
||||||
|
##-------------------------------##
|
||||||
|
|
||||||
|
# SET APP TITLE TO APPNAME
|
||||||
|
echo $APPNAME >> /Library/Caches/com.purplecomputing.mdm/Apps/.appinstallname
|
||||||
|
|
||||||
|
# SET DEP NOTIFY FOR REINSTALL
|
||||||
|
curl -o /Library/Caches/com.purplecomputing.mdm/Scripts/brandDEPinstall.sh https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/Helpers/brandDEPinstall.sh
|
||||||
|
chmod +x /Library/Caches/com.purplecomputing.mdm/Scripts/brandDEPinstall.sh
|
||||||
|
/Library/Caches/com.purplecomputing.mdm/Scripts/brandDEPinstall.sh >> /Library/Caches/com.purplecomputing.mdm/Logs/brandDEPinstall.log
|
||||||
|
sleep 2s
|
||||||
|
chmod 777 /var/tmp/depnotify.log
|
||||||
|
rm -rf /Library/Caches/com.purplecomputing.mdm/Scripts/brandDEPinstall.sh
|
||||||
|
|
||||||
|
# START DEPNOTIFY
|
||||||
|
/Library/Application\ Support/Purple/launch-dep.sh
|
||||||
|
|
||||||
##-------------------------------##
|
##-------------------------------##
|
||||||
## START SCRIPT ##
|
## START SCRIPT ##
|
||||||
##-------------------------------##
|
##-------------------------------##
|
||||||
# CLEAN UP PREVIOUS FILE
|
|
||||||
rm -rf /tmp/$SCRIPTNAME
|
|
||||||
# DOWNLOAD LATEST FILE
|
# DOWNLOAD LATEST FILE
|
||||||
curl -o /tmp/$SCRIPTNAME https://raw.githubusercontent.com/PurpleComputing/$REPO/$BRANCH/$SCRIPTNAME
|
curl -o /Library/Caches/com.purplecomputing.mdm/Scripts/$SCRIPTNAME https://raw.githubusercontent.com/PurpleComputing/$REPO/$BRANCH/$SCRIPTNAME
|
||||||
# GIVE EXECUTE PERMISSIONS
|
# GIVE EXECUTE PERMISSIONS
|
||||||
sudo -u $(stat -f "%Su" /dev/console) /bin/sh <<'END'
|
chmod +x /Library/Caches/com.purplecomputing.mdm/Scripts/$SCRIPTNAME
|
||||||
chmod +x /tmp/$SCRIPTNAME
|
|
||||||
# RUN AS CURRENT USER
|
# RUN AS CURRENT USER
|
||||||
/tmp/$SCRIPTNAME >> /tmp/$SCRIPTNAME.log
|
sudo /Library/Caches/com.purplecomputing.mdm/Scripts/$SCRIPTNAME >> /Library/Caches/com.purplecomputing.mdm/Logs/$SCRIPTNAME.log
|
||||||
```
|
|
||||||
|
##-------------------------------##
|
||||||
|
## DEPNOTIFY CLOSE ##
|
||||||
|
##-------------------------------##
|
||||||
|
|
||||||
|
# CLOSE DEP NOTIFY WINDOW
|
||||||
|
echo Status: $APPNAME Install Complete >> /var/tmp/depnotify.log
|
||||||
|
sleep 10s
|
||||||
|
killall DEPNotify
|
||||||
|
|
||||||
|
##-------------------------------##
|
||||||
|
## POSTFLIGHT SCRIPT ##
|
||||||
|
##-------------------------------##
|
||||||
|
|
||||||
|
rm -rf /Library/Caches/com.purplecomputing.mdm/Scripts/$SCRIPTNAME
|
||||||
|
rm -rf /Library/Caches/com.purplecomputing.mdm/Apps/.appinstallname
|
||||||
|
|
||||||
|
|
||||||
|
# END SCRIPT WITH SUCCESS
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
20
google-chrome.sh
Normal file → Executable file
20
google-chrome.sh
Normal file → Executable file
@@ -20,6 +20,7 @@
|
|||||||
# - 1.2 Martyn Watts, 24.09.2021 Added Check to see if dockutil is installed to make the script more resilient
|
# - 1.2 Martyn Watts, 24.09.2021 Added Check to see if dockutil is installed to make the script more resilient
|
||||||
# - 1.3 Martyn Watts, 28.09.2021 Added Open Console Parameter to use with TeamViewer
|
# - 1.3 Martyn Watts, 28.09.2021 Added Open Console Parameter to use with TeamViewer
|
||||||
# - 1.4 Martyn Watts, 29.09.2021 Added scriptver variable and corrected log opening
|
# - 1.4 Martyn Watts, 29.09.2021 Added scriptver variable and corrected log opening
|
||||||
|
# - 1.5 Michael Tanner, 06.11.2021
|
||||||
#
|
#
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Script to download and install Google Chrome.
|
# Script to download and install Google Chrome.
|
||||||
@@ -33,7 +34,12 @@ appName='Google Chrome'
|
|||||||
forceQuit='Y'
|
forceQuit='Y'
|
||||||
logfile="/Library/Logs/GoogleChromeInstallScript.log"
|
logfile="/Library/Logs/GoogleChromeInstallScript.log"
|
||||||
deplog="/var/tmp/depnotify.log"
|
deplog="/var/tmp/depnotify.log"
|
||||||
scriptver='1.4'
|
scriptver='1.5'
|
||||||
|
|
||||||
|
#Making Purple Cache directories for in the event that the helper script hasn't been run
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/Logs/
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/Apps/
|
||||||
|
|
||||||
echo "Script Version: ${scriptver}" >> ${logfile}
|
echo "Script Version: ${scriptver}" >> ${logfile}
|
||||||
echo "Status: Installing ${appName}" >> ${deplog}
|
echo "Status: Installing ${appName}" >> ${deplog}
|
||||||
@@ -48,16 +54,16 @@ fi
|
|||||||
# To get just the latest version number from the version check URL
|
# To get just the latest version number from the version check URL
|
||||||
/bin/echo "`date`: Downloading latest version." >> ${logfile}
|
/bin/echo "`date`: Downloading latest version." >> ${logfile}
|
||||||
/bin/echo "Downloading latest version."
|
/bin/echo "Downloading latest version."
|
||||||
/usr/bin/curl -o "/tmp/${dnldfile}" ${url}
|
/usr/bin/curl -o "/Library/Caches/com.purplecomputing.mdm/Apps/${dnldfile}" ${url}
|
||||||
/bin/echo "`date`: Expanding package." >> ${logfile}
|
/bin/echo "`date`: Expanding package." >> ${logfile}
|
||||||
/bin/echo "Expanding package."
|
/bin/echo "Expanding package."
|
||||||
pkgutil --expand "/tmp/${dnldfile}" /tmp/pkg
|
pkgutil --expand "/Library/Caches/com.purplecomputing.mdm/Apps/${dnldfile}" /Library/Caches/com.purplecomputing.mdm/Apps/pkg
|
||||||
/bin/echo "`date`: Storing latest version data." >> ${logfile}
|
/bin/echo "`date`: Storing latest version data." >> ${logfile}
|
||||||
/bin/echo "Storing latest version data."
|
/bin/echo "Storing latest version data."
|
||||||
latestver=$(cat /tmp/pkg/Distribution | grep 'CFBundleShortVersionString' | cut -f2 -d '"')
|
latestver=$(cat /Library/Caches/com.purplecomputing.mdm/Apps/pkg/Distribution | grep 'CFBundleShortVersionString' | cut -f2 -d '"')
|
||||||
/bin/echo "`date`: Removing expanded package" >> ${logfile}
|
/bin/echo "`date`: Removing expanded package" >> ${logfile}
|
||||||
/bin/echo "Removing expanded package."
|
/bin/echo "Removing expanded package."
|
||||||
/bin/rm -rf /tmp/pkg
|
/bin/rm -rf /Library/Caches/com.purplecomputing.mdm/Apps/pkg
|
||||||
|
|
||||||
|
|
||||||
# Get the version number of the currently-installed App, if any.
|
# Get the version number of the currently-installed App, if any.
|
||||||
@@ -89,7 +95,7 @@ latestver=$(cat /tmp/pkg/Distribution | grep 'CFBundleShortVersionString' | cut
|
|||||||
if [[ "${forceQuit}" = "Y" ]]; then
|
if [[ "${forceQuit}" = "Y" ]]; then
|
||||||
killall ${appName}
|
killall ${appName}
|
||||||
fi
|
fi
|
||||||
cd /tmp
|
cd /Library/Caches/com.purplecomputing.mdm/Apps/
|
||||||
/usr/sbin/installer -pkg ${dnldfile} -target /
|
/usr/sbin/installer -pkg ${dnldfile} -target /
|
||||||
|
|
||||||
#double check to see if the new version got updated
|
#double check to see if the new version got updated
|
||||||
@@ -125,6 +131,6 @@ latestver=$(cat /tmp/pkg/Distribution | grep 'CFBundleShortVersionString' | cut
|
|||||||
/bin/sleep 5
|
/bin/sleep 5
|
||||||
/bin/echo "`date`: Deleting the downloaded file." >> ${logfile}
|
/bin/echo "`date`: Deleting the downloaded file." >> ${logfile}
|
||||||
/bin/echo "Deleting the downloaded file."
|
/bin/echo "Deleting the downloaded file."
|
||||||
/bin/rm /tmp/${dnldfile}
|
/bin/rm /Library/Caches/com.purplecomputing.mdm/Apps/${dnldfile}
|
||||||
echo "Command: DeterminateManualStep: 1" >> ${deplog}
|
echo "Command: DeterminateManualStep: 1" >> ${deplog}
|
||||||
|
|
||||||
|
|||||||
21
zerotier.sh
Normal file → Executable file
21
zerotier.sh
Normal file → Executable file
@@ -13,34 +13,41 @@
|
|||||||
#
|
#
|
||||||
# HISTORY
|
# HISTORY
|
||||||
#
|
#
|
||||||
# Version: 1.2
|
# Version: 1.3
|
||||||
#
|
#
|
||||||
# - 1.0 Martyn Watts, 25.06.2021 Initial Script Template Build
|
# - 1.0 Martyn Watts, 25.06.2021 Initial Script Template Build
|
||||||
# - 1.1 Michael Tanner, 28.09.2021 Implement ZeroTier Install Script
|
# - 1.1 Michael Tanner, 28.09.2021 Implement ZeroTier Install Script
|
||||||
# - 1.2 Martyn Watts, 29.09.2021 Added logging information
|
# - 1.2 Martyn Watts, 29.09.2021 Added logging information
|
||||||
|
# - 1.3 Michael Tanner, 06.11.2021 fixing /tmp folder usage for Monterey
|
||||||
#
|
#
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Script to install ZeroTier and to join the organisations ZT Network.
|
# Script to install ZeroTier and to join the organisations ZT Network.
|
||||||
#
|
#
|
||||||
scriptver='1.2'
|
scriptver='1.3'
|
||||||
logfile="/Library/Logs/ZeroTierInstallScript.log"
|
logfile="/Library/Logs/com.purplecomputing.mdm/ZeroTierInstallScript.log"
|
||||||
appName="ZeroTier"
|
appName="ZeroTier"
|
||||||
|
deplog="/var/tmp/depnotify.log"
|
||||||
|
|
||||||
|
#Making Purple Cache directories for in the event that the helper script hasn't been run
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/
|
||||||
|
mkdir -p /Library/Logs/com.purplecomputing.mdm/
|
||||||
|
mkdir -p /Library/Caches/com.purplecomputing.mdm/Apps/
|
||||||
|
|
||||||
echo "Status: Installing ${appName} using script version ${scriptver}" >> ${deplog}
|
echo "Status: Installing ${appName} using script version ${scriptver}" >> ${deplog}
|
||||||
echo "Status: Installing ${appName} using script version ${scriptver}" >> ${logfile}
|
echo "Status: Installing ${appName} using script version ${scriptver}" >> ${logfile}
|
||||||
|
|
||||||
echo "Status: Downloading ZeroTier" >> ${logfile}
|
echo "Status: Downloading ZeroTier" >> ${logfile}
|
||||||
echo "Status: Downloading ZeroTier" >> ${deplog}
|
echo "Status: Downloading ZeroTier" >> ${deplog}
|
||||||
curl -o /tmp/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" >> ${logfile}
|
||||||
echo "Status: Running the installer" >> ${deplog}
|
echo "Status: Running the installer" >> ${deplog}
|
||||||
installer -pkg /tmp/apps/ZT.pkg -target /
|
installer -pkg /Library/Caches/com.purplecomputing.mdm/Apps/ZT.pkg -target /
|
||||||
|
|
||||||
echo "Status: Cleaning up after the installer" >> ${logfile}
|
echo "Status: Cleaning up after the installer" >> ${logfile}
|
||||||
echo "Status: Cleaning up after the installer" >> ${deplog}
|
echo "Status: Cleaning up after the installer" >> ${deplog}
|
||||||
rm -rf /tmp/apps/ZT.pkg
|
rm -rf /Library/Caches/com.purplecomputing.mdm/Apps/ZT.pkg
|
||||||
sleep 2s
|
sleep 2
|
||||||
|
|
||||||
echo "Status: Joining ZeroTier to network ${@}" >> ${logfile}
|
echo "Status: Joining ZeroTier to network ${@}" >> ${logfile}
|
||||||
echo "Status: Joining ZeroTier to network ${@}" >> ${deplog}
|
echo "Status: Joining ZeroTier to network ${@}" >> ${deplog}
|
||||||
|
|||||||
Reference in New Issue
Block a user