神剑山庄资源网 Design By www.hcban.com
我很迷恋 Shell,很喜欢看着字符在黑色的 Console 界面中跳跃着,奇怪的是,我居然没有因此成为一个 Linux/Unix 程序员,而只是个写 CGI 程序的倒霉蛋。大家都是怎么称呼 “PHP 程序员”的?对了——草根~ 嗯,在土里埋的太久,说不定哪天就烂掉了咯!
可能是被 Windows 惯坏了,实在不想换个 OS,还好有 Cygwin,MinGW … 之类的东西, 适当的时候,可以拿出来装下 B,自我安慰一下~
我总喜欢从 windows.php.net 下载最新的 snapshot,不是我想体验最新的功能,只是强迫症的关系-,-。我机器上的所有软件,程序都是最新的,绝大部分都还挂着 beta 标签,甚至有一些是直接从 SVN,Git 上面拖下来的 trunk 版本,想想真是变态。如果你每天都爬上这些网站,人肉检查一下是不是有新的版本发布,以此满足一下自己变态的心理,那真是要疯掉了。
能让机器干的事情,就不要手工去做,是吧!下面这段代码会自动去 check 最新的 snapshot,解压到你想要的目录。 然后呢?建个 cron job 挂上去,就可以去找新的乐子了~
代码中下载的是,None thead safe VC9 版本,注意替换成自己能用的版本。需要强制更新的话,加上 “–force” 参数。
最后一行使用 icacls 重置了 php5-nts 目录下文件的权限(注意路径的写法,icacls 是 windows 自己的程序),因为 cygwin 会把 NTFS 的权限搞的巨恶心。
PS: 非 CGI/FCGI 安装模式,记得关掉 Web Server。
#!/bin/bash INSTALL_PATH="/cygdrive/d/php5-nts" BUILD_TIME_FILE="/cygdrive/d/php5-nts/build-time" PACKAGE_URL="http://windows.php.net/downloads/snaps/php-5.3-nts-win32-VC9-x86-latest.zip" function uprint { if [ "${1:0:1}" = "-" ]; then echo $1 "# $2" else echo "# $1" fi } ## If unzip available"Could not find unzip, please install." exit 1 fi ## Test if build-time file exists, if not, create it if [ ! -f $BUILD_TIME_FILE ]; then uprint -n "Build time file does not exists, created ... " touch $BUILD_TIME_FILE echo -e "\e[32m[OK]\e[0m" fi ## Get current build time CURRENT_BUILD_TIME=`cat $BUILD_TIME_FILE` ## Get latest build time LATEST_BUILD_TIME=`curl --silent http://windows.php.net/snapshots/ | grep "php-5.3-nts-VC9-x86" | grep "VC9 x86 Non Thread Safe (" | grep -o "(.*)" | sed 's/[()]//g'` ## Any update"$CURRENT_BUILD_TIME" != "$LATEST_BUILD_TIME" ]; then uprint -e "New version available, build time: \e[36m$LATEST_BUILD_TIME\e[0m" else if [ "$1" != "--force" ]; then uprint "You are using the latest snapshot version." exit 0 else uprint -e "\e[31mForce to update local php version.\e[0m" fi fi ## Delete if file already exists ls $package > /dev/null 2>&1 if test $"Performing: rm -f \`ls $package\` ... " rm -f `ls $package` echo -e "\e[32m[OK]\e[0m" fi ## Get latest php5 binary package uprint -n "Downloading latest php binary package ... " wget -q $PACKAGE_URL echo -e "\e[32m[OK]\e[0m" ## Extracting if [ -f $package ]; then # kill php processes for php_pid in `ps -as | grep php | awk '{print $1}'` do kill -9 $php_pid done uprint -n "Extracting ... " unzip -o $package -x -d $INSTALL_PATH > /dev/null 2>&1 echo -e "\e[32m[OK]\e[0m" echo $LATEST_BUILD_TIME > $BUILD_TIME_FILE uprint -n "Cleaning up ... " rm -f $package echo -e "\e[32m[OK]\e[0m" fi ## Fixed cygwin permissions icacls D:/php5-nts /reset /T > /dev/null # vim: set expandtab tabstop=4 shiftwidth=4:
标签:
Shell脚本,更新PHP5
神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com
暂无Shell脚本中实现更新PHP5的评论...
更新日志
2024年10月04日
2024年10月04日
- 邓丽君.1983-漫步人生路(2024环球MQA-UHQCD限量版)【环球】【WAV+CUE】
- 陈容森.1996-情断【上华】【WAV+CUE】
- 裘海正.1994-爱我的人和我爱的人【上华】【WAV+CUE】
- 庾澄庆.1988-错过的爱【福茂】【WAV+CUE】
- 班得瑞原装进口《第十三张新世纪专辑:旭日之丘》1CD[APE/CUE分轨][329.6MB]
- 纯音入心系列纯音乐《古筝|佛蕴|境法禅心意法自然》1CD[MP3][350MB]
- 纪钧瀚《钢琴阅读时光 雨中书店聆听轻音乐》[320K/MP3][203.44MB]
- 群星.1981-名曲65(2014环球复黑王·百代篇)【EMI百代】【WAV+CUE】
- 陈淑桦.1990-娃娃的故事【柯达】【WAV+CUE】
- 戴梅君.2011-问签诗【美华】【WAV+CUE】
- 戴梅君.2011-问签诗【美华】【WAV+CUE】
- 李国祥.1995-九五变奏【嘉音】【WAV+CUE】
- 许景淳.1992-你来自何方【全美唱片】【WAV+CUE】
- 石欣卉.2007-剧欣卉集·完整电视剧主题精丫华纳】【WAV+CUE】
- 群星.2005-LOVE情歌集VOL.5.2CD【正东】【WAV+CUE】