-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathbuild-helpers.sh
36 lines (34 loc) · 1.15 KB
/
build-helpers.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
#!/bin/bash
# Helper functions for building RPM packages
function build_rpm_helper {
OS="$1"
PACKAGES="$2"
OS_VERSION=`echo "$OS" | awk '{print tolower($0)}' | awk -Frhel '{ print $2 }'`
echo "INFO: OS is $OS"
for PACKAGE_SPEC in $PACKAGES; do
PACKAGE_NAME=`echo $PACKAGE_SPEC | awk -F. '{ print $1 }'`
echo "INFO: Running rpmbuild for $PACKAGE_NAME"
if [ "$OS_VERSION" -lt 8 ]; then
# Build and sign pacakages in older RHEL versions
rpmbuild --sign -ba "$PACKAGE_SPEC"
if [ $? -ne 0 ]; then
echo "ERROR: Could not run rpmbuild!"
exit $ret
fi
else
# Build packages
rpmbuild -ba "$PACKAGE_SPEC"
if [ $? -ne 0 ]; then
echo "ERROR: Could not run rpmbuild!"
exit $ret
fi
# Sign built package
echo "INFO: Signing package"
rpm --addsign /usr/src/redhat/RPMS/*/"$PACKAGE_NAME"*.rpm
if [ $? -ne 0 ]; then
echo "ERROR: Could not sign package!"
exit $ret
fi
fi
done
}