]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fstrim: run service and timer only if /etc/fstab is present
authorLuca BRUNO <luca.bruno@coreos.com>
Mon, 27 Apr 2020 10:06:07 +0000 (10:06 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Mon, 27 Apr 2020 10:08:53 +0000 (10:08 +0000)
The timer and service units run `fstrim --fstab`, which strictly
depends on `/etc/fstab` being present in the OS. This adds relevant
condition statements to the units, in order to skip them and avoid
runtime failures.

Ref: https://github.com/karelzak/util-linux/issues/673#issuecomment-409246816
Ref: https://github.com/coreos/bugs/issues/2591
Ref: https://github.com/coreos/fedora-coreos-tracker/issues/468

Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
sys-utils/fstrim.service.in
sys-utils/fstrim.timer

index bf8d3645e44817e2771c55e34e3cf6b63416f521..38472d99379ec55bf2c317ebabfa812c5d31e877 100644 (file)
@@ -1,6 +1,7 @@
 [Unit]
 Description=Discard unused blocks on filesystems from /etc/fstab
 Documentation=man:fstrim(8)
+ConditionPathExists=/etc/fstab
 ConditionVirtualization=!container
 
 [Service]
index 54b3c18f59153f38aca1ad3612a8ea9dff5900f4..b9e4d577cacd1ff96e9100c7cea429752bb8b428 100644 (file)
@@ -1,6 +1,7 @@
 [Unit]
 Description=Discard unused blocks once a week
 Documentation=man:fstrim
+ConditionPathExists=/etc/fstab
 ConditionVirtualization=!container
 
 [Timer]