blob: 13cdc6bfb4e12dff245860d6cbc9f409b3f465c5 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 15838a86d5ea94fa05976ea32fd847b18261b403 Mon Sep 17 00:00:00 2001
Brad Bishop316dfdd2018-06-25 12:45:53 -04002From: Ruslan Bilovol <rbilovol@cisco.com>
3Date: Tue, 2 Jan 2018 14:50:03 +0200
4Subject: [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>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080017
Brad Bishop316dfdd2018-06-25 12:45:53 -040018---
19 kpatch-build/kpatch-build | 9 +++++++--
20 1 file changed, 7 insertions(+), 2 deletions(-)
21
22diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080023index 4a011aa..eb6cd64 100755
Brad Bishop316dfdd2018-06-25 12:45:53 -040024--- a/kpatch-build/kpatch-build
25+++ b/kpatch-build/kpatch-build
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080026@@ -394,12 +394,13 @@ usage() {
Brad Bishop316dfdd2018-06-25 12:45:53 -040027 echo " (can be specified multiple times)" >&2
28 echo " --cross-compile Specify the prefix used for all executables" >&2
29 echo " used during compilation" >&2
30+ echo " --distro Override distro name" >&2
31 echo " --skip-cleanup Skip post-build cleanup" >&2
32 echo " --skip-gcc-check Skip gcc version matching check" >&2
33 echo " (not recommended)" >&2
34 }
35
36-options="$(getopt -o ha:r:s:c:v:j:t:n:o:d -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,debug,cross-compile:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
37+options="$(getopt -o ha:r:s:c:v:j:t:n:o:d -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,debug,cross-compile:,distro:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
38
39 eval set -- "$options"
40
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080041@@ -461,6 +462,10 @@ while [[ $# -gt 0 ]]; do
Brad Bishop316dfdd2018-06-25 12:45:53 -040042 KPATCH_CROSS_COMPILE="$2"
43 shift
44 ;;
45+ --distro)
46+ DISTRO="$2"
47+ shift
48+ ;;
49 --skip-cleanup)
50 echo "Skipping cleanup"
51 SKIPCLEANUP=1
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080052@@ -539,7 +544,7 @@ fi
Brad Bishop316dfdd2018-06-25 12:45:53 -040053 # Don't check external file.
54 # shellcheck disable=SC1091
55 source /etc/os-release
56-DISTRO="$ID"
57+DISTRO="${DISTRO:-${ID}}"
58 if [[ "$DISTRO" = fedora ]] || [[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = ol ]] || [[ "$DISTRO" = centos ]]; then
59 [[ -z "$VMLINUX" ]] && VMLINUX="/usr/lib/debug/lib/modules/$ARCHVERSION/vmlinux"
60 [[ -e "$VMLINUX" ]] || die "kernel-debuginfo-$ARCHVERSION not installed"