在线升级FlashPlayer和GoogleChrome的bash脚本
2015-10-27 04:52
525 查看
基于OSX的系统更新的实时要求,它可能随时禁止诸如过期版本Flash Player的运行。在企业环境中,及时更新普通用户的Flash Player有时是一个头痛的问题。
这个脚本可以在线下载最新版Flash Player并安装。使用范围,可以利用企业内部的机制来处理,比如munki或Casper等的内部self service功能,或者ARD远程推送,或者Puppet等后台推送等等。
同时,此脚本好包括了更新Google Chrome的部分,以供参考。
更好的解决方式是,建立自己内部的更新缓存服务器,这样可以大大降低外网的流量就如同。
所有代码都发表在我的github空间上
这个脚本可以在线下载最新版Flash Player并安装。使用范围,可以利用企业内部的机制来处理,比如munki或Casper等的内部self service功能,或者ARD远程推送,或者Puppet等后台推送等等。
同时,此脚本好包括了更新Google Chrome的部分,以供参考。
更好的解决方式是,建立自己内部的更新缓存服务器,这样可以大大降低外网的流量就如同。
#!/bin/sh # # --------------------------------------------------------------------- # update to the most current Google Chrome browser and/or Flash Player # # DESCTIPTION: # If you org doesn't have a automatic updating policy setup, or you # would like to take the control of it, or whatever reason, try this. # It download the most current installation package from their offcial # home website, unpack it and install or copy it over. # For Google Chrome, it copies to /Application folder, so it's better # to quit any running Chrome instance. # For Flahs Player, user may have to close and relaunch Safari to # got it catch up the update. # # How to use? # please read the online readme, just fire it with -h option. # Examples: # $ update_chrom_Flashplay.sh -h # Get the online help/readme # $ update_chrom_Flashplay.sh -a # Update both of them # $ update_chrom_Flashplay.sh -i chrome # Update Google Chrome only # $ update_chrom_Flashplay.sh -i flash # Update Flahs Player only # # HISTORY: # 2015-10-10: Initial # 2015-10-23: comments update # # Note/Causion: # Run this script with root privilege. # The download link coud be changed anytime # # Version 1.1 # Tony Liu, 2015 # # --------------------------- # Help # --------------------------- usage="$(basename "$0") [-h|--help] [-a|--all] [-i [options]] where: -h|--help show this help text -a|--all install all -i|--install [options] chrome install Google Chrome web browser flash install Flash Player" # --------------------------- # Install Google Chrome.app # --------------------------- install_chrome() { fileURL="https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg" temp_dmg="/tmp/googlechrome.dmg" /usr/bin/curl --output "$temp_dmg" "$fileURL"; ls -la $temp_dmg TMPMOUNT=`/usr/bin/mktemp -d /tmp/googlechrome.XXXX`; hdiutil attach "$temp_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen; ls -la $TMPMOUNT #/usr/sbin/installer -pkg "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.pkg -o -iname \*\.mpkg \))" -target "/"; cp -Rf $TMPMOUNT/Google\ Chrome.app /Applications/ xattr -c -r /Applications/Google\ Chrome.app /usr/bin/hdiutil detach "$TMPMOUNT"; /bin/rm -rf "$TMPMOUNT"; /bin/rm -rf "$temp_dmg"; } # jamf policy -trigger CBE_Adobe_Flash_Player # --------------------------- # Install Adobe_Flash_Player # --------------------------- install_flashplayer() { osvers=$(sw_vers -productVersion | awk -F. '{print $2}') flash_major_version=`/usr/bin/curl --silent http://fpdownload2.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pl.xml | cut -d , -f 1 | awk -F\" '/update version/{print $NF}'` fileURL="http://fpdownload.macromedia.com/get/flashplayer/current/licensing/mac/install_flash_player_"$flash_major_version"_osx_pkg.dmg"; flash_dmg="/tmp/flash.dmg"; if [[ ${osvers} -lt 6 ]]; then echo "Adobe Flash Player is not available for Mac OS X 10.5.8 or below."; fi if [[ ${osvers} -ge 6 ]]; then /usr/bin/curl --output "$flash_dmg" "$fileURL"; TMPMOUNT=`/usr/bin/mktemp -d /tmp/flashplayer.XXXX`; hdiutil attach "$flash_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen; /usr/sbin/installer -pkg "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.pkg -o -iname \*\.mpkg \))" -target "/"; /usr/bin/hdiutil detach "$TMPMOUNT"; /bin/rm -rf "$TMPMOUNT"; /bin/rm -rf "$flash_dmg"; fi } for i in "$@" do case $i in -h|--help) EXTENSION="${i#*=}" echo "$usage" ;; -a|--all) install_flashplayer install_chrome exit 0 ;; -i|--install) options="${i#*=}" shift # past argument=value ;; *) if [ "$options" = "-i" ]; then options="${i#*=}" fi # unknown option ;; esac done echo "Options=$options" case $options in chrome) install_chrome ;; flash) install_flashplayer ;; esac echo "Done!" exit 0
所有代码都发表在我的github空间上
相关文章推荐
- 谷歌 Project Zero 团队宣布新政策,漏洞披露前将有完整的 90 天缓冲期
- Android使用Google Map浅谈
- 把Chrome OS安装在VMWare下及Chrome OS的关键特性和一些截图
- 专家解读:开源软件项目是否会被限制出口?
- 专家解读:开源软件项目是否会被限制出口?
- Google排名算法改变 不在以外部链为主
- Google Adsense 支票托收信息收集 (1-30-2007)
- Google Adsense常用技巧总结
- Google推广的十二点技巧
- google优化圣经做网站必备第1/3页
- Google AdSense英文高价关键词排行列表
- Google 统计图表(Flash)小插件
- 2月份停止Google Adsense下线推介 将在中国地区停止投放
- Chrome的hack写法以及CSS的支持程度图示
- 使用Google工具栏追踪 Blog 留言
- Chrome Visual Studio 2005下的编译过程
- Google官方支持的NodeJS访问API,提供后台登录授权
- 一波实用的Bash Shell整理
- jquery repeater 模仿 Google 展开页面预览子视图