xref: /aosp_15_r20/external/e2fsprogs/debian/e2fsprogs.postrm.dh9 (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Worker#!/bin/sh
2*6a54128fSAndroid Build Coastguard Worker
3*6a54128fSAndroid Build Coastguard Workerupdate_svc() {
4*6a54128fSAndroid Build Coastguard Worker	deb-systemd-helper mask "$1" >/dev/null || true
5*6a54128fSAndroid Build Coastguard Worker
6*6a54128fSAndroid Build Coastguard Worker	if deb-systemd-helper --quiet was-enabled "$1"; then
7*6a54128fSAndroid Build Coastguard Worker		# Enables the unit on first installation, creates new
8*6a54128fSAndroid Build Coastguard Worker		# symlinks on upgrades if the unit file has changed.
9*6a54128fSAndroid Build Coastguard Worker		deb-systemd-helper disable "$1" >/dev/null || true
10*6a54128fSAndroid Build Coastguard Worker	fi
11*6a54128fSAndroid Build Coastguard Worker}
12*6a54128fSAndroid Build Coastguard Worker
13*6a54128fSAndroid Build Coastguard Workerif [ "$1" != "upgrade" ]; then
14*6a54128fSAndroid Build Coastguard Worker	# Abort on error.
15*6a54128fSAndroid Build Coastguard Worker	set -e
16*6a54128fSAndroid Build Coastguard Worker
17*6a54128fSAndroid Build Coastguard Worker	if [ -x /usr/sbin/update-initramfs -a \
18*6a54128fSAndroid Build Coastguard Worker		-e /etc/initramfs-tools/initramfs.conf ]; then
19*6a54128fSAndroid Build Coastguard Worker	    update-initramfs -u
20*6a54128fSAndroid Build Coastguard Worker	fi
21*6a54128fSAndroid Build Coastguard Worker
22*6a54128fSAndroid Build Coastguard Worker	#DEBHELPER#
23*6a54128fSAndroid Build Coastguard Worker
24*6a54128fSAndroid Build Coastguard Worker	# debhelper doesn't know what timers are...
25*6a54128fSAndroid Build Coastguard Worker	update_svc e2scrub_all.timer
26*6a54128fSAndroid Build Coastguard Worker	update_svc e2scrub_reap.service
27*6a54128fSAndroid Build Coastguard Worker
28*6a54128fSAndroid Build Coastguard Worker	# Start our new services
29*6a54128fSAndroid Build Coastguard Worker	if [ -d /run/systemd/system ]; then
30*6a54128fSAndroid Build Coastguard Worker		deb-systemd-invoke stop e2scrub_all.timer >/dev/null || true
31*6a54128fSAndroid Build Coastguard Worker	fi
32*6a54128fSAndroid Build Coastguard Workerfi
33*6a54128fSAndroid Build Coastguard Worker
34*6a54128fSAndroid Build Coastguard Workerexit 0
35*6a54128fSAndroid Build Coastguard Worker
36