#!/bin/sh
set -e

if [ "$1" = "configure" ]; then
    # Trigger update for initramfs (LP: #1514485).
    command -v update-initramfs >/dev/null 2>&1 && update-initramfs -u
    [ -x /etc/kernel/postinst.d/dracut ] && /etc/kernel/postinst.d/dracut $(uname -r)
fi


# Automatically added by dh_python3
if command -v py3compile >/dev/null 2>&1; then
	py3compile -p walinuxagent:amd64 
fi
if command -v pypy3compile >/dev/null 2>&1; then
	pypy3compile -p walinuxagent:amd64  || true
fi

# End automatically added section
# Automatically added by dh_installdeb/13.14.1ubuntu5
dpkg-maintscript-helper mv_conffile /etc/logrotate.d/waagent /etc/logrotate.d/waagent.logrotate 2.2.6\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/cloud/cloud.cfg.d/91_walinuxagent.cfg 2.2.21\+really2.2.20-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installsystemd/13.14.1ubuntu5
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# The following line should be removed in trixie or trixie+1
	deb-systemd-helper unmask 'walinuxagent.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'walinuxagent.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'walinuxagent.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 'walinuxagent.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.14.1ubuntu5
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke start 'walinuxagent.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.14.1ubuntu5
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# The following line should be removed in trixie or trixie+1
	deb-systemd-helper unmask 'ephemeral-disk-warning.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'ephemeral-disk-warning.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'ephemeral-disk-warning.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 'ephemeral-disk-warning.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.14.1ubuntu5
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke start 'ephemeral-disk-warning.service' >/dev/null || true
	fi
fi
# End automatically added section


exit 0
