- 论坛徽章:
- 0
|
昨天在rhas4上安装oracle,发现很多rpm依赖的都没有装,一气之下,写了个脚本函数,把rhas4的安装盘都做成iso,让他自动给我找rpm装上依赖去.
- #linux instal CD dir
- CD_BASE="/opt/linux_inst"
- #linux install CD name
- INST_NAME="RHEL4-i386-AS-disc1-jrt.iso RHEL4-i386-AS-disc2-jrt.iso RHEL4-i386-AS-disc3-jrt.iso RHEL4-i386-AS-disc4-jrt.iso"
- #Mount point for Linux CD
- MNT="/mnt/cdrom_linux"
- #oracle RPMs, from oracle patch p4198954
- ORACLE_RPMS="/root/oracle_patch/p4198954_21_LINUX"
- install_package()
- {
- local p=$1
- local found=0
- for cd in $INST_NAME; do
- if [ $found -eq 0 ] && [ -f ${CD_BASE}/${cd} ]; then
- mount -o loop ${CD_BASE}/${cd} $MNT #&& echo "mount ${CD_BASE}/${cd}"
- if ls ${MNT}/RedHat/RPMS | grep $p > /dev/null 2>&1; then
- if ! rpm -ivh ${MNT}/RedHat/RPMS/$p.i386.rpm ; then
- for p_needed in $(rpm -ivh ${MNT}/RedHat/RPMS/$p.i386.rpm | grep .i386.rpm | grep -v "warning"); do
- echo "$p_needed needed"
- umount $MNT #&& echo "umount ${CD_BASE}/${cd}"
- install_package $(echo $p_needed|sed 's/.i386.rpm//g')
- mount -o loop ${CD_BASE}/${cd} $MNT #&& echo "mount ${CD_BASE}/${cd}"
- done
- echo "reinstall $p"
- if ! rpm -ivh ${MNT}/RedHat/RPMS/$p.i386.rpm; then
- echo "install package $p in ${CD_BASE}/${cd} failed"
- umount $MNT #&& echo "umount ${CD_BASE}/${cd}"
- return 1;
- fi
- else
- found=1
- fi
- fi
- umount $MNT #&& echo "umount ${CD_BASE}/${cd}"
- fi
- done
- if [ $found -eq 0 ] && [ -f ${ORACLE_RPMS}/${p}.i386.rpm ]; then
- rpm -ivh ${ORACLE_RPMS}/${p}.i386.rpm && found=1
- fi
- if [ $found -eq 0 ]; then
- echo $p " not installed"
- return 1
- fi
- return 0;
- }
复制代码
使用的时候要注意比如装gnome-libs-1.4.1.2.90-44.i386.rpm
直接 install_package gnome-libs-1.4.1.2.90-44 ,不要.i386.rpm |
|