mirror of
https://github.com/dynup/kpatch
synced 2024-12-29 00:32:01 +00:00
Remove enable/disable from kpatch script
The extra steps aren't justified right now and make the patch application and management processes more convoluted. Signed-off-by: Seth Jennings <sjenning@redhat.com>
This commit is contained in:
parent
3e08618447
commit
022e42bc1b
@ -29,7 +29,6 @@
|
|||||||
KERNELRELEASE="$(uname -r)"
|
KERNELRELEASE="$(uname -r)"
|
||||||
SYSDIR="/usr/lib/kpatch/$KERNELRELEASE"
|
SYSDIR="/usr/lib/kpatch/$KERNELRELEASE"
|
||||||
USERDIR="/var/lib/kpatch/$KERNELRELEASE"
|
USERDIR="/var/lib/kpatch/$KERNELRELEASE"
|
||||||
ENABLEDDIR="$USERDIR/enabled"
|
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
echo "usage: kpatch <command> [<args>]" >&2
|
echo "usage: kpatch <command> [<args>]" >&2
|
||||||
@ -38,12 +37,10 @@ usage () {
|
|||||||
printf ' %-20s %s\n' "install <file>" "install hotpatch module to the kpatch DB" >&2
|
printf ' %-20s %s\n' "install <file>" "install hotpatch module to the kpatch DB" >&2
|
||||||
printf ' %-20s %s\n' "uninstall <hotpatch>" "uninstall hotpatch module from the kpatch DB" >&2
|
printf ' %-20s %s\n' "uninstall <hotpatch>" "uninstall hotpatch module from the kpatch DB" >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
printf ' %-20s %s\n' "apply --all" "apply all enabled hotpatch modules to the running kernel" >&2
|
printf ' %-20s %s\n' "apply --all" "apply all installed hotpatch modules to the running kernel" >&2
|
||||||
printf ' %-20s %s\n' "apply <hotpatch>" "apply installed hotpatch module to the running kernel" >&2
|
printf ' %-20s %s\n' "apply <hotpatch>" "apply installed hotpatch module to the running kernel" >&2
|
||||||
printf ' %-20s %s\n' "remove <hotpatch>" "remove hotpatch module from the running kernel" >&2
|
printf ' %-20s %s\n' "remove <hotpatch>" "remove hotpatch module from the running kernel" >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
printf ' %-20s %s\n' "enable <hotpatch>" "automatically apply hotpatch module during boot" >&2
|
|
||||||
printf ' %-20s %s\n' "disable <hotpatch>" "don't automatically apply hotpatch module during boot" >&2
|
|
||||||
echo >&2
|
echo >&2
|
||||||
printf ' %-20s %s\n' "info <hotpatch>" "show information about an installed hotpatch module" >&2
|
printf ' %-20s %s\n' "info <hotpatch>" "show information about an installed hotpatch module" >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
@ -83,10 +80,6 @@ unload_module () {
|
|||||||
/usr/sbin/rmmod "$(basename $1)"
|
/usr/sbin/rmmod "$(basename $1)"
|
||||||
}
|
}
|
||||||
|
|
||||||
module_enabled() {
|
|
||||||
[[ -e "$ENABLEDDIR/$(basename $1)" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
echo_patch_name() {
|
echo_patch_name() {
|
||||||
NAME="$(basename $1)"
|
NAME="$(basename $1)"
|
||||||
echo $NAME
|
echo $NAME
|
||||||
@ -95,28 +88,15 @@ echo_patch_name() {
|
|||||||
unset MODULE
|
unset MODULE
|
||||||
[[ "$#" -gt 2 ]] || [[ "$#" -lt 1 ]] && usage
|
[[ "$#" -gt 2 ]] || [[ "$#" -lt 1 ]] && usage
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"enable")
|
|
||||||
[[ "$#" -ne 2 ]] && usage
|
|
||||||
PATCH="$2"
|
|
||||||
find_module "$PATCH" || die "$PATCH is not installed"
|
|
||||||
module_enabled $MODULE && die "$PATCH is already enabled"
|
|
||||||
mkdir -p $ENABLEDDIR
|
|
||||||
ln -s "$MODULE" "$ENABLEDDIR" || die "failed to enable patch $PATCH"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"disable")
|
|
||||||
[[ "$#" -ne 2 ]] && usage
|
|
||||||
PATCH="$2"
|
|
||||||
find_module "$PATCH" || die "$PATCH is not installed"
|
|
||||||
module_enabled $MODULE || die "$PATCH is already disabled"
|
|
||||||
rm -f "$ENABLEDDIR/$(basename $MODULE)" || die "failed to disable patch $PATCH"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"apply")
|
"apply")
|
||||||
[[ "$#" -ne 2 ]] && usage
|
[[ "$#" -ne 2 ]] && usage
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"--all")
|
"--all")
|
||||||
for i in "$ENABLEDDIR"/*.ko; do
|
for i in "$SYSDIR"/*.ko; do
|
||||||
|
[[ -e "$i" ]] || continue
|
||||||
|
load_module "$i" || die "failed to load module $i"
|
||||||
|
done
|
||||||
|
for i in "$USERDIR"/*.ko; do
|
||||||
[[ -e "$i" ]] || continue
|
[[ -e "$i" ]] || continue
|
||||||
load_module "$i" || die "failed to load module $i"
|
load_module "$i" || die "failed to load module $i"
|
||||||
done
|
done
|
||||||
@ -166,11 +146,6 @@ case "$1" in
|
|||||||
echo_patch_name $i
|
echo_patch_name $i
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
echo "Enabled patches:"
|
|
||||||
for i in "$ENABLEDDIR"/*.ko; do
|
|
||||||
[[ -e "$i" ]] || continue
|
|
||||||
echo_patch_name $i
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"info")
|
"info")
|
||||||
|
Loading…
Reference in New Issue
Block a user