summaryrefslogtreecommitdiffstats
path: root/scripts/package/mkdebian
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-07-02 20:02:42 +0200
committerMasahiro Yamada <masahiroy@kernel.org>2024-07-16 09:06:18 +0200
commitc0414419758b2521c2038847960af258c678db8d (patch)
treec3d018a34fb165db57d1a754f889c4c0e1b4b7a9 /scripts/package/mkdebian
parentkbuild: deb-pkg: remove support for "name <email>" form for DEBEMAIL (diff)
downloadlinux-c0414419758b2521c2038847960af258c678db8d.tar.xz
linux-c0414419758b2521c2038847960af258c678db8d.zip
kbuild: package: add -e and -u options to some shell scripts
Set -e to make these scripts fail on the first error. Set -u because these scripts are invoked by Makefile, and do not work properly without necessary variables defined. I tweaked mkdebian to cope with optional environment variables. Remove the explicit "test -n ..." from install-extmod-build. Both options are described in POSIX. [1] [1]: https://pubs.opengroup.org/onlinepubs/009604499/utilities/set.html Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/package/mkdebian')
-rwxr-xr-xscripts/package/mkdebian22
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 83c6636fadb8..f962d303502b 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -4,7 +4,7 @@
#
# Simple script to generate a debian/ directory for a Linux kernel.
-set -e
+set -eu
is_enabled() {
grep -q "^$1=y" include/config/auto.conf
@@ -19,7 +19,7 @@ if_enabled_echo() {
}
set_debarch() {
- if [ -n "$KBUILD_DEBARCH" ] ; then
+ if [ "${KBUILD_DEBARCH:+set}" ]; then
debarch="$KBUILD_DEBARCH"
return
fi
@@ -135,13 +135,21 @@ else
fi
maintainer="${name} <${email}>"
-if [ "$1" = --need-source ]; then
- gen_source
-fi
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --need-source)
+ gen_source
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
# Some variables and settings used throughout the script
version=$KERNELRELEASE
-if [ -n "$KDEB_PKGVERSION" ]; then
+if [ "${KDEB_PKGVERSION:+set}" ]; then
packageversion=$KDEB_PKGVERSION
else
packageversion=$(${srctree}/scripts/setlocalversion --no-local ${srctree})-$($srctree/scripts/build-version)
@@ -158,7 +166,7 @@ debarch=
set_debarch
# Try to determine distribution
-if [ -n "$KDEB_CHANGELOG_DIST" ]; then
+if [ "${KDEB_CHANGELOG_DIST:+set}" ]; then
distribution=$KDEB_CHANGELOG_DIST
# In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog
elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then