Mac OS X: 彻底删除GeekTool(bash脚本)
最后更新于:2022-04-01 10:55:13
虽然GeekTool有很多功能对于个人用户很有吸引力,但是在我们的网络环境中却可能随机造成用户无法正常退出的问题,所以并不适用于网络用户。虽然GeekTool的安装包提供自己的程序删除,但是是app程序,管理员在网络环境中,虽然可以先复制到目标机,然后运行一个Apple Script脚本,最后删除它,但是有点麻烦,所以根据自己的经验,制作了下面是删除脚本,适合于通过ARD执行Unix命令而运行在网络内的所有机器,直接明了快捷。
#!/bin/bash##--------------------------------------------------------------------------------------# Remove Geektool#--------------------------------------------------------------------------------------sudo killall GeekToolif test -e /usr/libexec/PlistBuddy ; then ln -f /usr/libexec/PlistBuddy /usr/sbin/PlistBuddyelse echo "No PlistBuddy utility found!" exit 1fisudo rm -fr /Library/PreferencePanes/GeekTool.prefPanesudo rm -fr /Library/Preferences/org.tynsoe.geektool.plistsudo rm -fr ~/Library/Preferences/org.tynsoe.geektool.plistINDEX=0FOUNDIT=falsewhile [ $INDEX -lt 100 ] ; do GeekToolApp=`PlistBuddy 2>&1 -c "print :AutoLaunchedApplicationDictionary:$INDEX" /Library/Preferences/loginwindow.plist | grep "Does Not Exist"` if [ "$GeekToolApp" = "" ] then GeekToolApp=`PlistBuddy -c "print :AutoLaunchedApplicationDictionary:$INDEX" /Library/Preferences/loginwindow.plist | grep "GeekTool"` if [ "$GeekToolApp" = "" ] then echo "NOT found...$INDEX" else FOUNDIT=true echo "Found and deleted GeekTool.app entry '$INDEX'" $FOUNDIT PlistBuddy -c "delete :AutoLaunchedApplicationDictionary:$INDEX" /Library/Preferences/loginwindow.plist break fi else# echo "Reach the END of entry of loginwindow.plist" break fi let INDEX=INDEX+1doneexit 0
Tony Liu
Fall 2009 in Calgary