mirror of
https://github.com/dynup/kpatch
synced 2025-02-17 18:26:59 +00:00
Merge pull request #812 from kirawrath/upstart-support
Adding support to upstart systems.
This commit is contained in:
commit
ae79f2206d
@ -15,6 +15,7 @@ LIBEXECDIR = $(DESTDIR)$(PREFIX)/$(LIBEXEC)/kpatch
|
||||
DATADIR = $(DESTDIR)$(PREFIX)/share/kpatch
|
||||
MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1
|
||||
SYSTEMDDIR = $(DESTDIR)$(PREFIX)/lib/systemd/system
|
||||
UPSTARTDIR = $(DESTDIR)/etc/init
|
||||
|
||||
# The core module is only supported on x86_64
|
||||
ifeq ($(ARCH),x86_64)
|
||||
|
@ -6,8 +6,12 @@ install: all
|
||||
$(INSTALL) -d $(SYSTEMDDIR)
|
||||
$(INSTALL) -m 0644 kpatch.service $(SYSTEMDDIR)
|
||||
sed -i 's~PREFIX~$(PREFIX)~' $(SYSTEMDDIR)/kpatch.service
|
||||
$(INSTALL) -d $(UPSTARTDIR)
|
||||
$(INSTALL) -m 0644 kpatch.conf $(UPSTARTDIR)
|
||||
sed -i 's~PREFIX~$(PREFIX)~' $(UPSTARTDIR)/kpatch.conf
|
||||
|
||||
uninstall:
|
||||
$(RM) $(SYSTEMDDIR)/kpatch.service
|
||||
$(RM) $(UPSTARTDIR)/kpatch.conf
|
||||
|
||||
clean:
|
||||
|
29
contrib/kpatch.conf
Normal file
29
contrib/kpatch.conf
Normal file
@ -0,0 +1,29 @@
|
||||
# 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
|
||||
|
@ -79,6 +79,7 @@ rm -rf %{buildroot}
|
||||
%{_sbindir}/kpatch
|
||||
%{_mandir}/man1/kpatch.1*
|
||||
%{_usr}/lib/systemd/system/*
|
||||
%{_sysconfdir}/init/kpatch.conf
|
||||
|
||||
%files %{KVER}
|
||||
%defattr(-,root,root,-)
|
||||
|
Loading…
Reference in New Issue
Block a user