mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-22 10:22:01 +00:00
cleanup(scripts): cleanup systemd unit in RPM installer
Signed-off-by: Stanley Chan <pocketgamer5000@gmail.com>
This commit is contained in:
parent
7610ee53e5
commit
79d875c28f
@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
set -e
|
||||||
|
|
||||||
mod_version="@DRIVER_VERSION@"
|
mod_version="@DRIVER_VERSION@"
|
||||||
dkms add -m falco -v $mod_version --rpm_safe_upgrade
|
dkms add -m falco -v $mod_version --rpm_safe_upgrade
|
||||||
@ -29,3 +30,35 @@ else
|
|||||||
echo -e "Module build for the currently running kernel was skipped since the"
|
echo -e "Module build for the currently running kernel was skipped since the"
|
||||||
echo -e "kernel source for this kernel does not seem to be installed."
|
echo -e "kernel source for this kernel does not seem to be installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# validate rpm macros by `rpm -qp --scripts <rpm>`
|
||||||
|
# RPM scriptlets: https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd
|
||||||
|
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax
|
||||||
|
|
||||||
|
# systemd_post macro expands to
|
||||||
|
# if postinst:
|
||||||
|
# `systemd-update-helper install-system-units <service>`
|
||||||
|
%systemd_post 'falco.service'
|
||||||
|
|
||||||
|
# post install mirrored from .deb
|
||||||
|
if [ $1 -eq 1 ]; then
|
||||||
|
# This will only remove masks created on package removal.
|
||||||
|
/usr/bin/systemctl --system unmask 'falco.service' >/dev/null || true
|
||||||
|
|
||||||
|
# enable falco on installation
|
||||||
|
# note: DEB postinstall script checks for changed symlinks
|
||||||
|
/usr/bin/systemctl --system enable 'falco.service' >/dev/null || true
|
||||||
|
|
||||||
|
# start falco on installation
|
||||||
|
/usr/bin/systemctl --system start 'falco.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# post upgrade mirrored from .deb
|
||||||
|
if [ $1 -gt 1 ]; then
|
||||||
|
if [ -d /run/systemd/system ]; then
|
||||||
|
/usr/bin/systemctl --system daemon-reload >/dev/null || true
|
||||||
|
|
||||||
|
# restart falco on upgrade if service is already running
|
||||||
|
/usr/bin/systemctl --system condrestart 'falco.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
@ -14,3 +14,20 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# post uninstall mirrored from .deb
|
||||||
|
if [ -d /run/systemd/system ] && [ "$1" = 0 ]; then
|
||||||
|
/usr/bin/systemctl --system daemon-reload >/dev/null || true
|
||||||
|
/usr/bin/systemctl --system mask 'falco.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# validate rpm macros by `rpm -qp --scripts <rpm>`
|
||||||
|
# RPM scriptlets: https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd
|
||||||
|
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax
|
||||||
|
|
||||||
|
# systemd_postun_with_restart macro expands to
|
||||||
|
# if package upgrade, not uninstall:
|
||||||
|
# `systemd-update-helper mark-restart-system-units <service>`
|
||||||
|
%systemd_postun_with_restart 'falco.service'
|
||||||
|
@ -14,5 +14,22 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# pre uninstall mirrored from .deb
|
||||||
|
# Currently running falco service uses the driver, so stop it before driver cleanup
|
||||||
|
if [ -d /run/systemd/system ] && [ $1 -eq 0 ]; then
|
||||||
|
# stop falco service before uninstall
|
||||||
|
/usr/bin/systemctl --system stop 'falco.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
/usr/bin/falco-driver-loader --clean
|
/usr/bin/falco-driver-loader --clean
|
||||||
|
|
||||||
|
# validate rpm macros by `rpm -qp --scripts <rpm>`
|
||||||
|
# RPM scriptlets: https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd
|
||||||
|
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax
|
||||||
|
|
||||||
|
# systemd_preun macro expands to
|
||||||
|
# if preuninstall:
|
||||||
|
# `systemd-update-helper remove-system-units <service>`
|
||||||
|
%systemd_preun 'falco.service'
|
||||||
|
Loading…
Reference in New Issue
Block a user