aboutsummaryrefslogtreecommitdiff
path: root/packages/Linux/RPM/make_curl_rpm
blob: 544a23b67fc93bd342d38e380a0db7905e9ddb94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/sh
# script to build curl RPM from src RPM (SSL and non-SSL versions)

# initialize
top_dir=/usr/src/redhat
sources_dir=$top_dir/SOURCES
specs_dir=$top_dir/SPECS
rpms_dir=$top_dir/RPMS
arch=`rpm --showrc | awk 'NF == 3 && $2 == "_arch" { print $3 }'`

# fill in your own name and email here
packager_name="Mr Joe Packager Person"
packager_email='<Joe@packager.person>'

# make sure we're running as root
if test `id -u` -ne `id -u root`
then
   echo "you must build the RPM as root"
   exit 1
fi

# get version and release number
if test $# -lt 1
then
   echo "version number?"
   read version
else
   version=$1
fi

if test $# -lt 2
then
   echo "release number?"
   read release
else
   release=$2
fi

# build all the files
targets="curl curl-ssl"
for target in $targets
do
   # make sure src RPM exist
   src_rpm="$target-$version-$release.src.rpm"
   if test -f $src_rpm
   then
      rpm -ivh $src_rpm

      # replace packager in spec file
      sed -e 's/^Packager: .*/Packager: $packager_name $packager_email/' $specs_dir/$target.spec > $specs_dir/$target-$version-$arch.spec

      # build it
      if ! rpm -ba $specs_dir/$target-$version-$arch.spec
      then
         echo "error building $target for $arch -- check output above"
      fi

      echo "$target rpm is now in $rpms_dir/$arch"
   else
      echo $src_rpm does not exist
   fi
done