#!/bin/csh -f #set echo # Mise à jour des paquetages d'une RedHat 9.0 (roussel@cril.univ-artois.fr) set RHVER=9 set ROOT=/cdroms set FTP=ftp.yourownsite.yourmirror/pub/linux/distributions/redhat/linux/updates/$RHVER/en/os/ set download # download new packages by ftp if set set NFSROOT=$ROOT/redhat$RHVER set RHROOT=$ROOT/redhat$RHVER-bycdrom/cdrom\? set DEFAULTROOT=$ROOT/redhat$RHVER-bycdrom/cdrom3/RedHat/RPMS # where to put new files set UPDATESROOT=$ROOT/updates$RHVER/$FTP set LOGFILE=$ROOT/updates$RHVER/logfile set NEWRPMFILE=$ROOT/updates$RHVER/newRPMs set genhdlist=$ROOT/updates$RHVER/genhdlist # genhdlist est dans le package anaconda-runtime set nonomatch if (! -x $genhdlist) then echo Extracting genhdlist set anaconda=`find $RHROOT -name anaconda-runtime\*` set tmp=`mktemp -d tmpXXXXXX` cd $tmp rpm2cpio $anaconda | cpio --extract -d mv usr/lib/anaconda-runtime/genhdlist $genhdlist cd .. rm -rf $tmp endif if ($?download) then if (-e download.result) rm download.result wget -m ftp://$FTP |& tee download.result grep 'RETR.*rpm' download.result if ($status != 0) then cat </tmp/compareversion.c #include #include #include const int MAX=20; int main(int argc, char *argv[]) { const char *delim=".-#"; char *v1[MAX],*v2[MAX]; int i; i=0; v1[i++]=strtok(argv[1],delim); while (i>$LOGFILE grep $newsrcname $NEWRPMFILE if ($status != 0) echo "$UPDATESROOT/SRPMS/$newsrcname" >>$NEWRPMFILE echo "$UPDATESROOT/$newfile" >>$NEWRPMFILE rm $oldfile cp $newfile $oldfile:h endif else echo " New package $newfile" echo "`date` New package $newfile" >>$LOGFILE grep $newsrcname $NEWRPMFILE if ($status != 0) echo "$UPDATESROOT/SRPMS/$newsrcname" >>$NEWRPMFILE echo "$UPDATESROOT/$newfile" >>$NEWRPMFILE cp $newfile $DEFAULTROOT endif touch $newfile.done end rm -f /tmp/compareversion /tmp/compareversion.c chmod ugo+r $RHROOT/RedHat/RPMS/* $genhdlist --withnumbers $RHROOT makenfs: echo "Creation d'une racine pour installation NFS" cat </tmp/mklink #!/bin/csh -f set rhroot=\$1 set nfsroot=\$2 set file=\$3 ln \$rhroot/\$file \$nfsroot/\$file # EOF rm -rf $NFSROOT/* foreach cd ($RHROOT) cd $cd foreach dir (`find . -type d -exec echo {} \;`) mkdir -p $NFSROOT/$dir end find . -type f -exec csh -f /tmp/mklink $cd $NFSROOT {} \; end rm -f /tmp/mklink if (0) then foreach cd ($RHROOT) if (-e $cd/images/boot.img) then mkisofs -r -T -b images/boot.img -c images/boot.cat -o $cd.iso $cd else mkisofs -r -T -o $cd.iso $cd endif end endif #