Last active
August 29, 2015 14:14
-
-
Save calum-github/718edd185decc518d3d2 to your computer and use it in GitHub Desktop.
killing prefpanes and shit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Display useage info if run with no arguments: | |
| if [ -z $1 ]; then | |
| echo "Useage: ./test.sh com.apple.preferences.mouse /Library/Preferences/com.apple.systemprefreeences.plist" | |
| exit 1 | |
| fi | |
| # Test to see if our pane actually exists in plist | |
| echo "*** Testing for presence of prefpane $1" | |
| echo "***" | |
| grep "${1}" "${2}" >/dev/null | |
| if [[ ${?} -ne 0 ]]; | |
| then | |
| echo "*** I can't find ${1} in ${2} are you sure its disabled?" | |
| exit 1 | |
| fi | |
| echo "*** SUCCESS! Found $1" | |
| echo "*** " | |
| echo "*** I'll need to convert $2 to xml from binary first" | |
| plutil -convert xml1 ${2} | |
| echo "*** " | |
| echo "*** OK. Now attempting to removing preference pane ${1} from ${2}" | |
| sed -i '' '/'"${1}"'/d' "${2}" | |
| echo "***" | |
| echo "*** Done, refreshing cfprefsd..." | |
| killall cfprefsd | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment