-
Notifications
You must be signed in to change notification settings - Fork 62
/
rpmbuild.sh
executable file
·37 lines (27 loc) · 1.1 KB
/
rpmbuild.sh
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
#!/bin/bash
#apply patches for linux builds
./patch_OS.sh
if [ "$#" -le 0 ]; then
echo "./rpmbuild.sh xx.xx.xx.xxxx purley | whitley"
exit 3
fi
BUILDNUM=$1
SOURCEDIR=$PWD
# remove all rpmbuild
rm -rf $SOURCEDIR/output/rpmbuild
# Make directories
mkdir -p $SOURCEDIR/output/rpmbuild
mkdir -p $SOURCEDIR/output/rpmbuild/BUILDROOT
mkdir -p $SOURCEDIR/output/rpmbuild/SOURCES
mkdir -p $SOURCEDIR/output/rpmbuild/RPMS
mkdir -p $SOURCEDIR/output/rpmbuild/SRPMS
mkdir -p $SOURCEDIR/output/rpmbuild/SPECS
mkdir -p $SOURCEDIR/output/rpmbuild/ipmctl-$BUILDNUM
# Copy spec file
cp install/linux/rel-release/ipmctl.spec.in $SOURCEDIR/output/rpmbuild/SPECS/ipmctl.spec
# Update the spec file with build version
sed -i "s/^%define build_version .*/%define build_version $BUILDNUM/g" $SOURCEDIR/output/rpmbuild/SPECS/ipmctl.spec
# Archive the directory
tar --exclude-vcs --exclude="*output" --exclude="*.swp*" --transform="s,^.,ipmctl-$BUILDNUM," -zcf $SOURCEDIR/output/rpmbuild/SOURCES/ipmctl-$BUILDNUM.tar.gz .
# rpmbuild
rpmbuild -ba $SOURCEDIR/output/rpmbuild/SPECS/ipmctl.spec --define "_topdir $SOURCEDIR/output/rpmbuild"