[PATCH 21/21] debian: enable xfs_scrubbed on the root filesystem by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 debian/control                 |    2 +-
 debian/postinst                |    8 ++++++++
 debian/prerm                   |   13 +++++++++++++
 scrub/xfs_scrubbed@xxxxxxxxxxx |    2 +-
 4 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 debian/prerm


diff --git a/debian/control b/debian/control
index 66b0a47a36ee24..31ea1e988f66be 100644
--- a/debian/control
+++ b/debian/control
@@ -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
diff --git a/debian/postinst b/debian/postinst
index 2ad9174658ceb4..4ba2e0c43b887e 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -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
index 00000000000000..48e8e94c4fe9ac
--- /dev/null
+++ b/debian/prerm
@@ -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
diff --git a/scrub/xfs_scrubbed@xxxxxxxxxxx b/scrub/xfs_scrubbed@xxxxxxxxxxx
index afd5c204327946..5bf1e79031af8c 100644
--- a/scrub/xfs_scrubbed@xxxxxxxxxxx
+++ b/scrub/xfs_scrubbed@xxxxxxxxxxx
@@ -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.





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux