Code:軟體安裝程式模板
#!/bin/bash
# install lighttd
# author chunsheng1@staff.sina.com.cn
# last update 2011-09-21
YASM_NAME="yasm-1.0.1"
YASM_SUFFIX=".tar.gz"
JPEG_NAME="jpegsrc.v8c"
JPEG_SUFFIX=".tar.gz"
FFMPEG_NAME="ffmpeg-0.8.1"
FFMPEG_SUFFIX=".tar.gz"
PCRE_NAME="pcre-7.4"
PCRE_SUFFIX=".tar.gz"
LIGHTTPD_NAME="lighttpd-1.4.18_sina-5.0"
LIGHTTPD_SUFFIX=".tgz"
TRANSFER_RSYNC_MODULE=$1"::download/video/"
LIGHTTPD_INSTALL_DIR="/data1/lighttpd"
DOC_ROOT="$LIGHTTPD_INSTALL_DIR/htdocs/"
LOG_DIR="$LIGHTTPD_INSTALL_DIR/logs/"
CONF_DIR="$LIGHTTPD_INSTALL_DIR/etc"
BIN_DIR="$LIGHTTPD_INSTALL_DIR/bin"
SBIN_DIR="$LIGHTTPD_INSTALL_DIR/sbin"
msg(){
date +"%Y-%m-%d %H-%M-%S "$1""
}
exe(){
msg "$1"
perl -e "system("$1")";
}
installtgz(){
name=$1;
subfix=$2;
store=$3;
para=$4;
tgz=$1$2
exe "rsync -avz $store/$tgz ./"
exe "tar zxvf $tgz"
if test -d $name
then
cd $name
exe "./configure $para"
exe "make"
exe "make install"
exe "cd .."
fi
}
iflag=0
a=`pcre-config --version | sed -e "s/([0-9])..*/1/"`
if [ -z $a ]; then
echo "PCRE is not installed yet"
iflag=1
elif [ $a -lt 7 ]; then
echo "PCRE version is older than 7, replace it with $PCRE_NAME"
echo "rm" `which pcre-config`
rm `which pcre-config`
iflag=1
fi
if [ $iflag -eq 1 ]
then
installtgz $PCRE_NAME $PCRE_SUFFIX $TRANSFER_RSYNC_MODULE ""
fi
flag=1
echo "install lighty? y/n :"
read input
case $input in
y|Y|Yes|YES) flag=1
;;
n|N|No|NO) flag=0
;;
esac
if [ $flag -eq 1 ]
then
installtgz $YASM_NAME $YASM_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=/usr"
installtgz $JPEG_NAME $JPEG_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=/usr --enable-shared"
installtgz $FFMPEG_NAME $FFMPEG_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=/usr --enable-shared --enable-zlib"
ldconfig /usr/lib
for so in /usr/lib/libyasm.a /usr/lib/libjpeg.so /usr/lib/libavcodec.so
do
if test ! -f "$so"
then
echo "***** $so not exists! *****"
exit 1
fi
done
exe "/data1/lighttpd/bin/stop.sh"
installtgz $LIGHTTPD_NAME $LIGHTTPD_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=$LIGHTTPD_INSTALL_DIR"
echo "Press any key to continue"
read
exe "mkdir -p $CONF_DIR"
exe "mkdir -p $DOC_ROOT"
exe "mkdir -p $LOG_DIR"
exe "mkdir -p $CONF_DIR"
msg "set password for user sinavideo"
echo "sinavideo:rM7oW32iAOfyU" > $CONF_DIR/.lighttpd.htpasswd
echo "sinavideo" > $CONF_DIR/lighttpd.user
fi
exe "cp $TEST_GIF $BAD_REQUEST_PAGE $INDEX_FILE $APACHE_DOC_ROOT/jiankong.html $DOC_ROOT/"
exe "cp -f lighttpd.conf.sample $CONF_DIR/lighttpd.conf"
exe "echo ulimit -c unlimited > $BIN_DIR/start.sh"
exe "echo $SBIN_DIR/lighttpd -f $CONF_DIR/lighttpd.conf >> $BIN_DIR/start.sh"
exe "echo killall lighttpd > $BIN_DIR/stop.sh "
exe "chmod +x $BIN_DIR/start.sh $BIN_DIR/stop.sh"
exe "/data1/lighttpd/bin/start.sh"
exit 0;
[@more@]
# install lighttd
# author chunsheng1@staff.sina.com.cn
# last update 2011-09-21
YASM_NAME="yasm-1.0.1"
YASM_SUFFIX=".tar.gz"
JPEG_NAME="jpegsrc.v8c"
JPEG_SUFFIX=".tar.gz"
FFMPEG_NAME="ffmpeg-0.8.1"
FFMPEG_SUFFIX=".tar.gz"
PCRE_NAME="pcre-7.4"
PCRE_SUFFIX=".tar.gz"
LIGHTTPD_NAME="lighttpd-1.4.18_sina-5.0"
LIGHTTPD_SUFFIX=".tgz"
TRANSFER_RSYNC_MODULE=$1"::download/video/"
LIGHTTPD_INSTALL_DIR="/data1/lighttpd"
DOC_ROOT="$LIGHTTPD_INSTALL_DIR/htdocs/"
LOG_DIR="$LIGHTTPD_INSTALL_DIR/logs/"
CONF_DIR="$LIGHTTPD_INSTALL_DIR/etc"
BIN_DIR="$LIGHTTPD_INSTALL_DIR/bin"
SBIN_DIR="$LIGHTTPD_INSTALL_DIR/sbin"
msg(){
date +"%Y-%m-%d %H-%M-%S "$1""
}
exe(){
msg "$1"
perl -e "system("$1")";
}
installtgz(){
name=$1;
subfix=$2;
store=$3;
para=$4;
tgz=$1$2
exe "rsync -avz $store/$tgz ./"
exe "tar zxvf $tgz"
if test -d $name
then
cd $name
exe "./configure $para"
exe "make"
exe "make install"
exe "cd .."
fi
}
iflag=0
a=`pcre-config --version | sed -e "s/([0-9])..*/1/"`
if [ -z $a ]; then
echo "PCRE is not installed yet"
iflag=1
elif [ $a -lt 7 ]; then
echo "PCRE version is older than 7, replace it with $PCRE_NAME"
echo "rm" `which pcre-config`
rm `which pcre-config`
iflag=1
fi
if [ $iflag -eq 1 ]
then
installtgz $PCRE_NAME $PCRE_SUFFIX $TRANSFER_RSYNC_MODULE ""
fi
flag=1
echo "install lighty? y/n :"
read input
case $input in
y|Y|Yes|YES) flag=1
;;
n|N|No|NO) flag=0
;;
esac
if [ $flag -eq 1 ]
then
installtgz $YASM_NAME $YASM_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=/usr"
installtgz $JPEG_NAME $JPEG_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=/usr --enable-shared"
installtgz $FFMPEG_NAME $FFMPEG_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=/usr --enable-shared --enable-zlib"
ldconfig /usr/lib
for so in /usr/lib/libyasm.a /usr/lib/libjpeg.so /usr/lib/libavcodec.so
do
if test ! -f "$so"
then
echo "***** $so not exists! *****"
exit 1
fi
done
exe "/data1/lighttpd/bin/stop.sh"
installtgz $LIGHTTPD_NAME $LIGHTTPD_SUFFIX $TRANSFER_RSYNC_MODULE "--prefix=$LIGHTTPD_INSTALL_DIR"
echo "Press any key to continue"
read
exe "mkdir -p $CONF_DIR"
exe "mkdir -p $DOC_ROOT"
exe "mkdir -p $LOG_DIR"
exe "mkdir -p $CONF_DIR"
msg "set password for user sinavideo"
echo "sinavideo:rM7oW32iAOfyU" > $CONF_DIR/.lighttpd.htpasswd
echo "sinavideo" > $CONF_DIR/lighttpd.user
fi
exe "cp $TEST_GIF $BAD_REQUEST_PAGE $INDEX_FILE $APACHE_DOC_ROOT/jiankong.html $DOC_ROOT/"
exe "cp -f lighttpd.conf.sample $CONF_DIR/lighttpd.conf"
exe "echo ulimit -c unlimited > $BIN_DIR/start.sh"
exe "echo $SBIN_DIR/lighttpd -f $CONF_DIR/lighttpd.conf >> $BIN_DIR/start.sh"
exe "echo killall lighttpd > $BIN_DIR/stop.sh "
exe "chmod +x $BIN_DIR/start.sh $BIN_DIR/stop.sh"
exe "/data1/lighttpd/bin/start.sh"
exit 0;
[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23168012/viewspace-1055615/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 軟體安裝
- win10如何解除安裝軟體程式 win10解除安裝軟體程式的方法Win10
- docker安裝軟體Docker
- ubuntu 軟體安裝Ubuntu
- AIX 軟體安裝AI
- Ubuntu軟體安裝Ubuntu
- 各種程式打包軟體的安裝命令
- 【軟體工具】SecureCRT 軟體安裝與使用Securecrt
- websphere中介軟體安裝軟體需求requirementWebUIREM
- 【 Linux 軟體安裝 】- 1 JDK安裝LinuxJDK
- 軟體安裝程式第一篇(原理)
- 安裝sysstat軟體造成部分程式不能使用
- BootstrapBlazor 模板安裝bootBlazor
- 解除安裝 UniAccessAgent 軟體
- Brew安裝常用軟體
- Linux安裝軟體Linux
- 安裝軟體需注意
- 使用brew安裝軟體
- centos如何安裝軟體CentOS
- [mac]brew安裝軟體Mac
- 解除安裝HACMP軟體ACM
- Linux軟體安裝Linux
- 工作使用軟體安裝
- 【Linux】Linux軟體安裝管理1 rpm軟體包安裝Linux
- ubuntu 安裝及相關軟體安裝(2)Ubuntu
- ubuntu 安裝及相關軟體安裝(1)Ubuntu
- 如何正確安裝解除安裝mac軟體Mac
- 軟體安裝程式第二篇(載入程式原始碼)原始碼
- 【Linux】Linux軟體安裝管理3 編譯安裝原始碼軟體Linux編譯原始碼
- 2.2. 安裝Oracle軟體Oracle
- su軟體怎麼安裝
- Ubuntu常用軟體安裝命令Ubuntu
- LNMPPHP軟體安裝步驟LNMPPHP
- oracle管理(三)安裝軟體Oracle
- Linux下軟體安裝Linux
- 靜默安裝oracle軟體Oracle
- Yum從DVD安裝軟體
- 軟體安裝常用方法(轉)