源码SVN1.9.5 Shell脚本一健安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了源码SVN1.9.5 Shell脚本一健安装相关的知识,希望对你有一定的参考价值。
SVM1.6.4和1.6.4以上的版本区别在于1.6.4以下的版本在Linux上更新的时候都会在程序子目录出现一个.svn,而1.6.4以上的版本则只会在根目录有.svn这个文件,而子目没有,下面是源码一健安装shell脚本
#!/bin/bash #定义变量 Blueh="\033[36m" Tails="\033[0m" Output="echo -e" dir=`dirname $0` > install.log . /etc/init.d/functions #安装编译依赖包 yum -y install gcc gcc-c++ wget #下载yum function yum_install { if [ $? -eq 1 ];then 检查网络 $Output --------------------$Blueh【 正在检查网络,请稍候 】$Tails-------------------- echo ping www.baidu.com -c 3 &> /dev/null echo "#yum安装" >> install.log [ $? -eq 0 ] && echo "网络正常" >> install.log || { action "你的网络不通,请修复你的网络,然后再进行安装,脚本退出" /bin/false echo "你的网络不通,请修复你的网络,然后再进行安装,脚本在此步退出" >> install.log exit 2 } rm -rf /etc/yum.repos.d/other mkdir /etc/yum.repos.d/other mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/other wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo [ $? -eq 0 ] && echo "yum源下载成功" >> install.log || { action "yum源下载失败,脚本退出" /bin/false echo "yum源下载失败,脚本在此步退出" >> install.log exit 2 } echo >> install.log yum clean all yum makecache fi } #安装apr依赖包 function apr_install { echo "#apr依赖包安装" >> install.log wget -c http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz sleep 3 [ $? -eq 0 ] && echo "apr包下载成功" >> install.log || { action "apr包下载失败,脚本退出" /bin/false echo "apr下载失败,脚本在此步退出" >> install.log exit 2 } tar xf apr-1.5.2.tar.gz [ $? -eq 0 ] && echo "apr包解压成功" >> install.log || { action "apr包解压失败,脚本退出" /bin/false echo "apr包解压失败,脚本在此步退出" >> install.log exit 2 } cd $dir/apr-1.5.2/ [ $? -eq 0 ] && cd ..;echo "apr安装目录进入成功" >> install.log || { cd .. action "apr目录进入失败,脚本退出" /bin/false echo "apr安装目录进入失败,脚本在此步退出" >> install.log exit 2 } cd $dir/apr-1.5.2/ ./configure --prefix=/usr/local/apr [ $? -eq 0 ] && cd ..;echo "apr包配置成功" >> install.log || { cd .. action "apr配置失败,脚本退出" /bin/false echo "apr包配置失败,脚本在此步退出" >> install.log exit 2 } cd $dir/apr-1.5.2/ make [ $? -eq 0 ] && cd ..;echo "apr包编译成功" >> install.log || { cd .. echo "apr编译失败,脚本退出" /bin/false echo "apr包编译失败,脚本在此步退出" >> install.log exit 2 } cd $dir/apr-1.5.2/ make install [ $? -eq 0 ] && cd ..;echo "apr包安装成功" >> install.log || { cd .. echo "apr安装失败,脚本退出" /bin/false echo "apr包安装失败,脚本在此步退出" >> install.log exit 2 } } #安装apr-util包 function apr_util_install { echo >> install.log echo ‘#apr-util包安装‘ >> install.log wget -c http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.4.tar.gz sleep 3 [ $? -eq 0 ] && echo "apr-util包下载成功" >> install.log || { action "apr-util包下载失败,脚本退出" /bin/false echo "apr-util包下载失败,脚本在此步退出" >> install.log exit 2 } tar xf apr-util-1.5.4.tar.gz [ $? -eq 0 ] && echo "apr-util包解压成功" >> install.log || { action "apr-util包解压失败,脚本退出" /bin/false echo "apr-util包解压失败,脚本在此步退出" >> install.log exit 2 } cd $dir/apr-util-1.5.4 [ $? -eq 0 ] && cd ..;echo "apr-util安装目录进入成功" >> install.log || { cd .. action "apr-util目录进入失败,脚本退出" /bin/false echo "apr-util安装目录进入失败,脚本在此步退出" >> install.log exit 2 } cd $dir/apr-util-1.5.4 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [ $? -eq 0 ] && cd ..;echo "apr-util包配置成功" >> install.log || { cd .. action "apr-util配置失败,脚本退出" /bin/false echo "apr-util包配置失败,脚本在此步退出" >> install.log exit 2 } cd $dir/apr-util-1.5.4 make [ $? -eq 0 ] && cd ..;echo "apr-util包编译成功" >> install.log || { cd .. action "apr-util编译失败,脚本退出" /bin/false echo "apr-util包编译失败" >> install.log exit 2 } cd $dir/apr-util-1.5.4 make install [ $? -eq 0 ] && cd ..;echo "apr-util包安装成功" >> install.log || { cd .. action "apr-util安装失败,脚本退出" /bin/false echo "apr-util包安装失败,脚本在此步退出" >> install.log exit 2 } } #安装sqlite依赖包 function sqlite_install { echo >> install.log echo "#sqlite依赖包安装" >> install.log wget -c wget http://www.sqlite.org/2016/sqlite-autoconf-3130000.tar.gz sleep 3 [ $? -eq 0 ] && echo "sqlite包下载成功" >> install.log || { action "sqlite包下载失败,脚本退出" /bin/false echo "sqlite包下载失败,脚本在此退出" >> install.log exit 2 } tar xf sqlite-autoconf-3130000.tar.gz [ $? -eq 0 ] && echo "sqlite包解压成功" >> install.log || { action "sqlite包解压失败,脚本退出" /bin/false echo "sqlite包解压失败,脚本在此退出" >> install.log exit 2 } cd $dir/sqlite-autoconf-3130000 [ $? -eq 0 ] && cd ..;echo "sqlite安装目录进入成功" >> install.log || { cd .. action "sqlite目录进入失败,脚本退出" /bin/false echo "sqlite安装目录进入失败,脚本在此步退出" >> install.log exit 2 } cd $dir/sqlite-autoconf-3130000 ./configure --prefix=/usr/local/sqlite [ $? -eq 0 ] && cd ..;echo "sqlite包配置成功" >> install.log || { cd .. action "sqlite包配置成功,脚本退出" /bin/false echo "sqlite包配置失败,脚本在此步退出" >> install.log exit 2 } cd $dir/sqlite-autoconf-3130000 make [ $? -eq 0 ] && cd ..;echo "sqlite包编译成功" >> install.log || { cd .. action "sqlite包编译失败,脚本退出" /bin/false echo "sqlite包编译失败,脚本在此步退出" >> install.log exit 2 } cd $dir/sqlite-autoconf-3130000 make install [ $? -eq 0 ] && cd ..;echo "sqlite包安装成功" >> install.log || { cd .. action "sqlite包安装失败,脚本退出" /bin/false echo "sqlite包安装失改,脚本在此步退出" >> install.log exit 2 } } #安装zlib依赖包 function zlib_install { echo >> install.log echo "#zlib依赖包安装" >> install.log wget -c http://zlib.net/zlib-1.2.8.tar.gz sleep 3 [ $? -eq 0 ] && echo "zlib包下载成功" >> install.log || { action "zlib包下载失败,脚本退出" /bin/false echo "zlib包下载失败,脚本在此步退出" >> install.log exit 2 } tar xf zlib-1.2.8.tar.gz [ $? -eq 0 ] && echo "zlib包解压成功" >> install.log || { action "zlib包下载失败,脚本退出" /bin/false echo "zlib包解压失败,脚本在此步退出" >> install.log exit 2 } cd $dir/zlib-1.2.8 [ $? -eq 0 ] && cd ..;echo "zlib包安装目录进入成功" >> install.log || { cd .. action "zlib安装目录进入失败,脚本退出" /bin/false echo "zlib包安装目录进入失败,脚本在此步退出" >> install.log exit 2 } cd $dir/zlib-1.2.8 ./configure --prefix=/usr/local/zlib [ $? -eq 0 ] && cd ..;echo "zlib包配置成功" >> install.log || { cd .. action "zlib包配置失败,脚本退出" /bin/false echo "zlib包配置失败,脚本在此步退出" >> install.log exit 2 } cd $dir/zlib-1.2.8 make [ $? -eq 0 ] && cd ..;echo "zlib包编译成功" >> install.log || { cd .. action "zlib包编译失败,脚本退出" /bin/false echo "zlib包编译失败,脚本在此步退出" >> install.log exit 2 } cd $dir/zlib-1.2.8 make install [ $? -eq 0 ] && cd ..;echo "zlib包安装成功" >> install.log || { cd .. action "zlib包安装失败,脚本退出" /bin/false echo "zlib包安装失败,脚本在此步退出" >> install.log exit 2 } } #安装svn function svn_install { echo >> install.log echo "#svn依赖包安装" >> install.log wget -c http://mirrors.hust.edu.cn/apache/subversion/subversion-1.9.5.tar.gz sleep 3 [ $? -eq 0 ] && echo "subversion包下载成功" >> install.log || { action "subversion包下载失败,脚本退出" /bin/false echo "svn包下载失败,脚本在此步退出" >> install.log exit 2 } tar xf subversion-1.9.5.tar.gz [ $? -eq 0 ] && echo "subversion包解压成功" >> install.log || { action "subversion包解压失败,脚本退出" /bin/false echo "svn包解压失败,脚本在此步退出" >> install.log exit 2 } cd $dir/subversion-1.9.5 [ $? -eq 0 ] && cd ..;echo "subversion包安装目录成功" >> install.log || { cd .. action "subversion包安装目录进入失败,脚本退出" /bin/false echo "svn包安装目录进入失败,脚本在此步退出" >> install.log exit 2 } cd $dir/subversion-1.9.5 ./configure --prefix=/usr/local/svn1.9.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-sqlite=/usr/local/sqlite --with-zlib=/usr/local/zlib [ $? -eq 0 ] && cd ..;echo "subversion包配置成功" >> install.log || { cd .. action "subversion包配置失败,脚本退出" /bin/false echo "svn包配置失败,脚本在此步退出" >> install.log exit 2 } cd $dir/subversion-1.9.5 make [ $? -eq 0 ] && cd ..;echo "subversion包编译成功" >> install.log || { cd .. action "sqlite包编译失败,脚本退出" /bin/false echo "svn包编译失败,脚本在此步退出" >> install.log exit 2 } cd $dir/subversion-1.9.5 make install [ $? -eq 0 ] && cd ..;echo "subversion包安装成功" >> install.log || { cd .. action "sqlite包安装失败,脚本退出" /bin/false echo "svn包安装失败,脚本在此步退出" >> install.log exit 2 } } #建立软链接 function ln_lian { echo >> install.log echo "#svn建立软链接" >> install.log ln -s /usr/local/svn1.9.4/bin/* /usr/bin/ [ $? -eq 0 ] && echo "svn建立软链接成功" >> install.log || { action "sqlite建立软链接失败,脚本退出" /bin/false echo "建立软链接失败,脚本在此步退出" >> install.log exit 2 } } #查看svn有没有安装成功 function svn_version { echo >> install.log echo "#svn测试是否成功安装" >> install.log svn --version [ $? -eq 0 ] && echo "svn安装成功" >> install.log || { action "svn安装失败,脚本退出" /bin/false echo "svn安装失败" >> install.log exit 2 } } yum_install apr_install apr_util_install sqlite_install zlib_install svn_install ln_lian svn_version
以上是关于源码SVN1.9.5 Shell脚本一健安装的主要内容,如果未能解决你的问题,请参考以下文章
安装apached源码包以及编写shell脚本使其启动更加方便,并且和启动系统服务相同
linux arm 运行 shell .sh 脚本文件报错:/bin/bash^M: bad interpreter: No such file or directory(dos2unix )(代码片