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
|
|
|
|
|
2014-12-03 22:04:04 +00:00
|
|
|
# install kpatch script dependencies
|
2014-12-03 22:10:21 +00:00
|
|
|
inst /usr/sbin/insmod
|
2014-05-06 09:43:49 +00:00
|
|
|
inst /usr/bin/dirname
|
2014-12-03 22:04:04 +00:00
|
|
|
inst /usr/bin/readelf
|
|
|
|
inst /usr/bin/awk
|
2014-05-06 09:43:49 +00:00
|
|
|
|
2014-04-01 20:14:40 +00:00
|
|
|
# install core module
|
2014-07-28 21:05:31 +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 /usr/lib/kpatch/$kernel/kpatch.ko /usr/local/lib/kpatch/$kernel/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
|
|
|
}
|