I've been given the below plist which points to a bash script.
The script is supposed to delete the installer (El capitan.app) after it has been downloaded to prevent people from upgrading to it.
It is not working and I am not sure what needs changing/tweaking, if anything, to the script. It fails to delete the downloaded installer.
I have placed the script in the location /usr/local/bin, filename blockelcapitan.sh and can also confirm that the launch dameon (stored in /Library/LaunchDaemons) is loaded as confirmed by using the command:
sudo launchctl list | grep net.
which shows a result of:
- 78 net.ORG.blockelcapitan
I need help with the script, I have no idea if it is correct or what needs adding/removing/changing.
#!/bin/bash
Version=$(sw_vers | grep ProductVersion | tail -c 7 | cut -d . -f 2)
if [[ $Version -ge 11 ]]
then
sudo launchctl unload /Library/LaunchDaemons/net.ORG.blockelcapitan.plist
sudo rm -rf /Library/LaunchDaemons/net.ORG.blockelcapitan.plist
sudo rm -rf /var/ORG/ElCapitan/
sudo rm -rf /var/db/receipts/net.ORG.pkg.BlockElCapitanLaunchDaemon.bom
sudo rm -rf /var/db/receipts/net.ORG.pkg.BlockElCapitanLaunchDaemon.plist
exit 0
fi
rm -rf /Applications/Install\ OS\ X\ El\ Capitan.app/
osascript -e 'display dialog "OS X El Capitan is not allowed on ORG computers at this time." with title "ORG Technology Notice" buttons {"OK"} default button "OK" giving up after 30'
Post-flight for installer PKG (you’ll want to use something like Packages for Mac to build a deployable .pkg):
#!/bin/bash
launchctl load -w /Library/LaunchDaemons/net.ORG.blockelcapitan.plist
Version=$(sw_vers | grep ProductVersion | tail -c 7 | cut -d . -f 2)
if [[ $Version -ge 11 ]]
then
sudo launchctl unload /Library/LaunchDaemons/net.ORG.blockelcapitan.plist
sudo rm -rf /Library/LaunchDaemons/net.ORG.blockelcapitan.plist
sudo rm -rf /var/ORG/ElCapitan/
sudo rm -rf /var/db/receipts/net.ORG.pkg.BlockElCapitanLaunchDaemon.bom
sudo rm -rf /var/db/receipts/net.ORG.pkg.BlockElCapitanLaunchDaemon.plist
exit 0
fi
Here is the actual launchdaemon itself:
Label
net.ORG.blockelcapitan
ProgramArguments
/usr/local/bin/blockelcapitan.sh
KeepAlive
PathState
/Applications/Install OS X El Capitan.app/
OnDemand
Asked by sql1
(1 rep)
Sep 6, 2016, 12:03 PM
Last activity: Jul 10, 2025, 03:41 AM
Last activity: Jul 10, 2025, 03:41 AM