mirror of
https://github.com/dynup/kpatch
synced 2025-01-28 15:52:43 +00:00
49 lines
1.3 KiB
Bash
49 lines
1.3 KiB
Bash
|
#!/bin/bash
|
||
|
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||
|
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||
|
#
|
||
|
# Licensed under the GPLv2
|
||
|
#
|
||
|
# Copyright 2014 Red Hat, Inc.
|
||
|
# Josh Poimboeuf <jpoimboe@redhat.com>
|
||
|
|
||
|
# called by dracut
|
||
|
check() {
|
||
|
if [[ -e /var/lib/kpatch/$kernel ]] || [[ -e /usr/lib/kpatch/$kernel ]]; then
|
||
|
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
|
||
|
|
||
|
# install core module
|
||
|
inst_any -d /usr/lib/modules/$kernel/kpatch/kpatch.ko /usr/local/lib/modules/$kernel/kpatch/kpatch.ko /usr/lib/modules/$kernel/kpatch/kpatch.ko
|
||
|
|
||
|
# 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
|
||
|
if [[ -e /usr/lib/kpatch/$kernel ]]; then
|
||
|
inst_dir /usr/lib/kpatch/$kernel
|
||
|
for i in /usr/lib/kpatch/$kernel/*; do
|
||
|
[[ -e $i ]] || continue
|
||
|
inst "$i"
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
# install hook script
|
||
|
inst_hook pre-udev 00 "$moddir/kpatch-apply-all.sh"
|
||
|
}
|