カテゴリ

OpenSSL

#! /bin/sh

# Config
PACK=openssl-0.9.8b
DL_URL=http://www.openssl.org/source
OPENSSL_LIB=/usr/local/ssl/lib
LD_SO_CONF=/etc/ld.so.conf
# Log File Name
INSTALL_LOG=log_install_`date +"%Y%m%d_%H%M%S"`.txt
# Write Text Log
log_text() {
    echo "(`date +"%Y/%m/%d %T"`)$1 ----" | tee -a $INSTALL_LOG
}

# Install File Check
chk_install_file(){

    log_text "---Check install file ---"
    if [ -s $PACK.tar.gz ]
    then
        log_text "$PACK.tar.gz is exist."
    else
        wget $DL_URL/$PACK.tar.gz | tee -a $INSTALL_LOG
    fi

}

# Set ldconfig
set_ldconfig(){

    log_text "---ldconfig ---"
    if [ -z `grep $OPENSSL_LIB $LD_SO_CONF` ]
    then
        echo $OPENSSL_LIB >> $LD_SO_CONF | tee -a $INSTALL_LOG
        ldconfig                         | tee -a $INSTALL_LOG
        log_text "added string to $LD_SO_CONF-- '$OPENSSL_LIB' ."
    else
        log_text "$LD_SO_CONF already includes string-- '$OPENSSL_LIB' ."
    fi
}

# ---------------------------
#  Main
# ---------------------------

cat >> $INSTALL_LOG < < EOF
---------------------------------------------------------
  Install Start at `date +"%Y/%m/%d %T"`
---------------------------------------------------------
EOF

chk_install_file

log_text "---Unpack TarBall ---"
tar zxf $PACK.tar.gz        | tee -a $INSTALL_LOG

log_text "---Configure ---"
cd $PACK
INSTALL_LOG=../$INSTALL_LOG
./config -fPIC shared        | tee -a $INSTALL_LOG

log_text "---make ---"
make                         | tee -a $INSTALL_LOG

log_text "---make test ---"
make test                    | tee -a $INSTALL_LOG

log_text "---make install ---"
make install                 | tee -a $INSTALL_LOG

set_ldconfig

cat >> $INSTALL_LOG

コメント