RedHat RHN Updates bequem via wget herunterladen

Um aktuelle Patches vom RHN herunterzuladen, kann man sich Linux-Bordmitteln bedienen. Achtung: Die eingesetzte wget-Version muss cookies unterstützen (wget-1.10).

RHN Anmeldung

cookie holen und login

export WGET="/usr/bin/wget -q --cookies=on --keep-session-cookies --save-cookies=cookies.txt --load-cookies=cookies.txt --no-check-certificate"
# cookie holen
$WGET -O/dev/null 'https://rhn.redhat.com'
# Login
WGET -O/dev/null --post-data="username=$RHNUSERNAME&password=$RHNPASSWORD&login_cb=login" "https://rhn.redhat.com/rhn/LoginSubmit.do"

RHN Paketliste nach Channel ID

x86 ia32 AMD64 / EM64T z ppc
Red Hat Enterprise Linux ES (v. 4)2866 2890 2879
Red Hat Enterprise Linux ES (v. 3)1187 1203 1218
Red Hat Enterprise Linux ES (v. 2.1)675
Red Hat Enterprise Linux (v. 5) Beta6002 6012 6007 6019 6017

paketliste holen, ID=channelID und bereinigen

$WGET -Opkglist.html "https://rhn.redhat.com/network/software/channels/packages.pxt?cid=$ID&lower=1&upper=3000"
grep "/network/software/packages/details.pxt" pkglist.html \
  | sed -e 's/\(<a href=\"[^>]*\">\)\(.*\)<\/a>/\2:\1<\/a>/' \
  > pkglist-stripped.txt

Prüfen, ob lokale Pakete aktualisiert werden müssen

update needed ?

for pkg in $(cat pkglist-stripped.txt)
do
  RPMPKG=$(echo $pkg| cut -f1 -d:)
  RPMCNT=$(find ../rpm-$ID -name $RPMPKG\*.rpm |wc -l)
  [[ "$RPMCNT" == "0" ]] && echo $pkg >> update-rpm.txt
done

Paket-Details laden

detail.pxt

$WGET -iupdate-rpm.txt -F -B https://rhn.redhat.com

alle download links in eine Datei

grep "Download Package" details.pxt* > rpms-to-fetch.html

download packages

$WGET -irpms-to-fetch.html --directory-prefix=$BASEDIR/rpm-$ID/ -F -N
 
wissen/linux/redhat-get-rhn-updates-for-channel-via-wget-post-data-cookies-rhel4-rhel3-rhas21-rhel5.txt · Zuletzt geändert: 06.09.2010 02:31
 
Recent changes RSS feed Donate Valid XHTML 1.0 Valid CSS Recent cached RSS feed cacert-signed web site: inhalt.serviert.de