增加了产品安装脚本

增加了用户手册(包括安装手册和动态库使用手册)


git-svn-id: http://172.17.0.253/svn/soft_pkgs/sys_nicmonitor@1390 09c3743a-b0dd-45d3-b506-aa74c7a2a6ef
This commit is contained in:
dlyao
2013-05-03 09:16:02 +00:00
parent 24af36baf9
commit 789f5d2b31
3 changed files with 80 additions and 0 deletions

80
docs/install.sh Executable file
View File

@@ -0,0 +1,80 @@
#!/bin/bash
if [ `id -u` -ne 0 ];then
echo "请使用root用户执行此脚本"
exit 0
fi
var="d5000"
existflag=1 #default exist directory /home/d5000/conf...
echo "检测用户及用户组...."
user=`grep "^$var:" /etc/passwd`
if [ "$user" = "" ];then
echo "程序安装失败,退出!"
echo "失败原因d5000用户不存在"
exit 0
fi
group=`grep "^$var:" /etc/group`
if [ "$group" = "" ];then
echo "程序安装失败,退出!"
echo "失败原因d5000用户组不存在"
exit 0
fi
echo "检测用户家目录...."
home=`grep "^$var" /etc/passwd | awk -F: '{print $6}'`
if [ "$home" = "" ];then
echo "找不到d5000用户的家目录安装程序退出"
exit 0
fi
conf=${home}"/conf"
bin=${home}"/bin"
lib=${home}"/lib"
nic=${home}"/conf/nic"
echo "检测配置文件目录...."
if [ ! -d $conf ];then
mkdir "$conf"
existflag=0
fi
if [ ! -d $bin ];then
mkdir "$bin"
existflag=0
fi
if [ ! -d $lib ];then
mkdir "$lib"
existflag=0
fi
if [ ! -d $nic ];then
mkdir "$nic"
existflag=0
fi
if [ "$existflag" = "0" ];then
echo "配置文件目录不存在,创建所需目录...."
chown -R d5000:d5000 "$home"
fi
echo "检测旧版本程序...."
upgrade=`pkginfo -i | grep sys_nicmonitor`
if [ -n "$upgrade" ];then
echo "存在旧版本程序,开始升级...."
`pkgadd -u sys_nicmonitor#1.7-x86_64-linx-Rocky4.2.pkg.tar.gz`
`pkgadd -u dotconf#1.0.13-1.pkg.tar.gz`
chmod u+s $bin"/sys_nicmonitor"
echo "程序升级成功!"
else
echo "未找到旧版本程序,开始安装...."
`pkgadd sys_nicmonitor#1.7-x86_64-linx-Rocky4.2.pkg.tar.gz`
`pkgadd dotconf#1.0.13-1.pkg.tar.gz`
chmod u+s $bin"/sys_nicmonitor"
echo "程序安装成功!"
fi
exit 0