1 #! /bin/sh 2 # script to build curl RPM from src RPM (SSL and non-SSL versions) 3 4 # initialize 5 top_dir=/usr/src/redhat 6 sources_dir=$top_dir/SOURCES 7 specs_dir=$top_dir/SPECS 8 rpms_dir=$top_dir/RPMS 9 arch=`rpm --showrc | awk 'NF == 3 && $2 == "_arch" { print $3 }'` 10 11 # fill in your own name and email here 12 packager_name="Mr Joe Packager Person" 13 packager_email='<Joe (at] packager.person>' 14 15 # make sure we're running as root 16 if test `id -u` -ne `id -u root` 17 then 18 echo "you must build the RPM as root" 19 exit 1 20 fi 21 22 # get version and release number 23 if test $# -lt 1 24 then 25 echo "version number?" 26 read version 27 else 28 version=$1 29 fi 30 31 if test $# -lt 2 32 then 33 echo "release number?" 34 read release 35 else 36 release=$2 37 fi 38 39 # build all the files 40 targets="curl curl-ssl" 41 for target in $targets 42 do 43 # make sure src RPM exist 44 src_rpm="$target-$version-$release.src.rpm" 45 if test -f $src_rpm 46 then 47 rpm -ivh $src_rpm 48 49 # replace packager in spec file 50 sed -e 's/^Packager: .*/Packager: $packager_name $packager_email/' $specs_dir/$target.spec > $specs_dir/$target-$version-$arch.spec 51 52 # build it 53 if ! rpm -ba $specs_dir/$target-$version-$arch.spec 54 then 55 echo "error building $target for $arch -- check output above" 56 fi 57 58 echo "$target rpm is now in $rpms_dir/$arch" 59 else 60 echo $src_rpm does not exist 61 fi 62 done 63