forked from joncampbell123/dosbox-x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-rpm.sh.in
executable file
·36 lines (29 loc) · 935 Bytes
/
make-rpm.sh.in
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
#!/usr/bin/env bash
arch=$(uname -m)
if [ -z "${arch}" ]; then
echo "Sorry, cannot identify architecture"
exit 1
fi
if [ -f /etc/os-release ]; then
dist=$(grep "^ID=" /etc/os-release | cut -d \" -f 2)
else
dist=""
fi
if [ -z "${dist}" ]; then
echo "Sorry, cannot identify Linux distro"
exit 1
fi
if [ ! -x /usr/bin/rpmbuild ]; then
echo "Could not locate /usr/bin/rpmbuild"
echo "Please install rpm-build package to continue."
exit 1
fi
echo "Making RPM for ${dist}"
dir="release/linux-${dist}"
mkdir -p "${dir}" || exit 1
tar="../@PACKAGE_NAME@-@[email protected]"
tar -cvJf "${tar}" --exclude=\*.git --exclude=\*.tar.xz --exclude=\*.a --exclude=\*.la --exclude=\*.Po --exclude=\*.o -C .. dosbox-x || exit 1
cp -vf "${tar}" ~/rpmbuild/SOURCES/ || exit 1
rpmbuild -bb contrib/linux/dosbox-x.spec || exit 1
rm -v "${tar}" || exit 1
mv -v ~/rpmbuild/RPMS/"${arch}"/@PACKAGE_NAME@-*@PACKAGE_VERSION@*.rpm "${dir}/" || exit 1