#!/bin/ksh # Location of new mounted boot disk(s) _NewBase=$1 # Shortcut to Updates directory under _NewBase _Updates=$_NewBase/RedHat/Updates # Shortcut name to RPMS for Updates comparison _RPMS=./RedHat/RPMS # location of saved files. Arg2 can be used to specify if default of ./OLD # is not wanted. This may be useful if you want to immediately generate a # new ISO of the changed files. _olddir=${2:-./OLD} # Directory to save old version of changed files mkdir -p $_olddir # We now will cmp(1) each file under the new release with what we have # for this baseline. Changed file will be saved under a new directory # created above ($_olddir). We skip directories, assuming nothing of # importance for an empty directory. We only care about files. for old in $( cd $_NewBase; find . ! -type d ) do local new=$_NewBase/$old if [[ $old == ./isolinux/*.msg || $old == ./isolinux/*.cfg ]]; then print "Skipping $old..." continue fi if [[ -f $old ]]; then cmp $old $new > /dev/null 2>&1 if (( $? )); then # files differ so save under $_olddir local adir=${old%/*} # cut off file leaving dir path print "Updating $old with $new" mkdir -p $_olddir/$adir mv $old $_olddir/$adir cp -p $new $adir fi fi done print "Skipped files should be verified against new file under $_NewBase!" # Now deal with thw new RPMS under $_NewBase/RedHat/Updates replacing older # files here with the newer version. We make an assumption here that all # RPMS have NUMBERIC versions. We really should use librpm and read the # internal RPM name for comparison, but that is for a later date. # _Updates, _RPMS RPMsv=$_olddir/RedHat/RPMS mkdir -p $RPMsv for new in $_Updates/*.rpm do if [[ "$new" == "$_Updates/*.rpm" ]]; then print "No RPM updates, continuing..." break fi local snm=${new%-*}; snm=${snm%-*}; snm=${snm##*/} for old in $_RPMS/${snm}* do if [[ $old == "$_RPMS/${snm}*" ]]; then break; fi local osnm=${old%-*}; osnm=${osnm%-*}; osnm=${osnm##*/} if [[ $osnm == $snm ]]; then old=${old##*/} new=${new##*/} if mv $_RPMS/$old $RPMsv && cp $_Updates/$new $_RPMS; then print Replacing $old with $new and archiving $old in $RPMsv else print -u2 Failed to replace $old wih $new fi break fi done done