LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 02-10-2006, 08:49 AM   #1
ia64processor
Member
 
Registered: Sep 2003
Location: Tokyo
Distribution: Red Hat
Posts: 41

Rep: Reputation: 15
RHEL 4 RPMs update manually


For those who have an account but do not register any server on the RHN, or you have a dozen of Penguin OSes with only 1 license. And for those who don't bother to use yum. This script might help you a bit hopefully. I download all the latest RPMs (into /var/ftp/pub/RHEL4/RedHat/rhn-packages) based on the General Advisories into an NFS mount point, from the NFS client, run this script (save it under /rhn-packages) and it will tell you what RPMs you need to update. It is not something fancy though... and I don't mind people think it is cramp...

#!/bin/sh

Result() {
echo "$i-${INST_VER[$x]}-${INST_REL[$x]} -- $a-${AVAL_VER[$y]}-${AVAL_REL[$y]}"
z=$((z+1))
}

# Collect all installed RPMs
CheckInstalledRPM() {
INST_RPM=(`rpm -qa | sort`)
x=$((0))
for i in ${INST_RPM[@]}; do
INST_REL[$x]=`echo $i | sed 's/^.*-//'`
INST_VER[$x]=`echo $i | sed "s/-${INST_REL[$x]}$//" | sed 's/^.*-//'`
INST_NAME[$x]=`echo $i | sed "s/-${INST_REL[$x]}$//" | sed "s/-${INST_VER[$x]}$//"`
x=$((x+1))
done
INST_RPM_IDX=$((x-1))
#----------------------------------------
# DEBUG
#echo $INST_RPM_IDX
#echo "${INST_NAME[0]}--${INST_VER[0]}--${INST_REL[0]}"
#echo "${INST_NAME[$INST_RPM_IDX]}--${INST_VER[$INST_RPM_IDX]}--${INST_REL[$INST_RPM_IDX]}"
#----------------------------------------
}

CheckAvailableRPM() {
# Collect all available updated RPMs
AVAL_RPM=(`ls *.rpm | sed 's/\.i.86.rpm//'`)
x=$((0))
for i in ${AVAL_RPM[@]}; do
AVAL_REL[$x]=`echo $i | sed 's/^.*-//'`
AVAL_VER[$x]=`echo $i | sed "s/-${AVAL_REL[$x]}$//" | sed 's/^.*-//'`
AVAL_NAME[$x]=`echo $i | sed "s/-${AVAL_REL[$x]}$//" | sed "s/-${AVAL_VER[$x]}$//"`
x=$((x+1))
done
AVAL_RPM_IDX=$((x-1))
#----------------------------------------
# DEBUG
#echo $AVAL_RPM_IDX
#echo "${AVAL_NAME[0]}--${AVAL_VER[0]}--${AVAL_REL[0]}"
#echo "${AVAL_NAME[$AVAL_RPM_IDX]}--${AVAL_VER[$AVAL_RPM_IDX]}--${AVAL_REL[$AVAL_RPM_IDX]}"
#----------------------------------------
}

CompareRPM() {
# Compare installed RPMs against available updated RPMs
x=$((0))
z=$((0))
for i in ${INST_NAME[@]}; do
y=$((0))
for a in ${AVAL_NAME[@]}; do
if [ $i = $a ]; then
if [ ${INST_VER[$x]} = ${AVAL_VER[$y]} ]; then
if [ ${INST_REL[$x]} != ${AVAL_REL[$y]} ]; then
Result
fi
else
Result
fi
fi
y=$((y+1))
done
x=$((x+1))
done
}

End() {
echo
if [ $z -eq 0 ]; then
echo "System is up to date."
else
echo "$z update RPMs are available."
fi
echo
}

CheckInstalledRPM
CheckAvailableRPM
CompareRPM
End
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SUSe 9.3 behind corporate firewall - how do I manually update Stephen Hicks Linux - Newbie 8 10-26-2005 03:25 PM
RPMs needed for RHEL ES 3.0 Laserjock Linux - Enterprise 1 05-27-2005 02:30 AM
How do I update the kernel manually? christian_delaf Red Hat 1 02-09-2005 05:00 PM
update redhat 8.0 rpm packets manually? maxut Red Hat 3 03-19-2004 03:12 AM
Removing rpms manually Zeebro Linux - Newbie 2 12-05-2003 08:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 06:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration