mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-06 17:20:49 +00:00
scripts: remove falco.target and use require falcoctl with Wants=
Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
This commit is contained in:
@@ -16,7 +16,21 @@
|
||||
#
|
||||
|
||||
chosen_driver=
|
||||
enable_falcoctl=0
|
||||
|
||||
echo "[POST-INSTALL] Disable all possible enabled 'falco' service:"
|
||||
systemctl --system stop 'falco-kmod.service' || true
|
||||
systemctl --system stop 'falco-bpf.service' || true
|
||||
systemctl --system stop 'falco-modern-bpf.service' || true
|
||||
systemctl --system stop 'falco-plugin.service' || true
|
||||
systemctl --system stop 'falcoctl-artifact-follow.service' || true
|
||||
systemctl --system disable 'falco-kmod.service' || true
|
||||
systemctl --system disable 'falco-bpf.service' || true
|
||||
systemctl --system disable 'falco-modern-bpf.service' || true
|
||||
systemctl --system disable 'falco-plugin.service' || true
|
||||
systemctl --system disable 'falcoctl-artifact-follow.service' || true
|
||||
|
||||
# unmask falcoctl if it was masked
|
||||
systemctl --system unmask falcoctl-artifact-follow.service || true
|
||||
|
||||
if [ $1 -eq 1 ]; then
|
||||
if [ -x /usr/bin/dialog ]; then
|
||||
@@ -48,8 +62,9 @@ if [ $1 -eq 1 ]; then
|
||||
2 "No" \
|
||||
2>&1 >/dev/tty)
|
||||
case $CHOICE in
|
||||
1)
|
||||
enable_falcoctl=1
|
||||
2)
|
||||
# we don't want falcoctl enabled by defualt, we mask it
|
||||
systemctl --system mask falcoctl-artifact-follow.service || true
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@@ -59,6 +74,9 @@ fi
|
||||
|
||||
set -e
|
||||
|
||||
echo "[POST-INSTALL] Trigger deamon-reload:"
|
||||
systemctl --system daemon-reload || true
|
||||
|
||||
# If needed, try to load/compile the driver through falco-driver-loader
|
||||
case "$chosen_driver" in
|
||||
"kmod")
|
||||
@@ -80,36 +98,12 @@ esac
|
||||
# `systemd-update-helper install-system-units <service>`
|
||||
%systemd_post "falco-$chosen_driver.service"
|
||||
|
||||
# post install mirrored from .deb
|
||||
if [ $1 -eq 1 ]; then
|
||||
# post install/upgrade mirrored from .deb
|
||||
if [ $1 -ge 1 ]; then
|
||||
if [ -n "$chosen_driver" ]; then
|
||||
echo "[POST-INSTALL] Enable 'falco-$chosen_driver.service':"
|
||||
systemctl --system enable "falco-$chosen_driver.service" || true
|
||||
echo "[POST-INSTALL] Start 'falco-$chosen_driver.service':"
|
||||
systemctl --system start "falco-$chosen_driver.service" || true
|
||||
if [ $enable_falcoctl -eq 1 ]; then
|
||||
echo "[POST-INSTALL] Enable 'falcoctl-artifact-follow.service':"
|
||||
systemctl --system enable "falcoctl-artifact-follow.service" || true
|
||||
echo "[POST-INSTALL] Start 'falcoctl-artifact-follow.service':"
|
||||
systemctl --system start "falcoctl-artifact-follow.service" || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# post upgrade mirrored from .deb
|
||||
if [ $1 -gt 1 ]; then
|
||||
if [ -d /run/systemd/system ]; then
|
||||
echo "[POST-INSTALL] Trigger deamon-reload:"
|
||||
systemctl --system daemon-reload || true
|
||||
if [ -n "$chosen_driver" ]; then
|
||||
echo "[POST-INSTALL] Trigger 'falco-$chosen_driver.service' condrestart:"
|
||||
# restart falco on upgrade if service is already running
|
||||
systemctl --system condrestart "falco-$chosen_driver.service" || true
|
||||
if [ $enable_falcoctl -eq 1 ]; then
|
||||
echo "[POST-INSTALL] Trigger 'falcoctl-artifact-follow.service' condrestart:"
|
||||
# restart falcoctl-artifact-follow on upgrade if service is already running
|
||||
systemctl --system condrestart "falcoctl-artifact-follow.service" || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@@ -18,7 +18,11 @@ set -e
|
||||
|
||||
# Currently running falco service uses the driver, so stop it before driver cleanup
|
||||
echo "[PRE-REMOVE] Stop all Falco services:"
|
||||
systemctl --system stop 'falco.target' || true
|
||||
systemctl --system stop 'falco-kmod.service' || true
|
||||
systemctl --system stop 'falco-bpf.service' || true
|
||||
systemctl --system stop 'falco-modern-bpf.service' || true
|
||||
systemctl --system stop 'falco-plugin.service' || true
|
||||
systemctl --system stop 'falcoctl-artifact-follow.service' || true
|
||||
|
||||
echo "[PRE-REMOVE] Call 'falco-driver-loader --clean:'"
|
||||
falco-driver-loader --clean
|
||||
@@ -34,4 +38,4 @@ falco-driver-loader --clean
|
||||
%systemd_preun 'falco-bpf.service'
|
||||
%systemd_preun 'falco-modern-bpf.service'
|
||||
%systemd_preun 'falco-plugin.service'
|
||||
%systemd_preun 'falcoctl-artifact-follow.service'
|
||||
%systemd_preun 'falcoctl-artifact-follow.service'
|
||||
|
Reference in New Issue
Block a user