aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-07-28 13:05:54 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-07-28 14:10:31 -0300
commit200f389ed0f56ba42160fe135e3701757a8df94c (patch)
tree644ebe2eccff1991e11ff1f6391df0f60e9978f1
parentbuild: fix shellcheck issues in mkrpm.sh/compile.sh (diff)
downloadfirejail-200f389ed0f56ba42160fe135e3701757a8df94c.tar.gz
firejail-200f389ed0f56ba42160fe135e3701757a8df94c.tar.zst
firejail-200f389ed0f56ba42160fe135e3701757a8df94c.zip
build: use config.sh in more scripts
This removes the need to manually pass variables such as `$(TARNAME)` and `$(VERSION)` to shell scripts in the root Makefile. Relates to #5140.
-rw-r--r--Makefile8
-rwxr-xr-xmkasc.sh2
-rwxr-xr-xplatform/rpm/mkrpm.sh11
-rwxr-xr-xtest/compile/compile.sh5
4 files changed, 15 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 03ae71026..3055e226a 100644
--- a/Makefile
+++ b/Makefile
@@ -347,12 +347,12 @@ deb: dist config.sh
347 ./mkdeb.sh 347 ./mkdeb.sh
348 348
349.PHONY: test-compile 349.PHONY: test-compile
350test-compile: dist config.mk 350test-compile: dist config.sh
351 cd test/compile; ./compile.sh $(TARNAME)-$(VERSION) 351 cd test/compile; ./compile.sh
352 352
353.PHONY: rpms 353.PHONY: rpms
354rpms: src/man config.mk 354rpms: src/man config.sh
355 ./platform/rpm/mkrpm.sh $(TARNAME) $(VERSION) 355 ./platform/rpm/mkrpm.sh
356 356
357.PHONY: extras 357.PHONY: extras
358extras: all 358extras: all
diff --git a/mkasc.sh b/mkasc.sh
index 62c1b1180..0314c20e5 100755
--- a/mkasc.sh
+++ b/mkasc.sh
@@ -3,7 +3,7 @@
3# Copyright (C) 2014-2023 Firejail Authors 3# Copyright (C) 2014-2023 Firejail Authors
4# License GPL v2 4# License GPL v2
5 5
6. "$(dirname "$0")/config.sh" 6. "$(dirname "$0")/config.sh" || exit 1
7 7
8printf 'Calculating SHA256 for all files in /transfer - %s version %s' "$TARNAME" "$VERSION" 8printf 'Calculating SHA256 for all files in /transfer - %s version %s' "$TARNAME" "$VERSION"
9 9
diff --git a/platform/rpm/mkrpm.sh b/platform/rpm/mkrpm.sh
index de26ca8d1..0572480c6 100755
--- a/platform/rpm/mkrpm.sh
+++ b/platform/rpm/mkrpm.sh
@@ -3,15 +3,18 @@
3# Copyright (C) 2014-2023 Firejail Authors 3# Copyright (C) 2014-2023 Firejail Authors
4# License GPL v2 4# License GPL v2
5# 5#
6# Usage: ./platform/rpm/mkrpm.sh firejail <version> "<config options>" 6# Usage: ./platform/rpm/mkrpm.sh <config options>
7# 7#
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" 11# shellcheck source=config.sh
12. "$(dirname "$0")/../../config.sh" || exit 1
13
14name="$TARNAME"
12# Strip any trailing prefix from the version like -rc1 etc 15# Strip any trailing prefix from the version like -rc1 etc
13version="$(printf '%s\n' "$2" | sed 's/\-.*//g')" 16version="$(printf '%s\n' "$VERSION" | sed 's/\-.*//g')"
14config_opt="$3" 17config_opt="$*"
15 18
16if [[ ! -f "platform/rpm/${name}.spec" ]]; then 19if [[ ! -f "platform/rpm/${name}.spec" ]]; then
17 printf 'error: spec file not found for name %s\n' "${name}" >&2 20 printf 'error: spec file not found for name %s\n' "${name}" >&2
diff --git a/test/compile/compile.sh b/test/compile/compile.sh
index 06b4646a8..0e3425f8d 100755
--- a/test/compile/compile.sh
+++ b/test/compile/compile.sh
@@ -11,7 +11,8 @@
11# install contrib scripts 11# install contrib scripts
12# --enable-analyzer enable GCC 10 static analyzer 12# --enable-analyzer enable GCC 10 static analyzer
13 13
14 14# shellcheck source=config.sh
15. "$(dirname "$0")/../../config.sh" || exit 1
15 16
16arr[1]="TEST 1: standard compilation" 17arr[1]="TEST 1: standard compilation"
17arr[2]="TEST 2: compile dbus proxy disabled" 18arr[2]="TEST 2: compile dbus proxy disabled"
@@ -51,7 +52,7 @@ print_title() {
51 echo "**************************************************" 52 echo "**************************************************"
52} 53}
53 54
54DIST="$1" 55DIST="$(TARNAME)-$(VERSION)"
55while [[ $# -gt 0 ]]; do # Until you run out of parameters . . . 56while [[ $# -gt 0 ]]; do # Until you run out of parameters . . .
56 case "$1" in 57 case "$1" in
57 --clean) 58 --clean)