summaryrefslogtreecommitdiff
path: root/scripts/build-version
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-06-11 21:24:47 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2024-07-15 19:08:37 +0300
commitae4c4cee8110a986f5a884c5d91d137e2b994303 (patch)
tree656af0379e1a0cd69f134595a3af14ca1bda7b62 /scripts/build-version
parent9b114520837a5f08b8eeeee30947bb9e7f44be1e (diff)
downloadlinux-ae4c4cee8110a986f5a884c5d91d137e2b994303.tar.xz
kbuild: move init/build-version to scripts/
At first, I thought this script would be needed only in init/Makefile. However, commit 5db8face97f8 ("kbuild: Restore .version auto-increment behaviour for Debian packages") and commit 1789fc912541 ("kbuild: rpm-pkg: invoke the kernel build from rpmbuild for binrpm-pkg") revealed that it was actually needed for scripts/package/mk* as well. After all, scripts/ is a better place for it. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts/build-version')
-rwxr-xr-xscripts/build-version10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/build-version b/scripts/build-version
new file mode 100755
index 000000000000..537d45815083
--- /dev/null
+++ b/scripts/build-version
@@ -0,0 +1,10 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
+
+prev_ver=$(cat .version 2>/dev/null) &&
+ver=$(expr ${prev_ver} + 1 2>/dev/null) ||
+ver=1
+
+echo ${ver} > .version
+
+echo ${ver}