blob: 603a1475adc1af80d93fa6118909d30ffe5a823d [file] [log] [blame]
Brad Bishop26bdd442019-08-16 17:08:17 -04001From 4143fa0092fe4cafee10b24a97d3ad0b41ab7a30 Mon Sep 17 00:00:00 2001
2From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
3Date: Wed, 7 Aug 2019 03:24:39 +0900
Brad Bishop316dfdd2018-06-25 12:45:53 -04004Subject: [PATCH] kpatch-build: allow overriding of distro name
5
6It is sometimes useful to have ability to override
7distro name, for example during cross-compilation
8build when livepatch modules will be ran on the
9target which differs from host.
10
11This patch adds a new --distro option which
12implements all needed functionality
13
14Upstream-Status: Pending
15
16Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
17---
18 kpatch-build/kpatch-build | 9 +++++++--
19 1 file changed, 7 insertions(+), 2 deletions(-)
20
21diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
Brad Bishop26bdd442019-08-16 17:08:17 -040022index 39933fc..c0258a2 100755
Brad Bishop316dfdd2018-06-25 12:45:53 -040023--- a/kpatch-build/kpatch-build
24+++ b/kpatch-build/kpatch-build
Brad Bishop26bdd442019-08-16 17:08:17 -040025@@ -413,12 +413,13 @@ usage() {
26 echo " specify current version of module" >&2
Brad Bishop316dfdd2018-06-25 12:45:53 -040027 echo " --cross-compile Specify the prefix used for all executables" >&2
28 echo " used during compilation" >&2
29+ echo " --distro Override distro name" >&2
30 echo " --skip-cleanup Skip post-build cleanup" >&2
31 echo " --skip-gcc-check Skip gcc version matching check" >&2
32 echo " (not recommended)" >&2
33 }
34
Brad Bishop26bdd442019-08-16 17:08:17 -040035-options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
36+options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,distro:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
Brad Bishop316dfdd2018-06-25 12:45:53 -040037
38 eval set -- "$options"
39
Brad Bishop26bdd442019-08-16 17:08:17 -040040@@ -485,6 +486,10 @@ while [[ $# -gt 0 ]]; do
Brad Bishop316dfdd2018-06-25 12:45:53 -040041 KPATCH_CROSS_COMPILE="$2"
42 shift
43 ;;
44+ --distro)
45+ DISTRO="$2"
46+ shift
47+ ;;
48 --skip-cleanup)
49 echo "Skipping cleanup"
50 SKIPCLEANUP=1
Brad Bishop26bdd442019-08-16 17:08:17 -040051@@ -571,7 +576,7 @@ fi
Brad Bishop316dfdd2018-06-25 12:45:53 -040052 # Don't check external file.
53 # shellcheck disable=SC1091
54 source /etc/os-release
55-DISTRO="$ID"
56+DISTRO="${DISTRO:-${ID}}"
57 if [[ "$DISTRO" = fedora ]] || [[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = ol ]] || [[ "$DISTRO" = centos ]]; then
58 [[ -z "$VMLINUX" ]] && VMLINUX="/usr/lib/debug/lib/modules/$ARCHVERSION/vmlinux"
59 [[ -e "$VMLINUX" ]] || die "kernel-debuginfo-$ARCHVERSION not installed"
Brad Bishop26bdd442019-08-16 17:08:17 -040060--
612.7.4
62