写个自动下载安装Ant的shell脚本【二】
2013-06-21 07:27
519 查看
#!/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
######################################################
# 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脚本【一】
- Linux使用Shell脚本实现ftp的自动上传下载
- [shell]为CentOS创建自动安装模块的脚本
- 自动下载shell脚本
- 一个检查并自动安装oralce所需rpm的shell脚本
- CentOS6.7下使用非root用户(普通用户)编译安装与配置mysql数据库并使用shell脚本定时任务方式实现mysql数据库服务随机自动启动
- 一个检查并自动安装oralce所需rpm的shell脚本
- Shell脚本实现Lamp自动安装
- mysql最新通用二进制分发版本5.7.16自动安装shell脚本
- shell脚本:LAMP一键自动安装 (linux,apache,mysql,php)
- Linux使用Shell脚本实现ftp的自动上传下载
- mysql最新通用二进制分发版本5.7.16自动安装shell脚本
- 可以自动安装mysql数据库的一个shell脚本
- shell 脚本自动安装jdk-6u34-linux-x64-rpm.bin 跳过回车自动安装
- Linux下使用Shell脚本实现ftp的自动上传下载的代码小结
- shell脚本下载安装mfs分布式文件系统,批量修改默认配置文件名
- Linux下使用Shell脚本实现ftp的自动上传下载的代码小结
- suse linux luckemftp安装及ftp shell自动上传脚本
- Linux使用Shell脚本实现ftp的自动上传下载
- shell脚本实现DNS的自动安装与配置