-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·34 lines (26 loc) · 894 Bytes
/
install
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
#!/usr/bin/env bash
set -e
VERSION=${1:-2016.09.16}
echo "Generate and install RPM for autoconf-archive-$VERSION"
WORK_DIR=/tmp/autoconf-archive-rpmbuilder
mkdir -p $WORK_DIR
SPEC_FILE=$WORK_DIR/autoconf-archive.spec
echo "Generate spec file at $SPEC_FILE"
cat autoconf-archive.spec.template | sed s/__VERSION__/$VERSION/g > $SPEC_FILE
echo "Ensure all dependencies are available..."
yum install -y rpm-build rpmdevtools yum-utils make
echo "Build RPM from source..."
SRPM_FILE=/usr/src/redhat/SRPMS/autoconf-archive-$VERSION-1.src.rpm
pushd $WORK_DIR
spectool -g -R autoconf-archive.spec
rpmbuild -bs autoconf-archive.spec
yum-builddep $SRPM_FILE
rpmbuild --rebuild $SRPM_FILE
popd
RPM_FILE=/usr/src/redhat/RPMS/noarch/autoconf-archive-$VERSION-1.noarch.rpm
echo "Install RPM from $RPM_FILE"
rpm -i $RPM_FILE
echo "Clean up $WORK_DIR"
rm -rf $WORK_DIR
rm -f $SRPM_FILE
rm -f $RPM_FILE