diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2023-07-28 12:48:01 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2023-07-28 14:08:01 -0300 |
commit | 59ed39ec460743e97bcce22e62d27ba0a569b82f (patch) | |
tree | 1a68d55af7282c201203f46a93e8592a138c519b /platform | |
parent | Merge branch 'master' of ssh://github.com/netblue30/firejail (diff) | |
download | firejail-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-x | platform/rpm/mkrpm.sh | 29 |
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 | ||
11 | name=$1 | 11 | name="$1" |
12 | # Strip any trailing prefix from the version like -rc1 etc | 12 | # Strip any trailing prefix from the version like -rc1 etc |
13 | version=$(echo "$2" | sed 's/\-.*//g') | 13 | version="$(printf '%s\n' "$2" | sed 's/\-.*//g')" |
14 | config_opt=$3 | 14 | config_opt="$3" |
15 | 15 | ||
16 | if [[ ! -f platform/rpm/${name}.spec ]]; then | 16 | if [[ ! -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 |
19 | fi | 19 | fi |
20 | 20 | ||
21 | if [[ -z "${version}" ]]; then | 21 | if [[ -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 |
24 | fi | 24 | fi |
25 | 25 | ||
@@ -28,26 +28,27 @@ if [[ -z "${config_opt}" ]]; then | |||
28 | fi | 28 | fi |
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 |
31 | tmpdir=$(mktemp -d) | 31 | tmpdir="$(mktemp -d)" |
32 | mkdir -p ${tmpdir}/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | 32 | mkdir -p "${tmpdir}"/{BUILD,RPMS,SOURCES,SPECS,SRPMS} |
33 | function cleanup { | 33 | function cleanup { |
34 | rm -rf ${tmpdir} | 34 | rm -rf "${tmpdir}" |
35 | } | 35 | } |
36 | trap cleanup EXIT | 36 | trap cleanup EXIT |
37 | 37 | ||
38 | # Create the spec file | 38 | # Create the spec file |
39 | tmp_spec_file=${tmpdir}/SPECS/${name}.spec | 39 | tmp_spec_file="${tmpdir}/SPECS/${name}.spec" |
40 | sed -e "s/__NAME__/${name}/g" \ | 40 | sed -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 |
47 | tar --exclude='./.git*' --transform "s/^./${name}-${version}/" -czf ${tmpdir}/SOURCES/${name}-${version}.tar.gz . | 47 | tar --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) |
50 | rpmbuild --quiet --define "_topdir ${tmpdir}" -ba ${tmp_spec_file} | 51 | rpmbuild --quiet --define "_topdir ${tmpdir}" -ba "${tmp_spec_file}" |
51 | 52 | ||
52 | # Copy the results to cwd | 53 | # Copy the results to cwd |
53 | mv ${tmpdir}/SRPMS/*.rpm ${tmpdir}/RPMS/*/*rpm . | 54 | mv "${tmpdir}/SRPMS"/*.rpm "${tmpdir}/RPMS"/*/*rpm . |