-
Notifications
You must be signed in to change notification settings - Fork 3
/
package-rpm-cci
executable file
·47 lines (38 loc) · 1.08 KB
/
package-rpm-cci
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
#!/bin/bash
# environment variables to set:
# RELEASE (bionic, buster, etc.)
# optionally:
# set NOUNPACK to a non-empty value to prevent the dist and redhat tarballs
# from being untar'd
set -e
DIST_DIR=${DIST_DIR:-build}
RESULT_DIR="rpms"
CUR_DIR="$(pwd)"
if [ -z "$NOUNPACK" ]; then
rm -rf $DIST_DIR
mkdir $DIST_DIR
tar xaf hitch*.tar.gz -C $DIST_DIR --strip 1
tar xaf redhat.tar.gz -C $DIST_DIR --strip 1
fi
SRCVER=$($DIST_DIR/configure --version | awk 'NR == 1 {print $NF}')
if [ -z "$SRCVER" ]; then
echo "SRCVER is empty, it shouldn't"
exit 1
fi
tar zcf "$DIST_DIR.tgz" "$DIST_DIR"/
rpmbuild() {
command rpmbuild \
--define "_smp_mflags -j10" \
--define "_topdir $HOME/rpmbuild" \
--define "_sourcedir $CUR_DIR" \
--define "_srcrpmdir $CUR_DIR/${RESULT_DIR}" \
--define "_rpmdir $CUR_DIR/${RESULT_DIR}" \
--define "versiontag ${SRCVER}" \
--define "releasetag ${PKGVER:-1}" \
--define "srcname $DIST_DIR" \
--define "nocheck 1" \
"$@"
}
yum-builddep -y "$DIST_DIR"/hitch.spec
rpmbuild -bs "$DIST_DIR"/hitch.spec
rpmbuild --rebuild "$RESULT_DIR"/hitch*.src.rpm