spec: set CONFIG_LOCALVERSION
[platform/kernel/linux-rpi.git] / packaging / linux-rpi4.spec
index 1d5d670..d6c28c6 100644 (file)
@@ -81,15 +81,15 @@ headers are used by the installed headers for GNU glibc and other system
 %{?asan:/usr/bin/gcc-unforce-options}
 %{?ubsan:/usr/bin/gcc-unforce-options}
 
-# Make sure EXTRAVERSION says what we want it to say
-sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{variant}/" Makefile
-
 # 0. extract uapi headers
 make headers_check %{?_smp_mflags}
 make headers_install %{?_smp_mflags}
 
 # 1-1. Set config file
 make %{config_name} %{?_smp_mflags}
+if ! grep -q "^CONFIG_LOCALVERSION=\"-%{variant}" .config; then
+    ./scripts/config --set-str CONFIG_LOCALVERSION "-%{variant}$(eval $(grep ^CONFIG_LOCALVERSION= .config); echo $CONFIG_LOCALVERSION)"
+fi
 
 # 1-2. Build Image/Image.gz
 make %{?_smp_mflags}