kpatch: print status messages

Print status messages for load/unload/install/uninstall to give the user
a better idea of what's going on.
This commit is contained in:
Josh Poimboeuf 2014-04-01 15:57:57 -05:00
parent ff2b545f04
commit b487be539c

View File

@ -86,12 +86,15 @@ core_module_loaded () {
load_module () {
if ! core_module_loaded; then
find_core_module || die "can't find core module"
echo "loading core module: $COREMOD"
/usr/sbin/insmod "$COREMOD" || die "failed to load core module"
fi
echo "loading patch module: $1"
/usr/sbin/insmod "$1"
}
unload_module () {
echo "unloading patch module: $1"
/usr/sbin/rmmod "$(basename $1)"
}
@ -136,8 +139,12 @@ case "$1" in
PATCH="$2"
[[ -e "$PATCH" ]] || die "$PATCH doesn't exist"
[[ ${PATCH: -3} == ".ko" ]] || die "$PATCH isn't a .ko file"
echo "installing $PATCH to $USERDIR"
mkdir -p "$USERDIR" || die "failed to create install directory"
cp -f "$PATCH" "$USERDIR" || die "failed to install patch $PATCH"
echo "installing $PATCH to initramfs"
dracut -f || die "dracut failed"
;;
@ -145,7 +152,11 @@ case "$1" in
[[ "$#" -ne 2 ]] && usage
PATCH="$2"
find_module "$PATCH" || die "$PATCH is not installed"
echo "uninstalling $PATCH from $USERDIR"
rm -f "$USERDIR/$(basename $MODULE)" || die "failed to uninstall patch $PATCH"
echo "uninstalling $PATCH from initramfs"
dracut -f || die "dracut failed"
;;