2014-04-01 20:14:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Licensed under the GPLv2
|
|
|
|
#
|
|
|
|
# Copyright 2014 Red Hat, Inc.
|
|
|
|
# Josh Poimboeuf <jpoimboe@redhat.com>
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
check() {
|
2014-05-21 17:16:46 +00:00
|
|
|
if [[ -e /var/lib/kpatch/$kernel ]]; then
|
2014-04-01 20:14:40 +00:00
|
|
|
return 0
|
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
install() {
|
|
|
|
# install kpatch script
|
|
|
|
inst_any -d /usr/sbin/kpatch /usr/local/sbin/kpatch /usr/sbin/kpatch
|
|
|
|
|
|
|
|
# install insmod (needed by kpatch script)
|
|
|
|
inst_symlink /usr/sbin/insmod
|
|
|
|
|
2014-05-06 09:43:49 +00:00
|
|
|
# install dirname (needed by kpatch script)
|
|
|
|
inst /usr/bin/dirname
|
|
|
|
|
2014-04-01 20:14:40 +00:00
|
|
|
# install core module
|
2014-05-20 00:49:05 +00:00
|
|
|
inst_any -d /usr/lib/modules/$kernel/extra/kpatch/kpatch.ko /usr/local/lib/modules/$kernel/extra/kpatch/kpatch.ko /usr/lib/modules/$kernel/extra/kpatch/kpatch.ko
|
2014-04-01 20:14:40 +00:00
|
|
|
|
|
|
|
# install patch modules
|
|
|
|
if [[ -e /var/lib/kpatch/$kernel ]]; then
|
|
|
|
inst_dir /var/lib/kpatch/$kernel
|
|
|
|
for i in /var/lib/kpatch/$kernel/*; do
|
|
|
|
[[ -e $i ]] || continue
|
|
|
|
inst "$i"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install hook script
|
2014-04-14 17:27:55 +00:00
|
|
|
inst_hook pre-udev 00 "$moddir/kpatch-load-all.sh"
|
2014-04-01 20:14:40 +00:00
|
|
|
}
|