aboutsummaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-07-28 12:48:01 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-07-28 14:08:01 -0300
commit59ed39ec460743e97bcce22e62d27ba0a569b82f (patch)
tree1a68d55af7282c201203f46a93e8592a138c519b /platform
parentMerge branch 'master' of ssh://github.com/netblue30/firejail (diff)
downloadfirejail-59ed39ec460743e97bcce22e62d27ba0a569b82f.tar.gz
firejail-59ed39ec460743e97bcce22e62d27ba0a569b82f.tar.zst
firejail-59ed39ec460743e97bcce22e62d27ba0a569b82f.zip
build: fix shellcheck issues in mkrpm.sh/compile.sh
Diffstat (limited to 'platform')
-rwxr-xr-xplatform/rpm/mkrpm.sh29
1 files changed, 15 insertions, 14 deletions
diff --git a/platform/rpm/mkrpm.sh b/platform/rpm/mkrpm.sh
index d32ccd360..de26ca8d1 100755
--- a/platform/rpm/mkrpm.sh
+++ b/platform/rpm/mkrpm.sh
@@ -8,18 +8,18 @@
8# Builds rpms in a temporary directory then places the result in the 8# Builds rpms in a temporary directory then places the result in the
9# current working directory. 9# current working directory.
10 10
11name=$1 11name="$1"
12# Strip any trailing prefix from the version like -rc1 etc 12# Strip any trailing prefix from the version like -rc1 etc
13version=$(echo "$2" | sed 's/\-.*//g') 13version="$(printf '%s\n' "$2" | sed 's/\-.*//g')"
14config_opt=$3 14config_opt="$3"
15 15
16if [[ ! -f platform/rpm/${name}.spec ]]; then 16if [[ ! -f "platform/rpm/${name}.spec" ]]; then
17 echo error: spec file not found for name \"${name}\" 17 printf 'error: spec file not found for name %s\n' "${name}" >&2
18 exit 1 18 exit 1
19fi 19fi
20 20
21if [[ -z "${version}" ]]; then 21if [[ -z "${version}" ]]; then
22 echo error: version must be given 22 printf 'error: version must be given\n' >&2
23 exit 1 23 exit 1
24fi 24fi
25 25
@@ -28,26 +28,27 @@ if [[ -z "${config_opt}" ]]; then
28fi 28fi
29 29
30# Make a temporary directory and arrange to clean up on exit 30# Make a temporary directory and arrange to clean up on exit
31tmpdir=$(mktemp -d) 31tmpdir="$(mktemp -d)"
32mkdir -p ${tmpdir}/{BUILD,RPMS,SOURCES,SPECS,SRPMS} 32mkdir -p "${tmpdir}"/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
33function cleanup { 33function cleanup {
34 rm -rf ${tmpdir} 34 rm -rf "${tmpdir}"
35} 35}
36trap cleanup EXIT 36trap cleanup EXIT
37 37
38# Create the spec file 38# Create the spec file
39tmp_spec_file=${tmpdir}/SPECS/${name}.spec 39tmp_spec_file="${tmpdir}/SPECS/${name}.spec"
40sed -e "s/__NAME__/${name}/g" \ 40sed -e "s/__NAME__/${name}/g" \
41 -e "s/__VERSION__/${version}/g" \ 41 -e "s/__VERSION__/${version}/g" \
42 -e "s/__CONFIG_OPT__/${config_opt}/g" \ 42 -e "s/__CONFIG_OPT__/${config_opt}/g" \
43 platform/rpm/${name}.spec >${tmp_spec_file} 43 "platform/rpm/${name}.spec" >"${tmp_spec_file}"
44# FIXME: We could parse RELNOTES and create a %changelog section here 44# FIXME: We could parse RELNOTES and create a %changelog section here
45 45
46# Copy the source to build into a tarball 46# Copy the source to build into a tarball
47tar --exclude='./.git*' --transform "s/^./${name}-${version}/" -czf ${tmpdir}/SOURCES/${name}-${version}.tar.gz . 47tar --exclude='./.git*' --transform "s/^./${name}-${version}/" \
48 -czf "${tmpdir}/SOURCES/${name}-${version}.tar.gz" .
48 49
49# Build the files (rpm, debug rpm and source rpm) 50# Build the files (rpm, debug rpm and source rpm)
50rpmbuild --quiet --define "_topdir ${tmpdir}" -ba ${tmp_spec_file} 51rpmbuild --quiet --define "_topdir ${tmpdir}" -ba "${tmp_spec_file}"
51 52
52# Copy the results to cwd 53# Copy the results to cwd
53mv ${tmpdir}/SRPMS/*.rpm ${tmpdir}/RPMS/*/*rpm . 54mv "${tmpdir}/SRPMS"/*.rpm "${tmpdir}/RPMS"/*/*rpm .