mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-15 14:28:39 +00:00
cleanup(scripts): cleanup systemd unit in DEB installer
Signed-off-by: Stanley Chan <pocketgamer5000@gmail.com>
This commit is contained in:
@@ -41,3 +41,34 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Based off what debhelper dh_systemd_enable/13.3.4 would have added
|
||||||
|
# ref: https://www.debian.org/doc/manuals/debmake-doc/ch05.en.html#debhelper
|
||||||
|
|
||||||
|
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.service' >/dev/null || true
|
||||||
|
|
||||||
|
# was-enabled defaults to true, so new installations run enable.
|
||||||
|
if deb-systemd-helper --quiet was-enabled 'falco.service'; then
|
||||||
|
# Enables the unit on first installation, creates new
|
||||||
|
# symlinks on upgrades if the unit file has changed.
|
||||||
|
deb-systemd-helper enable 'falco.service' >/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.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
|
||||||
|
if [ -d /run/systemd/system ]; then
|
||||||
|
systemctl --system daemon-reload >/dev/null || true
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
_dh_action=restart
|
||||||
|
else
|
||||||
|
_dh_action=start
|
||||||
|
fi
|
||||||
|
deb-systemd-invoke $_dh_action 'falco.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
@@ -15,3 +15,25 @@
|
|||||||
# 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.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Based off what debhelper dh_systemd_enable/13.3.4 would have added
|
||||||
|
# ref: https://www.debian.org/doc/manuals/debmake-doc/ch05.en.html#debhelper
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
|
||||||
|
systemctl --system daemon-reload >/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "remove" ]; then
|
||||||
|
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||||
|
deb-systemd-helper mask 'falco.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "purge" ]; then
|
||||||
|
if [ -x "/usr/bin/deb-systemd-helper" ]; then
|
||||||
|
deb-systemd-helper purge 'falco.service' >/dev/null || true
|
||||||
|
deb-systemd-helper unmask 'falco.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
@@ -17,6 +17,14 @@
|
|||||||
#
|
#
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Based off what debhelper dh_systemd_enable/13.3.4 would have added
|
||||||
|
# ref: https://www.debian.org/doc/manuals/debmake-doc/ch05.en.html#debhelper
|
||||||
|
# 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.service' >/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
remove|upgrade|deconfigure)
|
remove|upgrade|deconfigure)
|
||||||
/usr/bin/falco-driver-loader --clean
|
/usr/bin/falco-driver-loader --clean
|
||||||
|
Reference in New Issue
Block a user