Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .bin/initial-installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,13 @@ sudo cp "${HOME}/.system-config-backup/reflector/reflector.conf" "/etc/xdg/refle
sudo cp "${HOME}/.system-config-backup/systemd/resolved.conf" "/etc/systemd/resolved.conf"
print_log_message $success_color "system configs has been copied."

chsh -s /usr/bin/zsh celtic

curl -o .config/OpenRGB/plugins/effects.so https://openrgb.org/releases/plugins/effects/release_0.9/OpenRGBEffectsPlugin_0.9_Bullseye_64_f1411e1.so

# Start some daemons
print_log_message $info_color "enable the necessary services..."
systemctl enable --now tlp.service
systemctl enable --now greetd.service
systemctl enable --now swayosd-libinput-backend.service
systemctl enable --now reflector.service
systemctl enable --now greetd.service

chsh -s /usr/bin/zsh celtic

curl -o .config/OpenRGB/plugins/effects.so https://openrgb.org/releases/plugins/effects/release_0.9/OpenRGBEffectsPlugin_0.9_Bullseye_64_f1411e1.so

print_log_message $success_color "system installation finished."
zsh
108 changes: 94 additions & 14 deletions .bin/maintenance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,98 @@

# Script for maintaining optimal system state
# INFO: zsh alias: maint
# shellcheck disable=2059

# Clear ${HOME} of unnecessary files and directories
rm -rf "${HOME}/.android"
rm -rf "${HOME}/.cargo"
rmdir "${HOME}/Desktop"
rm -rf "${HOME}/Downloads/Telegram Desktop/*"
rm -rf "${HOME}/.yarn"
rm "${HOME}/.python_history"
rm "${HOME}/.yarnrc"
rm "${HOME}/.bash_history"
# lostfiles
# Clear the rofi modes cache
printf "\e[36mClear the rofi modes cache...\e[0m\n"
printf "\e[36mClear cliphist mode...\e[0m\n"
cliphist wipe
set -euo pipefail
IFS=$'\n\t'

# Color codes
CYAN='\e[36m'
GREEN='\e[32m'
YELLOW='\e[33m'
RESET='\e[0m'

printf "${CYAN}=== Starting system maintenance ===${RESET}\n"

# Helper: delete if exists, and print when deletion occurs
delete_path() {
local path=$1
if [[ -e "$path" ]]; then
rm -rf "$path"
printf "${GREEN}Deleted:${RESET} %s\n" "$path"
fi
}

# ------------------------------------------------------------------------------
# 1. Remove known unnecessary dirs/files
# ------------------------------------------------------------------------------
printf "${CYAN}[1/5] Removing unused files and directories...${RESET}\n"

delete_path "${HOME}/.android" # Android SDK leftovers
delete_path "${HOME}/.cargo" # Rust cache
delete_path "${HOME}/.yarn" # Yarn cache
delete_path "${HOME}/.python_history" # Python REPL history
delete_path "${HOME}/.yarnrc"
delete_path "${HOME}/.bash_history"

# Clean Telegram Desktop downloads
TELEGRAM_DL="${HOME}/Downloads/Telegram Desktop"
if [[ -d "$TELEGRAM_DL" ]]; then
shopt -s dotglob
for f in "$TELEGRAM_DL"/*; do
delete_path "$f"
done
shopt -u dotglob
fi

# Attempt to remove Desktop if empty
if [[ -d "${HOME}/Desktop" ]]; then
rmdir --ignore-fail-on-non-empty "${HOME}/Desktop" &&
printf "${GREEN}Removed empty directory:${RESET} %s\n" "${HOME}/Desktop"
fi

# ------------------------------------------------------------------------------
# 2. Clear cliphist cache
# ------------------------------------------------------------------------------
printf "${CYAN}[2/5] Clearing cliphist cache...${RESET}\n"
if command -v cliphist &>/dev/null; then
cliphist wipe && printf "${GREEN}cliphist cache wiped${RESET}\n"
else
printf "${YELLOW}cliphist not installed; skipping${RESET}\n"
fi

# ------------------------------------------------------------------------------
# 3. Vacuum systemd journal logs
# ------------------------------------------------------------------------------
printf "${CYAN}[3/5] Vacuuming journal logs older than 7 days...${RESET}\n"
sudo journalctl --vacuum-time=7d &&
printf "${GREEN}Journal logs vacuumed${RESET}\n"

# ------------------------------------------------------------------------------
# 4. Clean stale /tmp files
# ------------------------------------------------------------------------------
printf "${CYAN}[4/5] Cleaning stale /tmp files (older than 3 days)...${RESET}\n"
sudo find /tmp -mindepth 1 -mtime +3 -print0 | while IFS= read -r -d '' file; do
sudo rm -rf "$file" && printf "${GREEN}Deleted stale tmp:${RESET} %s\n" "$file"
done

# ------------------------------------------------------------------------------
# 5. Run rmlint on selected folders
# ------------------------------------------------------------------------------
printf "${CYAN}[5/5] Running rmlint on select folders...${RESET}\n"
RMLINT_TARGETS=(
"${HOME}/Documents"
"${HOME}/Videos"
"${HOME}/Music"
"${HOME}/Pictures"
)

for dir in "${RMLINT_TARGETS[@]}"; do
if [[ -d "$dir" ]]; then
printf "${CYAN}Scanning:%s${RESET}\n" "$dir"
# rmlint will itself report duplicates/deletions as per its default output
rmlint "$dir" --no-crossdev
fi
done

printf "${GREEN}=== Maintenance complete ===${RESET}\n"
Loading
Loading