]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
debian: enable xfs_scrubbed on the root filesystem by default
authorDarrick J. Wong <djwong@kernel.org>
Wed, 7 Aug 2024 22:54:58 +0000 (15:54 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 14 Aug 2024 03:08:27 +0000 (20:08 -0700)
Now that we're finished building autonomous repair, enable the service
on the root filesystem by default.  The root filesystem is mounted by
the initrd prior to starting systemd, which is why the udev rule cannot
autostart the service for the root filesystem.

dh_installsystemd won't activate a template service (aka one with an
at-sign in the name) even if it provides a DefaultInstance directive to
make that possible.  Use a fugly shim for this.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
debian/control
debian/postinst
debian/prerm [new file with mode: 0644]
scrub/xfs_scrubbed@.service.in

index 31773e53a19a45319514504d74e7a064a8aeb725..e4b3de3ee26a20c194df7464853329f9be169d30 100644 (file)
@@ -10,7 +10,7 @@ Homepage: https://xfs.wiki.kernel.org/
 Package: xfsprogs
 Depends: ${shlibs:Depends}, ${misc:Depends}, python3-dbus, python3:any
 Provides: fsck-backend
-Suggests: xfsdump, acl, attr, quota
+Suggests: xfsdump, acl, attr, quota, python3-jsonschema
 Breaks: xfsdump (<< 3.0.0)
 Replaces: xfsdump (<< 3.0.0)
 Architecture: linux-any
index 2ad9174658ceb4b3d8869610978da88bc77d7cba..4ba2e0c43b887e1a5b31aa1f68aac33c7ba30ff6 100644 (file)
@@ -24,5 +24,13 @@ case "${1}" in
 esac
 
 #DEBHELPER#
+#
+# dh_installsystemd doesn't handle template services even if we supply a
+# default instance, so we'll install it here.
+if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ] ; then
+       if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
+               /bin/systemctl enable xfs_scrubbed@.service || true
+       fi
+fi
 
 exit 0
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..48e8e94
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+# dh_installsystemd doesn't handle template services even if we supply a
+# default instance, so we'll install it here.
+if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
+       /bin/systemctl disable xfs_scrubbed@.service || true
+fi
+
+#DEBHELPER#
+
+exit 0
index 937876f28c54fa562de7fc83e8f3bc26ad49dcf6..a8ea6712c0096d157a28c0ef49ae8ec7643398ae 100644 (file)
@@ -19,7 +19,7 @@ RequiresMountsFor=%f
 Type=exec
 Environment=SERVICE_MODE=1
 ExecCondition=@pkg_libexec_dir@/xfs_scrubbed --check %f
-ExecStart=@pkg_libexec_dir@/xfs_scrubbed --log %f
+ExecStart=@pkg_libexec_dir@/xfs_scrubbed --autofsck --log %f
 SyslogIdentifier=%N
 
 # Run scrub with minimal CPU and IO priority so that nothing else will starve.