mirror of
https://github.com/dynup/kpatch
synced 2025-05-09 03:17:57 +00:00
Merge pull request #231 from jpoimboe/unload-all-error
kpatch: a few minor script cleanups
This commit is contained in:
commit
91f3a1d501
@ -151,7 +151,7 @@ case "$1" in
|
|||||||
*)
|
*)
|
||||||
PATCH="$2"
|
PATCH="$2"
|
||||||
find_module "$PATCH" || die "can't find $PATCH"
|
find_module "$PATCH" || die "can't find $PATCH"
|
||||||
load_module "$MODULE" || die "failed to load patch $PATCH"
|
load_module "$MODULE" || die "failed to load module $PATCH"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
@ -160,13 +160,14 @@ case "$1" in
|
|||||||
[[ "$#" -ne 2 ]] && usage
|
[[ "$#" -ne 2 ]] && usage
|
||||||
PATCH="$2"
|
PATCH="$2"
|
||||||
find_module "$PATCH" || die "can't find $PATCH"
|
find_module "$PATCH" || die "can't find $PATCH"
|
||||||
load_module "$MODULE" replace=1 || die "failed to load patch $PATCH"
|
load_module "$MODULE" replace=1 || die "failed to load module $PATCH"
|
||||||
unload_disabled_modules || die "failed to unload old modules"
|
unload_disabled_modules || die "failed to unload old modules"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"unload")
|
"unload")
|
||||||
[[ "$#" -ne 2 ]] && usage
|
[[ "$#" -ne 2 ]] && usage
|
||||||
unload_module "$2" || die "failed to unload patch $2"
|
[[ $2 =~ ^- ]] && usage
|
||||||
|
unload_module "$2" || die "failed to unload module $2"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"install")
|
"install")
|
||||||
@ -181,7 +182,7 @@ case "$1" in
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
[[ -z "$2" ]] && die "no patch file specified"
|
[[ -z "$2" ]] && die "no module file specified"
|
||||||
PATCH="$2"
|
PATCH="$2"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -198,7 +199,7 @@ case "$1" in
|
|||||||
|
|
||||||
echo "installing $PATCH ($KVER)"
|
echo "installing $PATCH ($KVER)"
|
||||||
mkdir -p $INSTALLDIR/$KVER || die "failed to create install directory"
|
mkdir -p $INSTALLDIR/$KVER || die "failed to create install directory"
|
||||||
cp -f "$PATCH" $INSTALLDIR/$KVER || die "failed to install patch $PATCH"
|
cp -f "$PATCH" $INSTALLDIR/$KVER || die "failed to install module $PATCH"
|
||||||
|
|
||||||
if lsinitrd -k $KVER &> /dev/null; then
|
if lsinitrd -k $KVER &> /dev/null; then
|
||||||
echo "rebuilding $KVER initramfs"
|
echo "rebuilding $KVER initramfs"
|
||||||
@ -218,7 +219,7 @@ case "$1" in
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
[[ -z "$2" ]] && die "no patch file specified"
|
[[ -z "$2" ]] && die "no module file specified"
|
||||||
PATCH="$2"
|
PATCH="$2"
|
||||||
[[ "$PATCH" != $(basename "$PATCH") ]] && die "please supply patch module name without path"
|
[[ "$PATCH" != $(basename "$PATCH") ]] && die "please supply patch module name without path"
|
||||||
;;
|
;;
|
||||||
@ -229,7 +230,7 @@ case "$1" in
|
|||||||
[[ ! -e $INSTALLDIR/$KVER/"$PATCH" ]] && die "$PATCH is not installed for kernel $KVER"
|
[[ ! -e $INSTALLDIR/$KVER/"$PATCH" ]] && die "$PATCH is not installed for kernel $KVER"
|
||||||
|
|
||||||
echo "uninstalling $PATCH ($KVER)"
|
echo "uninstalling $PATCH ($KVER)"
|
||||||
rm -f $INSTALLDIR/$KVER/"$PATCH" || die "failed to uninstall patch $PATCH"
|
rm -f $INSTALLDIR/$KVER/"$PATCH" || die "failed to uninstall module $PATCH"
|
||||||
if lsinitrd -k $KVER &> /dev/null; then
|
if lsinitrd -k $KVER &> /dev/null; then
|
||||||
echo "rebuilding $KVER initramfs"
|
echo "rebuilding $KVER initramfs"
|
||||||
dracut -f --kver $KVER || die "dracut failed"
|
dracut -f --kver $KVER || die "dracut failed"
|
||||||
@ -260,7 +261,7 @@ case "$1" in
|
|||||||
PATCH="$2"
|
PATCH="$2"
|
||||||
find_module "$PATCH" || die "can't find $PATCH"
|
find_module "$PATCH" || die "can't find $PATCH"
|
||||||
echo "Patch information for $PATCH:"
|
echo "Patch information for $PATCH:"
|
||||||
/usr/sbin/modinfo "$MODULE" || die "failed to get info for patch $PATCH"
|
/usr/sbin/modinfo "$MODULE" || die "failed to get info for module $PATCH"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"help"|"-h"|"--help")
|
"help"|"-h"|"--help")
|
||||||
|
Loading…
Reference in New Issue
Block a user