写个自动下载安装Ant的shell脚本【二】
#!/bin/bash
######################################################
# file name: install_ant.sh
#
# function:
# To quickly install ant automatically
# in linux system...
#
# author: jeffzhao
# date: 2013.6.19
#
#
#
######################################################
ant_package_path="./"
ant_install_path="/opt/test/ant"
ant_package_name="apache-ant-1.9.1-bin.tar.gz"
ant_download_url="http://www.apache.org/dist/ant/binaries"/${ant_package_name}
antMD5_download_url="http://www.apache.org/dist/ant/binaries"/${ant_package_name}.md5
######################################################
# download from wen ftp
#
######################################################
function download_ant()
{
wget ${ant_download_url} >/dev/null
wget ${antMD5_download_url} >/dev/null
}
######################################################
# check package and package path
#
######################################################
function check_env()
{
# To Make Sure Ant Pakcage Path is Ok
if [ ! -d ${ant_package_path} ]
then
mkdir -p ${ant_package_path}
fi
# To Make Sure Ant Pakcage is OK
ls ${ant_package_path}| grep .tar.gz$ | grep ant >/dev/null
if [ $? == 1 ]
then
download_ant
check_md5
if [ $? != 0 ]
then
check_env
fi
else
ant_package_name= ls ${ant_package_path}| grep .tar.gz$
fi
}
######################################################
# check package md5
#
######################################################
function check_md5()
{
grep `md5sum ${ant_package_name} | cut -c 1-32` ${ant_package_name}.md5 >/dev/null
return $?
}
######################################################
# unzip package and copy files to install path
#
######################################################
function install_ant()
{
if [ ! -d ${ant_install_path} ]
then
mkdir -p ${ant_install_path}
fi
### clear env
rm -rf ${ant_install_path}/*
###
tar -xzvf ${ant_package_name}
mv `ls -l | grep ^d | grep ant | awk '{print$8}'` ${ant_install_path}
}
######################################################
# main
#
######################################################
function main()
{
## check root right
if [ `whoami` != 'root' ]
then
exit
fi
echo "Preinstall Checking start"
check_env
install_ant
}
main
写个自动下载安装Ant的shell脚本【二】的更多相关文章
- 写个自动下载安装Ant的shell脚本【一】
#!/bin/bash ###################################################### # file name: install_ant.sh # # f ...
- ActiveX控件打包成Cab置于网页中自动下载安装(转载)
原文出自http://www.iteye.com/topic/110834 [背景] 做过ActiveX控件的朋友都知道,要想把自己做的ActiveX控件功能放在自己的网页上使用,那么用户在客户端就必 ...
- ActiveX控件打包成Cab置于网页中自动下载安装 [转]
http://blog.sina.com.cn/s/blog_520c32270100nopj.html 做过ActiveX控件的朋友都知道,要想把自己做的ActiveX控件功能放在自己的网页上使用, ...
- ActiveX控件打包成Cab置于网页中自动下载安装
[背景] http://www.360doc.com/content/13/1120/20/10159093_330853247.shtml 做过ActiveX控件的朋友都知道,要想把自己做的Acti ...
- RHEL自动安装zookeeper的shell脚本
RHEL自动安装zookeeper的shell脚本 A:本脚本运行的机器,Linux RHEL6 B,C,D,...:待安装zookeeper cluster的机器, Linux RHEL6 首先在脚 ...
- Linux自动安装JDK的shell脚本
Linux自动安装JDK的shell脚本 A:本脚本运行的机器,Linux B:待安装JDK的机器, Linux 首先在脚本运行的机器A上确定可以ssh无密码登录到待安装jdk的机器B上,然后就可以在 ...
- linux - 怎么自动填写有交互的shell脚本 - SegmentFault
linux - 怎么自动填写有交互的shell脚本 - SegmentFault TCL/Expect交互式自动化测试概要 - - ITeye技术网站 expect是一种基于TCL,能与交互式程序进行 ...
- ActiveX控件打包成Cab实现浏览器自动下载安装
前言 我们在浏览器中使用我们自己的一些OCX,或者是DLL这一类的文件,在X86的机器上需要我们手动将这些文件拷贝到Windows/System32 文件夹下面去,然后通过Dos命令regsvr32 ...
- [python] 1、python鼠标点击、移动事件应用——写一个自动下载百度音乐的程序
1.问题描述: 最近百度总爱做一些破坏用户信任度的事——文库金币变券.网盘限速,吓得我赶紧想办法把存在百度云音乐中的歌曲下载到本地. http://yinyueyun.baidu.com/ 可问题是云 ...
随机推荐
- 【转】SVN:Android Studio设置忽略文件
Android Studio创建的Android项目一般需要忽略 参考: http://blog.csdn.net/qq_22780533/article/details/51965007 1..id ...
- [Javascript] MetaProgramming: new.target
new.target is a new “magical” value available in all functions, thoughin normal functions it will al ...
- Java jdbc数据库连接池总结!(转)
1. 引言 近年来,随着Internet/Intranet建网技术的飞速发展和在世界范围内的迅速普及,计算机 应用程序已从传统的桌面应用转到Web应用.基于B/S(Browser/Server)架构的 ...
- qt 与mysql建立交互式连接
void QSqlDatabase::setConnectOptions(const QString & options = QString())Sets database-specific ...
- 微信45028错误,微信has no masssend quota hint错误
微信45028,微信has no masssend quota hint 微信测试账号群发出现45028,has no masssend quota hint错误 >>>>&g ...
- ASP.NET 资料下载
public void downloadfile(string s_fileName) { HttpContext.Current.Response.ContentType = "appli ...
- 在Abp框架中使用Mysql数据库的方法以及相关问题小记
最近发现了一款DDD的框架 看起来不错,据说挺流弊的 刚好最近要弄点小东西,拿来试试也不错 苦于穷逼买不起高配服务器,只好装mysql数据库了 下面说下如何在该框架下使用Mysql数据库 打开项目后, ...
- 读取Excel异常定义了过多字段的解决方法
/// <summary> /// 从Excel文件导入数据 /// </summary> /// <param name="ExcelStr"> ...
- Mvc-项目遇到问题解决办法
项目中验证 在@using (Html.BeginForm()) 后边都有 @Html.ValidationSummary(), @Html.ValidationSummary(true, " ...
- 一个实例明白AutoResetEvent和 ManulResetEvent的用法
先看一段代码: public class WaitHandlerExample { public static AutoResetEvent waitHandler; ...