-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-rpm
executable file
·52 lines (37 loc) · 1.15 KB
/
create-rpm
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
48
49
50
51
52
#!/bin/bash
#
# Simplistic RPM creation logic. See q.spec.template for actual spec
#
# Version number should be provided as input in the command line
#
# requires:
# * installation of ronn
# * installation of rpmbuild
#
# Output rpm is generated inside build/rpm/RPMS/noarch/
#
if [ $# -ne 1 ];
then
echo 'create-rpm <version>'
exit 1
fi
command -v ronn &>/dev/null || { echo >&2 "ronn needs to be installed."; exit 1; }
command -v rpmbuild &>/dev/null || { echo >&2 "rpmbuild needs to be installed."; exit 1; }
base_folder=$(dirname $0)
pushd ${base_folder}
VERSION=$1
REAL_PACKAGE_NAME=q
RPM_PACKAGE_NAME=q
MAN_PAGE_SRC=${RPM_PACKAGE_NAME}.manpage.1.ronn
rm -rf build/
mkdir -p build/rpm
TAR_NAME=${RPM_PACKAGE_NAME}-${VERSION}.tar.gz
ronn ${REAL_PACKAGE_NAME}.manpage.1.ronn
rm ${REAL_PACKAGE_NAME}.1.html
cat ${RPM_PACKAGE_NAME}.spec.template | sed "s/VERSION_PLACEHOLDER/$1/" > ${RPM_PACKAGE_NAME}.spec
tar --create --transform s,^,${RPM_PACKAGE_NAME}-$1/, --exclude ${RPM_PACKAGE_NAME}.spec.template -f ${TAR_NAME} *
rpmbuild --define "_topdir `pwd`/build/rpm" -ta ${TAR_NAME}
rm ${RPM_PACKAGE_NAME}.spec
rm ${TAR_NAME}
rm ${REAL_PACKAGE_NAME}.1
popd