diff --git a/scripts/debian/postinst.in b/scripts/debian/postinst.in index baef3a43..397fa04a 100755 --- a/scripts/debian/postinst.in +++ b/scripts/debian/postinst.in @@ -64,22 +64,16 @@ esac if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # This will only remove masks created by d-s-h on package removal. - deb-systemd-helper unmask "falco@kmod.target" >/dev/null || true - deb-systemd-helper unmask "falco@bpf.target" >/dev/null || true - deb-systemd-helper unmask "falco@modern_bpf.target" >/dev/null || true - deb-systemd-helper unmask "falco@plugin.target" >/dev/null || true + systemctl --system unmask "falco@.target" >/dev/null || true + systemctl --system unmask "falco-kmod.service" >/dev/null || true + systemctl --system unmask "falco-bpf.service" >/dev/null || true + systemctl --system unmask "falco-modern_bpf.service" >/dev/null || true + systemctl --system unmask "falco-plugin.service" >/dev/null || true # was-enabled defaults to true, so new installations run enable. if [ -n "$chosen_driver" ]; then - if deb-systemd-helper --quiet was-enabled "falco@$chosen_driver.target"; then - # Enables the unit on first installation, creates new - # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable "falco@$chosen_driver.target" >/dev/null || true - else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state "falco@$chosen_driver.target" >/dev/null || true - fi + systemctl --system enable "falco@$chosen_driver.target" >/dev/null || true + systemctl --system start "falco@$chosen_driver.target" >/dev/null || true fi fi @@ -87,12 +81,8 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$chosen_driver" ]; then - if [ -n "$2" ]; then - _dh_action=restart - else - _dh_action=start - fi - deb-systemd-invoke $_dh_action "falco@$chosen_driver.target" >/dev/null || true + # restart falco on upgrade if service is already running + /usr/bin/systemctl --system condrestart "falco@$chosen_driver.target" >/dev/null || true fi fi fi diff --git a/scripts/debian/postrm.in b/scripts/debian/postrm.in index 6557fa33..f064f7d8 100755 --- a/scripts/debian/postrm.in +++ b/scripts/debian/postrm.in @@ -27,22 +27,10 @@ fi if [ "$1" = "remove" ]; then if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper mask 'falco@kmod.target' >/dev/null || true - deb-systemd-helper mask 'falco@bpf.target' >/dev/null || true - deb-systemd-helper mask 'falco@modern_bpf.target' >/dev/null || true - deb-systemd-helper mask "falco@plugin.target" >/dev/null || true + systemctl --system mask 'falco@.target' >/dev/null || true + systemctl --system mask 'falco-kmod.service' >/dev/null || true + systemctl --system mask 'falco-bpf.service' >/dev/null || true + systemctl --system mask 'falco-modern_bpf.service' >/dev/null || true + systemctl --system mask "falco-plugin.service" >/dev/null || true fi -fi - -if [ "$1" = "purge" ]; then - if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper purge 'falco@kmod.target' >/dev/null || true - deb-systemd-helper unmask 'falco@kmod.target' >/dev/null || true - deb-systemd-helper purge 'falco@bpf.target' >/dev/null || true - deb-systemd-helper unmask 'falco@bpf.target' >/dev/null || true - deb-systemd-helper purge 'falco@modern_bpf.target' >/dev/null || true - deb-systemd-helper unmask 'falco@modern_bpf.target' >/dev/null || true - deb-systemd-helper purge 'falco@plugin.target' >/dev/null || true - deb-systemd-helper unmask 'falco@plugin.target' >/dev/null || true - fi -fi +fi \ No newline at end of file diff --git a/scripts/debian/prerm.in b/scripts/debian/prerm.in index aa4ee4ac..41bf3f52 100755 --- a/scripts/debian/prerm.in +++ b/scripts/debian/prerm.in @@ -22,10 +22,10 @@ set -e # Currently running falco service uses the driver, so stop it before driver cleanup if [ -d /run/systemd/system ] && [ "$1" = remove ]; then - deb-systemd-invoke stop 'falco@kmod.target' >/dev/null || true - deb-systemd-invoke stop 'falco@bpf.target' >/dev/null || true - deb-systemd-invoke stop 'falco@modern_bpf.target' >/dev/null || true - deb-systemd-invoke stop 'falco@plugin.target' >/dev/null || true + systemctl --system stop 'falco@kmod.target' >/dev/null || true + systemctl --system stop 'falco@bpf.target' >/dev/null || true + systemctl --system stop 'falco@modern_bpf.target' >/dev/null || true + systemctl --system stop 'falco@plugin.target' >/dev/null || true fi case "$1" in diff --git a/scripts/rpm/postinstall.in b/scripts/rpm/postinstall.in index 17d80fd9..7320fa7a 100755 --- a/scripts/rpm/postinstall.in +++ b/scripts/rpm/postinstall.in @@ -70,10 +70,11 @@ esac # 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@kmod.target" >/dev/null || true - /usr/bin/systemctl --system unmask "falco@bpf.target" >/dev/null || true - /usr/bin/systemctl --system unmask "falco@modern_bpf.target" >/dev/null || true - /usr/bin/systemctl --system unmask "falco@plugin.target" >/dev/null || true + /usr/bin/systemctl --system unmask "falco@.target" >/dev/null || true + /usr/bin/systemctl --system unmask "falco-kmod.service" >/dev/null || true + /usr/bin/systemctl --system unmask "falco-bpf.service" >/dev/null || true + /usr/bin/systemctl --system unmask "falco-modern_bpf.service" >/dev/null || true + /usr/bin/systemctl --system unmask "falco-plugin.service" >/dev/null || true if [ -n "$chosen_driver" ]; then # enable falco on installation @@ -89,7 +90,6 @@ fi if [ $1 -gt 1 ]; then if [ -d /run/systemd/system ]; then /usr/bin/systemctl --system daemon-reload >/dev/null || true - if [ -n "$chosen_driver" ]; then # restart falco on upgrade if service is already running /usr/bin/systemctl --system condrestart "falco@$chosen_driver.target" >/dev/null || true diff --git a/scripts/rpm/postuninstall.in b/scripts/rpm/postuninstall.in index cbd19ab4..d2b0d9b5 100755 --- a/scripts/rpm/postuninstall.in +++ b/scripts/rpm/postuninstall.in @@ -20,10 +20,11 @@ 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@kmod.target' >/dev/null || true - /usr/bin/systemctl --system mask 'falco@bpf.target' >/dev/null || true - /usr/bin/systemctl --system mask 'falco@modern_bpf.target' >/dev/null || true - /usr/bin/systemctl --system mask 'falco@plugin.target' >/dev/null || true + /usr/bin/systemctl --system mask 'falco@.target' >/dev/null || true + /usr/bin/systemctl --system mask 'falco-kmod.service' >/dev/null || true + /usr/bin/systemctl --system mask 'falco-bpf.service' >/dev/null || true + /usr/bin/systemctl --system mask 'falco-modern_bpf.service' >/dev/null || true + /usr/bin/systemctl --system mask 'falco-plugin.service' >/dev/null || true fi # validate rpm macros by `rpm -qp --scripts ` diff --git a/scripts/systemd/falco-bpf.service b/scripts/systemd/falco-bpf.service index 8a85ff3d..9cf2f461 100644 --- a/scripts/systemd/falco-bpf.service +++ b/scripts/systemd/falco-bpf.service @@ -3,6 +3,7 @@ Description=Falco: Container Native Runtime Security with ebpf Documentation=https://falco.org/docs/ PartOf=falco@ebpf.target Conflicts=falco-kmod.service +Conflicts=falco-modern_bpf.service Conflicts=falco-plugin.service [Service] diff --git a/scripts/systemd/falco-kmod.service b/scripts/systemd/falco-kmod.service index 7799c82d..6f7f623b 100644 --- a/scripts/systemd/falco-kmod.service +++ b/scripts/systemd/falco-kmod.service @@ -4,7 +4,8 @@ Documentation=https://falco.org/docs/ After=falco-kmod-inject.service Requires=falco-kmod-inject.service PartOf=falco@kmod.target -Conflicts=falco-ebpf.service +Conflicts=falco-bpf.service +Conflicts=falco-modern_bpf.service Conflicts=falco-plugin.service [Service] diff --git a/scripts/systemd/falco-modern_bpf.service b/scripts/systemd/falco-modern_bpf.service index e7258a64..baa4ae73 100644 --- a/scripts/systemd/falco-modern_bpf.service +++ b/scripts/systemd/falco-modern_bpf.service @@ -3,6 +3,7 @@ Description=Falco: Container Native Runtime Security with ebpf Documentation=https://falco.org/docs/ PartOf=falco@ebpf.target Conflicts=falco-kmod.service +Conflicts=falco-bpf.service Conflicts=falco-plugin.service [Service] diff --git a/scripts/systemd/falco-plugin.service b/scripts/systemd/falco-plugin.service index c190bb6c..e82ecc3e 100644 --- a/scripts/systemd/falco-plugin.service +++ b/scripts/systemd/falco-plugin.service @@ -4,6 +4,7 @@ Documentation=https://falco.org/docs/ PartOf=falco@plugin.target Conflicts=falco-kmod.service Conflicts=falco-ebpf.service +Conflicts=falco-modern_bpf.service [Service] Type=simple