-
Notifications
You must be signed in to change notification settings - Fork 1
/
make-rpm.bash
executable file
·73 lines (59 loc) · 2.19 KB
/
make-rpm.bash
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# make-rpm.bash - create a RPM package file for linux-springboot-packager
#
# Copyright (C) hdsdi3g for hd3g.tv 2023
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or any
# later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Usage: make-rpm.bash
#
# You will need git, realpath, man, pandoc, rpmlint, rpmbuild, rpm
# Fonctionnal on Debian-like hosts.
set -eu
# PREPARE VARS AND PATHS
ROOT=$(realpath "$(dirname "$0")");
SOURCE_DIR="$ROOT/src";
VERSION=$(git describe --tags | sed 's/-/_/g');
export VERSION;
RELEASE=$(LANG="en_US.UTF-8" date '+%Y%m%d%H%M%S');
export RELEASE;
# CREATE RPM
BUILDROOT="$ROOT/rpmbuild/BUILDROOT";
if [ -d "$BUILDROOT" ]; then
rm -rf "$BUILDROOT";
fi
cp -r "$SOURCE_DIR" "$BUILDROOT";
RPMS="$ROOT/rpmbuild/RPMS";
if [ -d "$RPMS" ]; then
rm -rf "$RPMS";
fi
# PREPARE MAN
MAN_DIR="$BUILDROOT/usr/local/share/man/man1";
mkdir -p "$MAN_DIR"
pandoc -s -t man -o "$MAN_DIR/make-springboot-rpm.1" "$ROOT/man-make-springboot-rpm.md"
pandoc -s -t man -o "$MAN_DIR/make-springboot-deb.1" "$ROOT/man-make-springboot-deb.md"
pandoc -s -t man -o "$MAN_DIR/make-springboot-exe.1" "$ROOT/man-make-springboot-exe.md"
pandoc -s -t man -o "$MAN_DIR/search-winsw.bash.1" "$ROOT/search-winsw.bash.md"
pandoc -s -t man -o "$MAN_DIR/manage-internal-deb-repo.1" "$ROOT/man-manage-internal-deb-repo.md"
SPEC_FILE="rpmbuild/SPECS/rpm-centos.spec";
rpmlint "$SPEC_FILE"
rpmbuild --define "_libdir /usr/lib" -bb "$SPEC_FILE"
if [ -d "$BUILDROOT" ]; then
rm -rf "$BUILDROOT";
fi
# CHECK BUILDED RPM
RPMS_FILE=$(find "$RPMS" -type f -name "*.rpm");
rpm -qi "$RPMS_FILE";
echo "";
echo "Now, you can install this app with sudo rpm -U $RPMS_FILE";