linux sslvpn client installing ... ...
chmod: cannot access `/opt/sangfor/.sangfor/ssl/installshell/*.sh': No such file or directory
chmod: cannot access `/opt/sangfor/.sangfor/ssl/shell/*.sh': No such file or directory
mv: cannot stat `/opt/sangfor/.sangfor/ssl/bin/svpnservice_new': No such file or directory
chown: cannot access `/opt/sangfor/.sangfor/ssl/bin/svpnservice': No such file or directory
chmod: cannot access `/opt/sangfor/.sangfor/ssl/bin/svpnservice': No such file or directory
chmod: cannot access `/opt/sangfor/.sangfor/ssl/bin/svpnservice': No such file or directory
cp: cannot stat `/opt/sangfor/.sangfor/ssl/svpnsdk/svpnc': No such file or directory
cp: cannot stat `/opt/sangfor/.sangfor/ssl/svpnsdk/svpnd': No such file or directory
cp: cannot stat `/opt/sangfor/.sangfor/ssl/svpnsdk/libsvpn.so': No such file or directory
cp: cannot stat `/opt/sangfor/.sangfor/ssl/svpnsdk/libcurl.so.4.3.0': No such file or directory
cp: cannot stat `/opt/sangfor/.sangfor/ssl/svpnsdk/libcrypto.so.1.0.0': No such file or directory
cp: cannot stat `/opt/sangfor/.sangfor/ssl/svpnsdk/libssl.so.1.0.0': No such file or directory
#!/bin/bash
#脚本尾部附带安装压缩包
tarfile_line=145 # 程序开始的地方
#程序中已经固定是 /opt/sangfor, 不可以更改
HOME=/opt/sangfor
tarfile=$HOME/$$.tar.gz # 临时的安装程序的位置
SSLHOME=$HOME/.sangfor/ssl
SHELLPWD=$HOME/.sangfor/ssl/installshell # 脚本目录
# 定制的linux 命令行客户端目录
SVPNSDK_HOME=$HOME/.sangfor/ssl/svpnsdk
echo "linux sslvpn client installing ... ..."
# 必须是 root 用户才可以运行
if [ "$UID" -ne "0" ]
then
echo "please install it by root"
echo "linux sslvpn client install fail"
exit 1
fi
# 检查 linux 客户端是否在运行
ps aux | grep "/opt/sangfor/bin/svpnd" | grep -v grep >> /dev/null
if [ $? -eq 0 ]
then
echo "warnning: "
echo " linux sslvpn client is running, you should stop it first."
echo " you can run such commond to stop it: "
echo " svpnc -q"
echo ""
echo "linux sslvpn client install fail"
exit 1
fi
# 由于是root权限运行,所以各种提权函数均不需要
#主文件夹不存在则新建目录
if [ ! -d $HOME ]
then
mkdir -p $HOME
fi
if [ ! -d $SSLHOME ]
then
mkdir -p $SSLHOME
fi
#删除缓存文件
if [ -d $SSLHOME/java/felix-cache ]
then
rm -rf $SSLHOME/java/felix-cache
fi
#把安装包从脚本中分离
tail -n +$tarfile_line $0 > $tarfile
#把打包文件解压,同时删除临时打包文件
tar -zxvf $tarfile -C $SSLHOME
rm -rf $tarfile
#修改脚本执行权限
chmod +x $SHELLPWD/*.sh
chmod +x $SSLHOME/shell/*.sh
#不需要查找Java
# 将 promote.sh 脚本的功能迁移过来
mv $SSLHOME/bin/svpnservice_new $SSLHOME/bin/svpnservice
chown root:root $SSLHOME/bin/svpnservice
chmod a+x $SSLHOME/bin/svpnservice
chmod a+s $SSLHOME/bin/svpnservice
# 其实我不知道下面这几行的意义何在,有些系统是没有 inittab 文件的,暂时屏蔽掉
# dnsrecoverline="dnsbackup:23456:wait
HOME/.sangfor/ssl/bin/dnsrecover";
# grep -r -i -n $dnsrecoverline /etc/inittab
# if [ ! $? -eq 0 ]
# then
# echo $dnsrecoverline >> /etc/inittab
#fi
#修改锁权限位,保证所有人均可访问锁
JAVALOCK=/tmp/SangforSSLJava.lock
if [ -f $JAVALOCK ]
then
chmod 0777 $JAVALOCK
fi
SVPNSERVICELOCK=/tmp/SangforSSL.lock
if [ -f $SVPNSERVICELOCK ]
then
chmod 0777 $SVPNSERVICELOCK
fi
#删除所有脚本
rm -rf $SSLHOME/buildinstall.sh $SHELLPWD
# --------------------------------------------------------------
# 下面开始定制的linux 客户端命令行工具安装
# --------------------------------------------------------------
# 二进制程序运行过程中,需要用到的动态库文件所在目录
BASEHOME="/opt/sangfor"
某公司_LIB_BASEDIR="/opt/sangfor/lib"
某公司_BIN_BASEDIR="/opt/sangfor/bin"
某公司_LOG_BASEDIR="/opt/sangfor/log"
某公司_BUGREPORT_BASEDIR="/opt/sangfor/log/bugreport"
某公司_LOCK_BASEDIR="/opt/sangfor/lock"
mkdir -p ${BASEHOME}
mkdir -p ${某公司_LIB_BASEDIR}
mkdir -p ${某公司_BIN_BASEDIR}
mkdir -p ${某公司_LOG_BASEDIR}
mkdir -p ${某公司_BUGREPORT_BASEDIR}
mkdir -p ${某公司_LOCK_BASEDIR}
cp -af ${SVPNSDK_HOME}/svpnc ${某公司_BIN_BASEDIR}
cp -af ${SVPNSDK_HOME}/svpnd ${某公司_BIN_BASEDIR}
chown root:root ${某公司_BIN_BASEDIR}/svpnd
chmod a+x ${某公司_BIN_BASEDIR}/svpnd
chmod a+s ${某公司_BIN_BASEDIR}/svpnd
# 所有用户都可以使用 svpnc
chmod a+x ${某公司_BIN_BASEDIR}/svpnc
ln -s ${某公司_BIN_BASEDIR}/svpnc /usr/local/bin/svpnc
cp -af ${SVPNSDK_HOME}/libsvpn.so ${某公司_LIB_BASEDIR}
cp -af ${SVPNSDK_HOME}/libcurl.so.4.3.0 ${某公司_LIB_BASEDIR}
cp -af ${SVPNSDK_HOME}/libcrypto.so.1.0.0 ${某公司_LIB_BASEDIR}
cp -af ${SVPNSDK_HOME}/libssl.so.1.0.0 ${某公司_LIB_BASEDIR}
ln -s ${某公司_LIB_BASEDIR}/libcurl.so.4.3.0 ${某公司_LIB_BASEDIR}/libcurl.so.4
ln -s ${某公司_LIB_BASEDIR}/libcurl.so.4.3.0 ${某公司_LIB_BASEDIR}/libcurl.so
ln -s ${某公司_LIB_BASEDIR}/libcrypto.so.1.0.0 ${某公司_LIB_BASEDIR}/libcrypto.so
ln -s ${某公司_LIB_BASEDIR}/libssl.so.1.0.0 ${某公司_LIB_BASEDIR}/libssl.so
echo "linux sslvpn client install ok"
exit 0