-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-rpm
More file actions
executable file
·43 lines (37 loc) · 1.26 KB
/
build-rpm
File metadata and controls
executable file
·43 lines (37 loc) · 1.26 KB
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
!/bin/bash
##################################
# Runs speculate and rpmbuild to generate rpms
#
# Prereqs:
# - The file client/.env exists and has a key/value pair called REACT_APP_TAG
# - "speculate" has been installed and is available in the path (npm install -g speculate)
# - "rpmbuild" is installed
# - The directory "~/rpmbuild" is usable by this script.
##################################
NODE_PROJECT=mobboss
RELEASE=
if [ -e client/.env ]; then
if ! grep -q REACT_APP_TAG client/.env; then
echo "REACT_APP_TAG must be in client/.env" >&2
exit 2
fi
RELEASE=`grep REACT_APP_TAG client/.env | awk -F "=" '{print $2}' | tr -d '"' | awk -F "-" '{print $2}'`
if [ -z "$RELEASE" ]; then
echo "Cannot determine release value from REACT_APP_TAG" >&2
exit 3
fi
else
echo "client/.env must exist and contain REACT_APP_TAG" >&2
exit 4
fi
echo "Setup rpm dirs"
mkdir -p {SOURCES,SPECS} || exit $?
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} || exit $?
echo "Run speculate script"
speculate --release=${RELEASE} || exit $?
echo "Build rpm"
cp SPECS/${NODE_PROJECT}.spec ~/rpmbuild/SPECS/ || exit $?
cp SOURCES/${NODE_PROJECT}.tar.gz ~/rpmbuild/SOURCES/ || exit $?
pushd ~/rpmbuild/SPECS
rpmbuild -bb ${NODE_PROJECT}.spec || exit $?
popd