###########################################
#!/bin/bash # #total:rpm_intall ##cription:install rpm package # #author:jj ##version:1.0 ##############################################此脚本还有很多漏洞与不足希望大家指教(新手上路)
#如果rpm包名字里面不含有系统位数,则无法安装
pwd_pack=/zhoujj/rpm_autoinstall/rpm.pack
#你的rpm包所在的位置
sys_num=`getconf LONG_BIT`
#你的电脑的操作系统的位数
rpm_name=vlock-1.3-26.fc9.src.rpm
#你所要安装的rpm包名
app_name=`ls $pwd_pack |grep -w $rpm_name | awk -F - '{print $1}'`
#你所要安装的rpm包应用的名字
rpm_bit=`ls $pwd_pack |grep -w $rpm_name|awk -F _ '{print $2}'|awk -F . '{print $1}'`
#你的rpm的位数echo "========================================"rpm -qa | grep -w $app_name >> /dev/nullif [ "$?" -eq "0" ];thenecho "$app_name already intall!"echo "========================================"exitfiecho "========================================"echo "your computer system bit is $sys_num"if [ "$sys_num" -eq "$rpm_bit" ] ;then
echo "the this rpm packege is match your system bit"elseecho "the this rpm packege is not match your system bit,please check it!"exitfiecho "========================================"ls $pwd_pack |grep -w $rpm_name >> /dev/nullif [ "$?" -ne "0" ];thenecho "$pwd_pack is not exist,or the package name $rpm_name is error,please check!"exitficd $pwd_packrpm -ivh $rpm_name >>/dev/nullecho "========================================"rpm -qa | grep -w $app_name >> /dev/nullif [ "$?" -eq "0" ];thenecho "Congratulations!$app_name already install succeed!"elseecho "$app_name is not install succeed!"fiecho "========================================"