A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.
1 #!/bin/bash 2 ################################################### 3 # fou4s - Fast Online Update for SuSE 4 # SuSE Security Announcement to Patch Description Converter 5 # 6 # Copyright (C) 2002 Markus Gaugusch <fou4s@gaugusch.at> 7 # 8 # SVN info: 9 # $Author: markus $ 10 # $Date: 2005-02-09 17:18:35 +0100 (Wed, 09 Feb 2005) $ 11 # $Rev: 164 $ 12 # 13 # This program is free software; you can redistribute it and/or 14 # modify it under the terms of the GNU General Public License 15 # as published by the Free Software Foundation; either version 2 16 # of the License, or (at your option) any later version. 17 # 18 # This program is distributed in the hope that it will be useful, 19 # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 # GNU General Public License for more details. 22 # 23 # You should have received a copy of the GNU General Public License 24 # along with this program; if not, write to the Free Software 25 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 26 # 27 ################################################## 28 29 #include common functions from fou4s to get suse release, etc. 30 verbose=0 31 if [ "$1" = "-v" -o "$1" = "--verbose" ] ; then 32 verbose=1 33 fi 34 35 if [ -x ./fou4s ] ; then 36 . ./fou4s --commonfuncs 37 FOUPATH=. 38 elif [ -x `dirname $0`/fou4s ] ; then # same dir as announcement2pkgdesc 39 FOUPATH=`dirname $0` 40 . `dirname $0`/fou4s --commonfuncs 41 elif [ -x `type -p fou4s` ] ; then # fou4s in path 42 FOUPATH=/usr/lib/fou4s # from RPM installation 43 . fou4s --commonfuncs 44 else 45 echo "ERROR: Could not find fou4s!" 46 exit 2 47 fi 48 49 50 TMPFILE=`mktemp /var/cache/fou4s/packagelist/fou4s_announcementXXXXXX` 51 if [ $? -ne 0 ] ; then 52 echo "Error creating temp file - exiting!" 53 exit 2 54 fi 55 cat > $TMPFILE # write stdin into temp file 56 #check signature and get build time from it 57 hasGoodSignature "`cat $TMPFILE | gpg --verify 2>&1`" RSA 3D25D3D9 "SuSE Security Team <security@suse.de>" 1 58 if [ $? -eq -1 ] ; then 59 echo ERROR: Signature verification failed: 60 echo "$RETVAL" 61 echo "Exiting ..." 62 rm $TMPFILE 63 exit 1 64 fi 65 BUILDTIME=$RETVAL 66 67 ANNID=`cat $TMPFILE | grep Announcement-ID` 68 ANNID=${ANNID##*SuSE-SA} 69 ANNID=`echo $ANNID | sed 's/://g'` 70 PKGDESCPATH="$PKGDESCPATH/server0/$SERVERPATH/patches" 71 FILES=`cat $TMPFILE | grep $ARCH\/update\/$SUSEVERSION | grep -v src\.rpm` 72 COUNT=0 73 LASTNAME= 74 if [ $verbose -ge 1 ] ; then 75 echo Announcement-ID: $ANNID 76 echo Buildtime: $BUILDTIME 77 echo ============================ 78 fi 79 for i in $FILES ; do 80 getVersionFromFilename $i 81 if [ $verbose -ge 1 ] ; then 82 echo File: $i 83 echo RPM: $RPM 84 echo Release: $RELEASE 85 echo Version: $VERSION 86 echo PkgName: $PKGNAME 87 echo Series: $SERIES 88 fi 89 if [ "$LASTNAME" = "$PKGNAME" ] ; then 90 echo "Warning: Duplicate patch detected: $PKGNAME" 91 if [[ "$i" == "*.patch.rpm" ]] ; then 92 echo "Not using previous, because new is patch.rpm" 93 COUNT=$((COUNT-1)) # overwrite old, because new is patch.rpm 94 else 95 echo "Skipping, because previous is a patch.rpm!" 96 continue # skip this one 97 fi 98 echo ============================ 99 fi 100 cat $FOUPATH/pkgdesc_template | sed "s#PKGSHORTNAME#$PKGNAME#g" | sed "s#VERSION_RELEASE#$VERSION-$RELEASE#g" | sed "s#SERIES#$SERIES#g" | sed "s#PKGFULLNAME#$i#g" | sed "s#RPMSHORTNAME#$PKGNAME#g" | sed "s#BUILDTIME#$BUILDTIME#g" | sed "s#ANNID#$ANNID#g" > $PKGDESCPATH/suse-announcement${ANNID}-${COUNT}-1 101 if [ $verbose -ge 1 ] ; then 102 echo Created $PKGDESCPATH/suse-announcement${ANNID}-${COUNT}-1 .... 103 echo ============================ 104 fi 105 LASTNAME=$PKGNAME # name of last RPM 106 COUNT=$((COUNT+1)) 107 done 108 rm $TMPFILE