Add SSD TRIM (fstrim.timer) setup script (#1318)
* Add SSD TRIM (fstrim.timer) setup script * fix(system): mark fstrim as non-queueable --------- Co-authored-by: titus <contact@christitus.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
. ../common-script.sh
|
||||
|
||||
installFstrim() {
|
||||
# fstrim ships with util-linux
|
||||
if ! command_exists fstrim; then
|
||||
printf "%b\n" "${YELLOW}Installing fstrim (util-linux)...${RC}"
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm util-linux
|
||||
;;
|
||||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add util-linux
|
||||
;;
|
||||
xbps-install)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -Sy util-linux
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y util-linux
|
||||
;;
|
||||
esac
|
||||
else
|
||||
printf "%b\n" "${GREEN}fstrim is already installed${RC}"
|
||||
fi
|
||||
}
|
||||
|
||||
enableFstrimTimer() {
|
||||
if ! systemctl cat fstrim.timer >/dev/null 2>&1; then
|
||||
printf "%b\n" "${RED}fstrim.timer is not available on this system; cannot enable periodic TRIM.${RC}"
|
||||
exit 1
|
||||
fi
|
||||
printf "%b\n" "${YELLOW}Enabling weekly fstrim.timer...${RC}"
|
||||
"$ESCALATION_TOOL" systemctl enable --now fstrim.timer
|
||||
}
|
||||
|
||||
runInitialTrim() {
|
||||
printf "%b\n" "${YELLOW}Running an initial trim on all supported mounted filesystems...${RC}"
|
||||
"$ESCALATION_TOOL" fstrim -av || printf "%b\n" "${YELLOW}Some filesystems do not support trim and were skipped.${RC}"
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installFstrim
|
||||
enableFstrimTimer
|
||||
runInitialTrim
|
||||
|
||||
if systemctl is-active --quiet fstrim.timer; then
|
||||
printf "%b\n" "${GREEN}Periodic SSD TRIM is active (weekly via fstrim.timer).${RC}"
|
||||
else
|
||||
printf "%b\n" "${RED}fstrim.timer could not be activated. Check 'systemctl status fstrim.timer'.${RC}"
|
||||
fi
|
||||
@@ -212,6 +212,18 @@ description = "This script is designed to handle the installation of various sof
|
||||
script = "compile-setup.sh"
|
||||
task_list = "I"
|
||||
|
||||
[[data]]
|
||||
name = "Enable SSD TRIM"
|
||||
description = "Enable weekly SSD TRIM through systemd's fstrim.timer and run an initial trim. This is the recommended alternative to mounting with the continuous discard option. For more information visit: https://wiki.archlinux.org/title/Solid_state_drive#TRIM"
|
||||
script = "fstrim-setup.sh"
|
||||
task_list = "D I SS"
|
||||
multi_select = false
|
||||
|
||||
[[data.preconditions]]
|
||||
matches = true
|
||||
data = "command_exists"
|
||||
values = [ "systemctl" ]
|
||||
|
||||
[[data]]
|
||||
name = "Full System Cleanup"
|
||||
description = "This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash."
|
||||
|
||||
@@ -203,6 +203,7 @@ https://github.com/ChrisTitusTech/dwm-titus
|
||||
|
||||
- **Hyprland JaKooLit**: Install JaKooLit's Hyprland configuration
|
||||
- **Build Prerequisites**: This script is designed to handle the installation of various software dependencies across different Linux distributions
|
||||
- **Enable SSD TRIM**: Enable weekly SSD TRIM through systemd's fstrim.timer and run an initial trim. This is the recommended alternative to mounting with the continuous discard option. For more information visit: https://wiki.archlinux.org/title/Solid_state_drive#TRIM
|
||||
- **Full System Cleanup**: This script is designed to remove unnecessary packages, clean old cache files, remove temporary files, and to empty the trash.
|
||||
- **Full System Update**: This command updates your system to the latest packages available for your distro
|
||||
- **Full System Update (Topgrade)**: This command uses topgrade to update your system packages, configs, and more from various sources
|
||||
|
||||
Reference in New Issue
Block a user