Only attempt to disable service if still installed.

master
Icedream 2025-05-22 15:19:30 +02:00
parent 656e6c9d27
commit a0920a6f87
Signed by: icedream
GPG Key ID: 468BBEEBB9EC6AEA
1 changed files with 15 additions and 6 deletions

View File

@ -54,14 +54,21 @@ install_files() {
}
remove_file() {
local path="$1" sha256hash="${2:-}"
if [ -n "${sha256hash}" ]; then
if ! check_file "${path}" "${sha256hash}"; then
return
fi
fi
rm -v "$path"
}
check_file() {
local path="$1" sha256hash="${2:-}"
if [ ! -f "$path" ]; then
return
fi
if [ -n "${sha256hash}" ] && ! sha256sum -c - <<< "${sha256hash} ${path}" >/dev/null 2>/dev/null; then
return
fi
rm -v "$path"
sha256sum -c - <<< "${sha256hash} ${path}" >/dev/null 2>/dev/null
}
###
@ -74,8 +81,10 @@ if command -v fc-cache >/dev/null 2>&1; then
fi
if command -v systemctl >/dev/null 2>&1; then
systemctl --user disable tweak-cpu-usage
remove_file "${HOME}/.config/systemd/user/tweak-cpu-usage.service" 6abf4488aa268b0171cb400270e2531c8fb067ebe8216c72d337f8c056952f9e
if check_file "${HOME}/.config/systemd/user/tweak-cpu-usage.service" 6abf4488aa268b0171cb400270e2531c8fb067ebe8216c72d337f8c056952f9e; then
systemctl --user disable tweak-cpu-usage || true
remove_file "${HOME}/.config/systemd/user/tweak-cpu-usage.service"
fi
remove_file "${HOME}/.local/bin/tweak-cpu-usage" 7da1938cdf78e583140638848f8bf8a268c2710e4fa3462bca8373e438d67491
fi