在线升级FlashPlayer和GoogleChrome的bash脚本
来源:互联网 发布:将神 鬼神吕布数据 编辑:程序博客网 时间:2024/05/21 05:38
基于OSX的系统更新的实时要求,它可能随时禁止诸如过期版本Flash Player的运行。在企业环境中,及时更新普通用户的Flash Player有时是一个头痛的问题。
这个脚本可以在线下载最新版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 "$@"docase $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 ;;esacdoneecho "Options=$options"case $options in chrome) install_chrome ;; flash) install_flashplayer ;;esacecho "Done!"exit 0
所有代码都发表在我的github空间上
0 0
- 在线升级FlashPlayer和GoogleChrome的bash脚本
- FlashBuilder的air sdk和FlashPlayer升级方法
- FlashBuilder的air sdk和FlashPlayer升级方法
- FlashBuilder的air sdk和FlashPlayer升级方法
- Bash的启动方式和启动脚本
- 升级你的操作系统的flashplayer到10
- bash脚本的坑!
- bash脚本的坑
- Apache的在线升级
- GoogleChrome与Firefox的那些事
- Python 和 bash shell脚本
- Bash脚本的空格和“期待一元表达式”错误
- Linux bash脚本的调用/注释和运行方式
- BASH命令和SHELL脚本总结(17)在BASH中计算两天的间隔天数
- BASH脚本差异生成升级热更新包
- 编写高效的bash脚本
- 写出健壮的 Bash 脚本
- 写出健壮的Bash脚本
- TCP/IP协议分析
- wireshark 抓包分析 TCPIP协议的握手
- Wireshark学习笔记——如何快速抓取HTTP数据包
- *LeetCode-Number of Digit One
- Note:except和except for的区别
- 在线升级FlashPlayer和GoogleChrome的bash脚本
- *LeetCode-House Robber II
- 2.5 Sum List
- Leetcode Container With Most Water
- 利用命令提示符转换硬盘模式
- MAC 配置 java 环境变量
- Android 实现调整屏幕亮度,以及自动适应
- c中文件的操作大全,可以了解向文件读取一个结构体
- 2.6 Palindrome