2024-04-18 23:02:36 +00:00
|
|
|
diff --git a/usr/lib/hwsupport/trim-devices.sh b/usr/lib/hwsupport/trim-devices.sh
|
|
|
|
index 84897df..0f22352 100755
|
2024-03-01 17:41:30 +00:00
|
|
|
--- a/usr/lib/hwsupport/trim-devices.sh
|
|
|
|
+++ b/usr/lib/hwsupport/trim-devices.sh
|
2024-04-18 23:02:36 +00:00
|
|
|
@@ -78,6 +78,18 @@ function is_known_bad_device()
|
2024-03-01 17:41:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+# If fstrim has been disabled by the end-user, do nothing
|
|
|
|
+if ! systemctl is-enabled fstrim.timer; then
|
2024-03-01 17:43:26 +00:00
|
|
|
+ echo "fstrim.timer disabled, exiting trim-devices.sh"
|
2024-03-01 17:41:30 +00:00
|
|
|
+ exit
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+# If the upstream fstrim service is currently running, do nothing
|
|
|
|
+if systemctl is-active fstrim.service; then
|
2024-03-01 17:43:26 +00:00
|
|
|
+ echo "fstrim.service is currently active, exiting trim-devices.sh"
|
2024-03-01 17:41:30 +00:00
|
|
|
+ exit
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
# In some cases it is unsafe to trim an sdcard. When we detect this case
|
|
|
|
# lets just trim the partitions on the internal drive which we know are
|
|
|
|
# safe to trim/discard
|