linux制作bin安装包
# !/bin/bash
#~~~~~~~~~~~是否安装了JDK~~~~~~~~~
export JDK=${JAVA_HOME}
if(test -z "${JDK}")
then
echo "找不到JDK的环境变量,已退出安装!"
exit 1
fi
#~~~~~~~~~~~~~~~~~~~
echo "~~~~~~~~~请输入Tomcat的完整路经:"
read tomcat_path
echo " ~~~~~~~~~~~~~~~~~~~"
#~~~~~~~~~~~~~去掉最后一个斜扛"/"
len=${#tomcat_path}
#echo "名字: ${tomcat_path}"
#echo "长度:${len}"
if(test $len>0) then
end_char=${tomcat_path:(len-1):(len-1)}
if(test "$end_char" = "/")
then
tomcat_path=${tomcat_path:0:(len-1)}
fi
echo "路经: ${tomcat_path}"
fi
#~~~~~~~~~~~~end "/"~~~~~~~~~~~~~
if(test -e "${tomcat_path}/conf/web.xml")
then
#复制jar包到 /tomcat/common/lib下
echo $lib
sed -n -e '1,/^exit 0$/!p' $0 > "${tomcat_path}/firewallTomcat.tar.gz" 2>/dev/null
cd ${tomcat_path}
tar zxvf firewallTomcat.tar.gz
rm -rf firewallTomcat.tar.gz
#~~~~~~~~~解压Firewall文件到/tomcat目录下
./firewall.sh ${tomcat_path}
rm -rf firewall.sh
#~~~~~~~~~~解压jar包到 common/lib下~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./jar.sh ${tomcat_path}
rm -rf jar.sh
#~~~~~~~~~~解压到Tomcat/webaaps目录下~~~~~~~~~~~~~~~~~~~~~~~~~~~
./managerTomcat.sh ${tomcat_path}
rm -rf managerTomcat.sh
#~~~~~~~~~~解压so库到jre/lib/i386下
./so.sh
rm -rf so.sh
#~~~~~~~~~~~~set Env~~~~~~~~~~~~~~~~~~~~
./setEnv.sh ${tomcat_path}
rm -rf setEnv.sh
#~~~~~~~~~~~set Filter~~~~~~~~~~~~~~~~~
./setFilter.sh ${tomcat_path}
rm -rf setFilter.sh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rm -rf SetEnv.class
rm -rf ExeMainStart.class
cd ~
source .bash_profile
source /etc/profile
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo "~~~~~~~~~~~安装完成,需要重启计算机,现在重启吗?y(es)/n(o)"
read var
if(test -z $var)
then
var="n"
fi
if (test $var = "y" -o $var = "yes")
then
reboot -n
else
echo "~~~~~~~~~~~~~~稍后由您手动重启!"
fi
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
else
echo "安装失败,请确定Tomcat的路经是否正确!"
fi
exit 0