diff --git a/drive-health/packaging/set-collector-interval.sh b/drive-health/packaging/set-collector-interval.sh index 3d50835..d9118d3 100755 --- a/drive-health/packaging/set-collector-interval.sh +++ b/drive-health/packaging/set-collector-interval.sh @@ -18,7 +18,9 @@ dropin_path="$dropin_dir/interval.conf" temporary=$(mktemp) trap 'rm -f -- "$temporary"' EXIT -printf '[Timer]\nOnUnitActiveSec=\nOnUnitActiveSec=%smin\n' "$interval_minutes" >"$temporary" +# Resetting a monotonic timer also removes OnBootSec inherited from the base +# unit, so the drop-in must restore both triggers. +printf '[Timer]\nOnUnitActiveSec=\nOnBootSec=20s\nOnUnitActiveSec=%smin\n' "$interval_minutes" >"$temporary" install -d -m0755 "$dropin_dir" install -m0644 "$temporary" "$dropin_path" diff --git a/drive-health/packaging/uninstall-system-collector.sh b/drive-health/packaging/uninstall-system-collector.sh index 0843949..3ccfd99 100755 --- a/drive-health/packaging/uninstall-system-collector.sh +++ b/drive-health/packaging/uninstall-system-collector.sh @@ -15,6 +15,7 @@ rm -f \ "/etc/systemd/system/$service_name.service" \ "/etc/systemd/system/$service_name.timer" rm -rf \ + "/etc/systemd/system/$service_name.timer.d" \ "/usr/local/libexec/$service_name" \ "/run/$service_name" diff --git a/drive-health/plugin.toml b/drive-health/plugin.toml index 0b01730..9866493 100644 --- a/drive-health/plugin.toml +++ b/drive-health/plugin.toml @@ -1,6 +1,6 @@ id = "gustav0ar/drive-health" name = "Drive Health" -version = "1.2.3" +version = "1.2.4" plugin_api = 9 author = "Drive Health contributors" license = "MIT" diff --git a/drive-health/tests/test_packaging.sh b/drive-health/tests/test_packaging.sh index 7cfeec4..5a14d44 100644 --- a/drive-health/tests/test_packaging.sh +++ b/drive-health/tests/test_packaging.sh @@ -20,8 +20,11 @@ grep -q '^OnUnitActiveSec=15min$' "$fixture/noctalia-drive-health.timer" bash -n "$interval_script" bash -n "$manage_script" +grep -Fq "OnUnitActiveSec=\\nOnBootSec=20s\\nOnUnitActiveSec=%smin" "$interval_script" grep -q 'packaging/manage-collector.sh' "$project_dir/packaging/install-system-collector.sh" grep -q 'packaging/uninstall-system-collector.sh' "$project_dir/packaging/install-system-collector.sh" +grep -Fq '"/etc/systemd/system/$service_name.timer.d"' \ + "$project_dir/packaging/uninstall-system-collector.sh" if grep -R -q 'noctalia-smart-monito[r]' "$project_dir"; then echo "generic legacy collector namespace must not be read, modified, or removed" >&2