OSX脚本:禁止系统自动添加AppStore图标到用户Dock上
2011-06-21 13:29
459 查看
这个脚本会删除Dock程序默认的自动添加App Store.app图标到用户Dock上的行为。
具体的操作使用参见脚本说明。
Tony liu, June 2011
Calgary
具体的操作使用参见脚本说明。
#!/bin/bash # ------------------------------------------------------------------------ # Removing App Store icon from User's Dock: # # Script name: RmAppStoreIcon.sh # # Copy Right: # Copy Right 2011 Tony Liu, all right reserved. # # Description: # If you don't want end user to have App Store icon on their Dock, this is right for you. # Why bother this? because most enterprise environment policies don't like people purchasing # stuff online, ie App Store. # # The system wide Dock icon is stored in the plist file: # /System/Library/CoreServices/Dock.app/Contents/Resources/English.lproj/default.plist # # This script needs PlistBuddy command line tools installed on your OS, which is included in most # of Apple packages. it's easy to be found anyway. Or pack commands in a installation package. # # You can use the following command to remove it: # plistbuddy -c "delete :persistent-apps:0" /System/Library/CoreServices/Dock.app/Contents/Resources/English.lproj/default.plist # # For newly login users, Dock.app will put the App Store icon on user's Dock automatically. # For logged in users, the App Store icon is already sits on their Dock. # To remove for all users, a the best practise example likes this: # removeSysAppStoreIcon # removeAllUserAppStoreIcon # # Another approch: removing the "App Store.app" from /Applications folder totally. # # For some situation, you may want end users to use it at home, but not in enterprise environment. # do the restriction within MCX or Workgroup Manager. # # History: # Initial: Tony 2011-06-20 # # ------------------------------------------------------------------------ # How to use these commands: # call removeAllUserAppStoreIcon to remove for all users # call removeUserAppStoreIcon USERNAME, to remove USERNAME user's App Store icon. # call removeSysAppStoreIcon to remove from system wide. # ------------------------------------------------------------------------ function RemoveAppStore { defaultPlist="$1" #currentSet=`plistbuddy -c "print :persistent-apps" $defaultPlist` #currentSet=${currentSet/////":"} index=0 while [ true ] do curAppIcon=`plistbuddy -c "print :persistent-apps:$index" $defaultPlist` echo "$index" "$curAppIcon" if [ -n "$curAppIcon" ]; then isAppStore=`echo $curAppIcon | grep "App Store"` if [ -n "$isAppStore" ]; then sudo plistbuddy -c "delete :persistent-apps:$index" $defaultPlist echo "Deleted App Store @ $index" break else let index=index+1 fi else break fi done } function removeSysAppStoreIcon { RemoveAppStore "/System/Library/CoreServices/Dock.app/Contents/Resources/English.lproj/default.plist" } function removeUserAppStoreIcon { RemoveAppStore "/Users/$1/Library/Preferences/com.apple.Dock.plist" } function removeAllUserAppStoreIcon { for aUser in `ls -1 /Users` do removeUserAppStoreIcon "$aUser" done } RemoveAppStore "/Users/schooladmin/Desktop/default.plist" exit 0
Tony liu, June 2011
Calgary
相关文章推荐
- OSX脚本:禁止系统自动添加AppStore图标到用户Dock上
- CVS添加用户时不太方便,我写了个自动脚本,源码如下
- BAT脚本添加自动代理脚本并更改用户文档位置
- 添加打印机连接脚本 用户双击即可自动添加打印机。VBS
- 用Bash脚本将Linux普通用户添加为系统管理员
- centos7 创建普通用户,添加sudo权限,禁止root远程登录和公钥登录脚本
- 1.5.2 添加一个用户lidao指定uid为888 禁止用户登录系统 不创建家目录
- shell 脚本实战笔记(9)--linux自动批量添加用户
- 用pam解决用户输入三次错误密码后禁止登陆系统,2分钟后自动解禁用户
- Shell脚本进阶篇——编写自动判断自动创建添加用户和用户密码的脚本
- 自动创建系统用户脚本
- 自动添加VSFTP服务器虚拟用户脚本
- XEditText:带删除功能的EditText;可设置自动添加分隔符分割电话号码、银行卡号等;支持禁止Emoji表情符号输入;自定义右边显示图标作功能选项;仿iOS输入框风格
- 用shell脚本为ubuntu自动添加用户,并限定通过ssh连接该用户只能执行特定某个(或某几个)程序
- 让系统及时的通过域用户脚本自动的打补丁
- Unity3D 创建脚本自动添加模板注释
- PowerShell:因为在此系统上禁止运行脚本
- C#中ListView添加系统文件图标
- 机房收费系统之添加删除用户
- Excel单元格内容变化时,自动添加系统时间批注(亲自实践)