kpatch/contrib/kpatch.conf
loretob c9614c4298 Adding support to upstart systems.
Currently kpatch rely on systemd to load all kmods on startup.
This patch aims to enable kpatch to be used on upstart systems.

Limitations:
With systemd, it would be possible to unload all modules by issuing:
        systemctl stop kpatch
It was not possible to make a reasonable upstart's equivalent of it, so
to unload the modules it will be necessary to call kpatch explicitly:
        kpatch unload --all

I believe this it an non-issue, as it is still possible to unload
the modules by calling kpatch explicitly.

The file /etc/init/kpatch.conf will be installed unconditionally, and
removed on uninstall.

On my tests I have verified that all newly added files by this commit
are also deleted on uninstall.

It was also verified that applied patches are loaded again on startup.

rpmlint does not complain about anything new.

Signed-off-by: Bruno Loreto <loretob@amazon.com>
2018-04-06 16:12:02 +02:00

30 lines
722 B
Plaintext

# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# This upstart version lacks the ability of unloading modules with
# the "stop" directive, as upstart does not support a feature like
# systemd's RemainAfterExit option.
description "Apply kpatch kernel patches"
start on runlevel [2345] # Roughly equivalent to multi-user.target
# We are not a daemon
task
# Emulating systemd's ConditionKernelCommandLine option.
pre-start script
if [[ -e /proc/cmdline ]]
then
grep -q "kpatch.enable=0" /proc/cmdline && exit 1
else
dmesg | grep -q "Command line.*kpatch.enable=0" && exit 1
fi
exit 0
end script
# Main process (start)
exec PREFIX/sbin/kpatch load --all