kpatch-build: look for symvers file in /lib/modules/.../kpatch too

If kpatch core module is packaged in an RPM and the package is installed,
the likely location of the module and its symvers file is
/lib/modules/<kernel_version>/extra/kpatch/.

kpatch-build checks this location too now when looking for the .symvers
file. This is convenient for distributing the Kpatch tools as RPMs and
the like.

Signed-off-by: Evgenii Shatokhin <eshatokhin@odin.com>
This commit is contained in:
Evgenii Shatokhin 2015-10-19 14:23:35 +03:00
parent cba3081d59
commit d5e3e09428
1 changed files with 13 additions and 5 deletions

View File

@ -103,7 +103,14 @@ find_dirs() {
# installation path
TOOLSDIR="$(readlink -f $SCRIPTDIR/../libexec/kpatch)"
DATADIR="$(readlink -f $SCRIPTDIR/../share/kpatch)"
if [[ -e $SCRIPTDIR/../lib/kpatch/$ARCHVERSION/Module.symvers ]]; then
SYMVERSFILE="$(readlink -f $SCRIPTDIR/../lib/kpatch/$ARCHVERSION/Module.symvers)"
elif [[ -e /lib/modules/$ARCHVERSION/extra/kpatch/Module.symvers ]]; then
SYMVERSFILE="$(readlink -f /lib/modules/$ARCHVERSION/extra/kpatch/Module.symvers)"
else
warn "unable to find Module.symvers for kpatch core module"
return 1
fi
return
fi
@ -300,10 +307,6 @@ fi
# kernel's 56-byte module name array.
PATCHNAME=$(echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c 1-48)
find_dirs || die "can't find supporting tools"
[[ -e "$SYMVERSFILE" ]] || die "can't find core module Module.symvers"
source /etc/os-release
DISTRO=$ID
if [[ $DISTRO = fedora ]] || [[ $DISTRO = rhel ]] || [[ $DISTRO = ol ]] || [[ $DISTRO = centos ]]; then
@ -325,6 +328,11 @@ elif [[ $DISTRO = ubuntu ]] || [[ $DISTRO = debian ]]; then
export PATH=/usr/lib/ccache:$PATH
fi
find_dirs || die "can't find supporting tools"
[[ -e "$SYMVERSFILE" ]] || die "can't find core module Module.symvers"
if [[ $SKIPGCCCHECK -eq 0 ]]; then
gcc_version_check || die
fi