ubuntu-22.04.3-desktop-amd64/casper/filesystem/var/lib/dpkg/info/zsys.postinst

121 lines
5.0 KiB
Bash
Executable File

#!/bin/sh
set -e
# The zsysd service fails to start if the zfs kernel module is not loaded,
# so we make sure it's loaded here first.
modprobe -v zfs || true
is_zsys() {
dsname="$(findmnt -o SOURCE -n /)"
if [ -z "$dsname" ]; then
return 1
fi
if [ "$(zfs get com.ubuntu.zsys:bootfs -H -o value "$dsname")" != "yes" ]; then
return 1
fi
return 0
}
case "$1" in
configure)
# Enable autotrim for zsys pools
if dpkg --compare-versions "$2" le-nl '0.5.0'; then
if is_zsys; then
for mountpoint in / /boot; do
dsname="$(findmnt -o SOURCE -n ${mountpoint}||true)"
if [ -n "$dsname" ]; then
zpool set autotrim=on ${dsname%%/*} || true
zpool trim ${dsname%%/*} || true
fi
done
fi
fi
;;
esac
# Automatically added by dh_installsystemduser/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -z "${DPKG_ROOT:-}" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper --user unmask 'zsys-user-savestate.timer' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet --user was-enabled 'zsys-user-savestate.timer' ; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper --user enable 'zsys-user-savestate.timer' >/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 --user update-state 'zsys-user-savestate.timer' >/dev/null || true
fi
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
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 'zsys-commit.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'zsys-commit.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'zsys-commit.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 'zsys-commit.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
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 'zsys-gc.timer' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'zsys-gc.timer'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'zsys-gc.timer' >/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 'zsys-gc.timer' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
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 'zsysd.socket' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'zsysd.socket'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'zsysd.socket' >/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 'zsysd.socket' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
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 'zsys-commit.service' 'zsys-gc.service' 'zsys-gc.timer' 'zsysd.service' 'zsysd.socket' >/dev/null || true
fi
fi
# End automatically added section