#!/bin/sh files="/var/www/html/Fedora/local/SRPMS.x86_64/*.rpm" # obtain files from directory listing #files=`cat local_source_rpms` # obtain files from local_source_rpms file for file in ${files} do # install the source rpm rpm -i $file # use if files obtained from directory listing #rpm -i /var/www/html/Fedora/local/SRPMS.x86_64/$file #use if files obtained from a file # obtain the spec file name from source rpm file1=`basename $file .src.rpm` file2=${file1%-*} file3=${file2%-*} # find the release number from the spec file (should be a number) rel_old0=`grep Release /root/rpmbuild/SPECS/$file3.spec | cut -c 10-` # take out the extension i.e. fc40 rel_old=${rel_old0%.*} # increment the release number rel_new=$(bc -q< /root/rpmbuild/SPECS/$file3.spec.new mv -f /root/rpmbuild/SPECS/$file3.spec.new /root/rpmbuild/SPECS/$file3.spec # build the new rpm package and write the output to /var/tmp/spec_name.log echo building $file3 package with release $rel_new ...... rpmbuild -ba /root/rpmbuild/SPECS/$file3.spec > /var/tmp/$file3.log 2> /var/tmp/$file3.log # remove the debuginfo package rm -f /root/rpmbuild/RPMS/x86_64/*debug* rm -f /root/rpmbuild/RPMS/noarch/*debug* # install the package # rpm -Uvh /root/rpmbuild/RPMS/x86_64/$file3* done