From 7ea40c86074d00044ee417ab7578c832eea22079 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 4 Feb 2026 22:12:47 +0100 Subject: [PATCH] Upload files to "/" --- README.md | 179 ++++++++++++++++++++++++++++ Standard Terminal.png | Bin 0 -> 11770 bytes setup_zsh.sh | 257 +++++++++++++++++++++++++++++++++++++++++ uninstall_zsh_setup.sh | 94 +++++++++++++++ up.sh | 188 ++++++++++++++++++++++++++++++ 5 files changed, 718 insertions(+) create mode 100644 README.md create mode 100644 Standard Terminal.png create mode 100644 setup_zsh.sh create mode 100644 uninstall_zsh_setup.sh create mode 100644 up.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..cb3c83c --- /dev/null +++ b/README.md @@ -0,0 +1,179 @@ +# Simplify and Beautify Your Linux Terminal Experience ✨ + +> [!TIP] +> Having issues? Please open an issue here: [https://github.com/StianNOR/Homelab/issues](https://github.com/StianNOR/Homelab/issues) +> Or join the community on Discord: [https://discord.gg/eHEHCzGCAE](https://discord.gg/eHEHCzGCAE) + +--- + +## Supported Package Managers ✅ + +| Package Manager | Distros | +|-----------------|-------------------------------------------| +| **APT** | Debian, Ubuntu, Linux Mint, Pop!_OS, Deepin, etc | +| **DNF** | Fedora, CentOS 8+, RHEL 8+, Rocky Linux, AlmaLinux, etc | +| **YUM** | CentOS 7, older RHEL versions, Oracle Linux, etc | +| **Pacman** | Arch Linux, Manjaro, EndeavourOS, Artix Linux, etc | +| **Zypper** | openSUSE, SUSE Linux Enterprise, etc | + +--- + +## Clone, Verify, and Install Homelab ✅ + +### Script Authenticity ⚠️ + +All scripts in this repository are digitally signed with my Keybase-managed PGP key. +This ensures the scripts you download are authentic and haven’t been tampered with. + +### Clone and Prepare +``` +cd ~ # Go to your home directory (check with 'pwd') +git clone https://github.com/StianNOR/Homelab.git +cd Homelab +sudo chmod +x *.sh +``` + +### Import My Public Key + +PGP fingerprint: +`52FE58C1C8BDA54D68E09C143E305BD749B795A3` + +``` +curl https://keybase.io/sarttech7/pgp_keys.asc | gpg --import + +``` + + +### Verify Scripts + + +``` +gpg --verify signatures/setup_zsh.sh.asc setup_zsh.sh +gpg --verify signatures/up.sh.asc up.sh +gpg --verify signatures/portainerup.sh.asc portainerup.sh +gpg --verify signatures/portainer_docker_uninstall.sh.asc portainer_docker_uninstall.sh +gpg --verify signatures/uninstall_zsh_setup.sh.asc uninstall_zsh_setup.sh +gpg --verify signatures/font_nerd_hack.sh.sig font_nerd_hack.sh +``` + + +Expected output: + +`Good signature from "StianNOR stiannor@duck.com"` + + + +> [!IMPORTANT] +> You may see this warning: +> `WARNING: This key is not certified with a trusted signature!` +> +> This simply means GPG does not yet fully trust the key. +> To mark it as trusted locally: +> ``` +> gpg --edit-key 3E305BD749B795A3 +> trust +> # Select option 5 (ultimate trust) +> y +> quit +> ``` +> Only assign ultimate trust to keys you have personally verified. + +--- + +## Installation Steps + +1. **Install the Nerd Hack Font** + +``` +./font_nerd_hack.sh +``` + +Configure the font in your system settings and terminal preferences. +A reboot is usually required. + +2. **Run the Main Setup Script** +``` +./setup_zsh.sh +``` + +After installation, reboot or log out/in to apply the changes. + +--- + +## Portainer and Docker Installation ✅ + +If you want to install Docker and Portainer, simply run `pup` in the terminal and follow the prompts. + +- When asked to reboot or relog, do so. +- If prompted, also run: +``` +newgrp docker +``` + +- Successful setup will display a confirmation message in the terminal. + +Later, you can also update Portainer by running: + + + +--- + +## Uninstall Options 😦 + +**Remove Portainer and Docker:** +``` +./portainer_docker_uninstall.sh +``` + + +**Uninstall the Zsh Setup (restart terminal afterward):** +``` +./uninstall_zsh_setup.sh +``` + + +--- + +## Helpful Shortcuts 🤓 + +**Show active Zsh aliases:** +``` +ali +``` + + +**Directory listing shortcuts:** + +| Command | Expands to | Description | +|---------|-----------------|------------------------------------------| +| `ls` | `ls` | List files and directories | +| `ll` | `ls -l` | Detailed long format | +| `la` | `ls -a` / `ls -la` | Show all files, including hidden ones | +| `sls` | `ls -ls` | Show listings with file sizes and details | + +--- + +## Author + +Best regards, +**StianNOR** +(Known as *sarttech7* on Keybase) +[https://keybase.io/sarttech7](https://keybase.io/sarttech7) + +--- + +## Disclaimer ⚠️ + +This script is provided *as-is* for supported Linux distributions. +While tested on common setups, it may not work for all configurations. + +- Always back up important data before running these scripts. +- The author accepts no responsibility for data loss or damage. +- If unsure, test first in a virtual machine or safe environment. +- This project is fully open and free to use, intended only for educational and community purposes — never for harmful activities. + + +| Before | After | +| :---: | :---: | +| ![Before Image]() | ![After Image]() | + diff --git a/Standard Terminal.png b/Standard Terminal.png new file mode 100644 index 0000000000000000000000000000000000000000..b2c96342d606c3b488d9a9632c9279cdbcd0bb6e GIT binary patch literal 11770 zcmeHtc~n!`x+itLCAY33ugWeE0VxHg5P@QrAy5`70sIBw8wSh!VmK5g~*SLLec8%0bR;zkc0st?qSMVI}A6z0cnJ+rMx4 zecyTbtCy?VKM(&?MMXu;?ZR0f6_q{PDk@)f{bMh1hy6oC2=MjIZx;d+Ra6eVSN?xh zXna6h**odnm83XmG$j05+!YlIb1SR7v)=^+4g3CwhCmfN8|zwU9pLtl5Wg!)iSX;L zkSY`M8uJA_h&zvMOx1I$ zXa4@R=KX(sdvX8iqw5h|gNm?vxmlhS>uz=HF;^!H`;TJOhHq_M{U4h2L^?AGGFom& zdw0O$6q!ucvWdG=nJ#7l3so_T$Lc0eRh1gxH+o_#kt-!ha5!ya575&4e!N-k{P^)> z_9KxGt^n2@f=5=IEOf7<#c-m4_Nxa4swkY_;nOYdiHV6PHl%;-*E3IRl#B-vz*rwQ zN#2elZxcK=JspTwO7>OmT7E;K2I|Xb^T6*N-?o=c#z;7wl;6LNpN^UHM{ZU*N0l{p zy5%|U_GiW*z6M6v_{e&$6a7v`USYrTJ6SkW)n4j=NXY9(UVXfDAXc}?2iG=wP!;I- zM$87o6nEVRpMS`T?Mx{5`3|HG+%Egj!-WNSo-B+3J`1uYeIGFWqk^9yKgb8h6irM` zJuQP0?Si2MIOk*3&GAdFj1fyp!@RUbI5SDK2?&K>ZUUrI4xb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dW-b&u_fWRWgPv55P0Odt!Gx3f4 zV>s@_bd6o3bBw3#Da;+)_o#HfBC_8!HK9-$1Zw!iBxr?sTHEblX}2su8M)0sAS=40wTv|OHR+eF_OiVxJ@K1a z-vdE?aWhcr0x#6DWLsZOl{y%haASs7eTR%_0n|j!ms9e=!;??mTyL zYtVnD2KF!M{TE7)<~_CeJA?4 z(>j&p#ib$^hP_qT+VW>ul36SMUBiw$Z=$ literal 0 HcmV?d00001 diff --git a/setup_zsh.sh b/setup_zsh.sh new file mode 100644 index 0000000..cd6c454 --- /dev/null +++ b/setup_zsh.sh @@ -0,0 +1,257 @@ +#!/bin/bash +set -e +set -o pipefail + +# --- Colors and Formatting --- +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +CYAN='\033[0;36m' +BOLD='\033[1m' +RESET='\033[0m' + +info() { echo -e "${CYAN}ℹ️ $*${RESET}"; } +success() { echo -e "${GREEN}✅ $*${RESET}"; } +warn() { echo -e "${YELLOW}⚠️ $*${RESET}"; } +error() { echo -e "${RED}❌ $*${RESET}"; } +step() { echo -e "${BOLD}${BLUE}➤ $*${RESET}"; } + +# --- Global error trap for fail-safe --- +trap '{ + error "Script failed at line $LINENO. Last command: $BASH_COMMAND" + warn "Try running the failed command manually, or check your package manager and sudo configuration." + warn "If on Arch/Manjaro, check pacman locks and mirrors. If on Ubuntu/Debian, check apt sources and network." + exit 1 +}' ERR + +# ----- 1. Detect package manager ----- +step "Detecting package manager..." +if command -v apt >/dev/null 2>&1; then + PM="apt" + UPDATE="sudo apt update" + INSTALL="sudo apt install -y" + CLEAN="sudo apt clean" + AUTOREMOVE="sudo apt autoremove -y" +elif command -v dnf >/dev/null 2>&1; then + PM="dnf" + UPDATE="sudo dnf check-update || true" + INSTALL="sudo dnf install -y" + CLEAN="sudo dnf clean all" + AUTOREMOVE="sudo dnf autoremove -y" +elif command -v yum >/dev/null 2>&1; then + PM="yum" + UPDATE="sudo yum check-update || true" + INSTALL="sudo yum install -y" + CLEAN="sudo yum clean all" + AUTOREMOVE="sudo yum autoremove -y" +elif command -v pacman >/dev/null 2>&1; then + PM="pacman" + UPDATE="sudo pacman -Syu --noconfirm" + INSTALL="sudo pacman -S --noconfirm" + CLEAN="sudo pacman -Sc --noconfirm" + ORPHANS="$(pacman -Qtdq 2>/dev/null || true)" + if [[ -n "$ORPHANS" ]]; then + AUTOREMOVE="sudo pacman -Rns $ORPHANS --noconfirm" + else + AUTOREMOVE="echo 'No orphaned packages to remove.'" + fi +elif command -v zypper >/dev/null 2>&1; then + PM="zypper" + UPDATE="sudo zypper refresh" + INSTALL="sudo zypper install -y" + CLEAN="sudo zypper clean" + AUTOREMOVE="sudo zypper rm -u" +else + error "No supported package manager found." + exit 1 +fi +success "Detected package manager: $PM" + +# ----- 2. Install zsh if missing ----- +step "Ensuring zsh is installed..." +if ! command -v zsh >/dev/null 2>&1; then + info "zsh not found, installing..." + if ! $INSTALL zsh; then + error "Failed to install zsh." + exit 1 + fi + success "zsh installed." +else + success "zsh is already installed." +fi + +# ----- 3. Install dependencies ----- +step "Updating package lists and installing dependencies..." +if ! $UPDATE; then + error "Package manager update failed. Check your network, mirrors, and sudo permissions." + exit 1 +fi +success "Package manager updated." + +if [[ "$PM" == "pacman" ]]; then + if ! $INSTALL curl git ruby gcc make; then + error "Dependency install failed. Check pacman output." + exit 1 + fi +else + if ! $INSTALL curl git ruby ruby-devel gcc make && ! $INSTALL ruby ruby-dev gcc make; then + error "Dependency install failed. Check package manager output." + exit 1 + fi +fi +success "Dependencies installed." + +# ----- 4. Update RubyGems and all gems ----- +step "Updating RubyGems and all installed gems..." +if [[ "$PM" == "apt" ]]; then + warn "RubyGems system update is disabled on Debian/Ubuntu. Use apt to update rubygems if needed." +else + if gem update --system; then + success "RubyGems system updated." + else + warn "RubyGems system update failed or is not supported on this distribution." + fi +fi + +if gem update; then + success "All installed gems updated." +else + warn "Gem update failed. Some gems may not have been updated." +fi + +# ----- 5. Install colorls (user install, not sudo) ----- +step "Checking for colorls Ruby gem..." +export GEM_HOME="$HOME/.gem" +export PATH="$PATH:$GEM_HOME/bin" + +if ! gem list -i colorls >/dev/null 2>&1; then + info "Installing colorls Ruby gem for your user..." + if ! gem install --user-install colorls; then + error "colorls install failed. Check Ruby/gem output." + exit 1 + fi + success "colorls installed." +else + success "colorls is already installed." +fi + +USER_GEM_BIN="$(ruby -e 'puts Gem.user_dir')/bin" +if ! grep -q "$USER_GEM_BIN" "$HOME/.zshrc"; then + echo "export PATH=\"\$PATH:$USER_GEM_BIN\"" >> "$HOME/.zshrc" + info "Added $USER_GEM_BIN to your PATH in .zshrc" +fi + +if ! command -v colorls >/dev/null 2>&1; then + warn "colorls binary not found in PATH. You may need to restart your shell or source your .zshrc." +fi + +# ----- 6. Install fastfetch ----- +step "Checking for fastfetch..." +if ! command -v fastfetch >/dev/null 2>&1; then + info "fastfetch not found in PATH. Trying to install via package manager..." + if $INSTALL fastfetch; then + success "fastfetch installed via package manager." + else + warn "Fastfetch package install failed or not available in your repo." + echo -e "${YELLOW}Please install fastfetch manually and then re-run this script.${RESET}" + exit 1 + fi +else + success "fastfetch is already installed." +fi + +# ----- 7. Install Oh My Zsh ----- +step "Checking for Oh My Zsh..." +if [ ! -f "$HOME/.oh-my-zsh/oh-my-zsh.sh" ]; then + info "Installing Oh My Zsh..." + rm -rf "$HOME/.oh-my-zsh" + if ! RUNZSH=no KEEP_ZSHRC=yes sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"; then + error "Oh My Zsh install failed." + exit 1 + fi + success "Oh My Zsh installed." +else + success "Oh My Zsh is already installed." +fi + +ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}" + +# ----- 8. Install Powerlevel10k theme ----- +step "Checking for Powerlevel10k theme..." +if [ ! -d "$ZSH_CUSTOM/themes/powerlevel10k" ]; then + info "Installing Powerlevel10k theme..." + if ! git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$ZSH_CUSTOM/themes/powerlevel10k"; then + error "Powerlevel10k install failed." + exit 1 + fi + success "Powerlevel10k installed." +else + success "Powerlevel10k theme is already installed." +fi + +# ----- 9. Install plugins ----- +step "Checking for Zsh plugins..." +declare -A plugins +plugins=( + [zsh-autosuggestions]="https://github.com/zsh-users/zsh-autosuggestions" + [zsh-syntax-highlighting]="https://github.com/zsh-users/zsh-syntax-highlighting" + [zsh-completions]="https://github.com/zsh-users/zsh-completions" +) + +for plugin in "${!plugins[@]}"; do + if [ ! -d "$ZSH_CUSTOM/plugins/$plugin" ]; then + info "Installing plugin: $plugin" + if ! git clone "${plugins[$plugin]}" "$ZSH_CUSTOM/plugins/$plugin"; then + error "Plugin $plugin install failed." + exit 1 + fi + success "Plugin $plugin installed." + else + success "Plugin $plugin is already installed." + fi +done + +# ----- 10. Copy .zshrc and .p10k.zsh from repo with error checking ----- +step "Copying .zshrc and .p10k.zsh from repo..." +SCRIPT_DIR="$HOME/Homelab" +REPO_ZSHRC="$SCRIPT_DIR/.zshrc" +DEST_ZSHRC="$HOME/.zshrc" +REPO_P10K="$SCRIPT_DIR/.p10k.zsh" +DEST_P10K="$HOME/.p10k.zsh" + +if [ -f "$REPO_ZSHRC" ]; then + cp "$REPO_ZSHRC" "$DEST_ZSHRC" + success ".zshrc copied to $DEST_ZSHRC" +else + warn "$REPO_ZSHRC not found. .zshrc was NOT copied." + ls -l "$SCRIPT_DIR" +fi + +if [ -f "$REPO_P10K" ]; then + cp "$REPO_P10K" "$DEST_P10K" + success ".p10k.zsh copied to $DEST_P10K" +else + warn "No .p10k.zsh found in $SCRIPT_DIR. Skipping." +fi + +# ----- 11. Change default shell to zsh if not already ----- +step "Checking default shell..." +if [ "$SHELL" != "$(which zsh)" ]; then + if chsh -s "$(which zsh)"; then + info "Default shell changed to zsh. Please log out and log in again for changes to take effect." + else + warn "Could not change default shell. You may need to do it manually." + fi +else + success "zsh is already the default shell." +fi + +echo -e "${GREEN}${BOLD} +🎉 All Zsh plugins, Powerlevel10k, colorls, fastfetch, and up.sh are installed and configured! 🎉 +${RESET}" + +echo -e "${CYAN}The up.sh script is now located in: ~/Homelab/up.sh${RESET}" +echo -e "${CYAN}Refreshing your shell in 3 seconds...${RESET}" +sleep 3 +exec zsh diff --git a/uninstall_zsh_setup.sh b/uninstall_zsh_setup.sh new file mode 100644 index 0000000..dd143c7 --- /dev/null +++ b/uninstall_zsh_setup.sh @@ -0,0 +1,94 @@ +#!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BOLD='\033[1m' +NC='\033[0m' # No Color + +info() { echo -e "${YELLOW}ℹ️ $*${NC}"; } +success() { echo -e "${GREEN}✅ $*${NC}"; } +warn() { echo -e "${YELLOW}⚠️ $*${NC}"; } +error() { echo -e "${RED}❌ $*${NC}"; } +step() { echo -e "${BOLD}${YELLOW}--- $* ---${NC}"; } + +step "Uninstalling Zsh/Powerlevel10k setup and related tools" + +# 1. Remove Oh My Zsh directory +info "Removing Oh My Zsh directory..." +if [ -d "$HOME/.oh-my-zsh" ]; then + rm -rf "$HOME/.oh-my-zsh" + success "Oh My Zsh directory removed." +else + warn "Oh My Zsh directory not found." +fi + +# 2. Remove Zsh configuration files +info "Removing Zsh configuration files..." +ZSH_CONFIG_FILES=("$HOME/.zshrc" "$HOME/.zshenv" "$HOME/.zprofile" "$HOME/.zlogin" "$HOME/.p10k.zsh") +for file in "${ZSH_CONFIG_FILES[@]}"; do + if [ -f "$file" ]; then + rm -f "$file" + success "Removed $file" + else + warn "$file not found." + fi +done + +# 3. Remove up.sh maintenance script +info "Removing up.sh maintenance script..." +if [ -f "$HOME/Documents/up.sh" ]; then + rm -f "$HOME/Documents/up.sh" + success "up.sh maintenance script removed." +else + warn "up.sh maintenance script not found." +fi + +# 4. Uninstall colorls (user gem) +info "Uninstalling colorls Ruby gem..." +# Ensure GEM_HOME and PATH are set correctly for user gems +export GEM_HOME="$HOME/.gem" +export PATH="$PATH:$GEM_HOME/bin" +if gem list -i colorls >/dev/null 2>&1; then + if gem uninstall colorls; then # Removed -x and sudo + success "colorls uninstalled." + else + error "Failed to uninstall colorls." + fi +else + warn "colorls gem not found." +fi + +# 5. Uninstall fastfetch +info "Uninstalling fastfetch..." +if command -v fastfetch >/dev/null 2>&1; then + # Assume it was installed via the curl installer which puts files in /usr/local + if sudo rm -f /usr/local/bin/fastfetch && sudo rm -rf /usr/local/share/fastfetch; then + success "fastfetch uninstalled." + else + error "Failed to remove fastfetch binaries. Manual removal may be needed." + fi +else + warn "fastfetch not found." +fi + + +# 6. Optionally restore default shell to bash +# Check if zsh is the current default shell before attempting to change +CURRENT_DEFAULT_SHELL=$(getent passwd "$USER" | awk -F: '{print $NF}') +if [ "$CURRENT_DEFAULT_SHELL" != "/bin/bash" ] && [ -f "/bin/bash" ]; then + info "Restoring default shell to /bin/bash..." + if chsh -s /bin/bash "$USER"; then # Specify user for chsh + success "Default shell changed to /bin/bash." + echo -e "${GREEN}Please log out and log in again for shell changes to take effect.${NC}" + else + error "Failed to change default shell to /bin/bash. You may need to do it manually." + fi +else + success "Default shell is already /bin/bash or /bin/bash not found." +fi + +echo -e "${BOLD}${GREEN}✅ Uninstallation complete.${NC}" +echo -e "${BOLD}${GREEN}Note: Log out and log back in for shell changes to fully apply.${NC}" diff --git a/up.sh b/up.sh new file mode 100644 index 0000000..3a691dc --- /dev/null +++ b/up.sh @@ -0,0 +1,188 @@ +#!/bin/bash +set -e + +# --- Colors and Formatting --- +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +BOLD='\033[1m' +RESET='\033[0m' + +info() { echo -e "${BLUE}ℹ $*${RESET}"; } +success() { echo -e "${GREEN}✅ $*${RESET}"; } +warn() { echo -e "${YELLOW}⚠ $*${RESET}"; } +error() { echo -e "${RED}❌ $*${RESET}"; } + +# --- Detect Package Manager --- +info "Detecting package manager..." +if command -v nala &>/dev/null; then + PM="nala" +elif command -v apt &>/dev/null; then + PM="apt" +elif command -v dnf &>/dev/null; then + PM="dnf" +elif command -v yum &>/dev/null; then + PM="yum" +elif command -v pacman &>/dev/null; then + PM="pacman" +elif command -v zypper &>/dev/null; then + PM="zypper" +else + error "No supported package manager found (apt/nala/dnf/yum/pacman/zypper)." + exit 1 +fi +success "Detected: $PM" + +# --- System Update and Cleanup --- +info "Starting system update and maintenance..." + +# Update and upgrade system +case "$PM" in + nala) + info "Updating package list and upgrading system (nala)..." + sudo nala update + sudo nala upgrade -y + sudo nala autoremove -y --purge + sudo nala clean + ;; + apt) + info "Updating package list and upgrading system (apt)..." + sudo apt update + sudo apt upgrade -y + sudo apt autoremove -y --purge + sudo apt clean + ;; + dnf) + info "Updating and cleaning system (dnf)..." + sudo dnf upgrade --refresh -y + sudo dnf autoremove -y + sudo dnf clean all + ;; + yum) + info "Updating and cleaning system (yum)..." + sudo yum update -y + sudo yum autoremove -y + sudo yum clean all + ;; + pacman) + info "Updating and cleaning system (pacman)..." + sudo pacman -Syu --noconfirm + sudo pacman -Rns $(pacman -Qtdq) --noconfirm 2>/dev/null || true + sudo pacman -Sc --noconfirm + ;; + zypper) + info "Updating and cleaning system (zypper)..." + sudo zypper refresh + sudo zypper update -y + sudo zypper clean --all + ;; +esac + +# --- Docker System Prune --- +if command -v docker &>/dev/null; then + info "Pruning Docker system..." + sudo docker system prune -a -f --volumes + success "Docker system pruned." +else + warn "Docker not installed. Skipping Docker prune." +fi + +# --- Flatpak Update --- +if command -v flatpak &>/dev/null; then + info "Updating Flatpak packages..." + flatpak update -y + success "Flatpak packages updated." +else + warn "Flatpak not installed. Skipping Flatpak update." +fi + +# --- Snap Update --- +if command -v snap &>/dev/null; then + info "Updating Snap packages..." + sudo snap refresh + success "Snap packages updated." +else + warn "Snap not installed. Skipping Snap update." +fi + +# --- Clean Journal Logs --- +info "Cleaning journal logs (older than 7 days)..." +sudo journalctl --vacuum-time=7d +success "Journal logs cleaned." + +# --- Clean Thumbnails Cache --- +info "Cleaning thumbnails cache..." +rm -rf ~/.cache/thumbnails/* +success "Thumbnails cache cleaned." + +# --- Clean Temporary Files --- +info "Cleaning /tmp and user cache..." +sudo rm -rf /tmp/* ~/.cache/* +success "Temporary files and cache cleaned." + +# --- Update Locate Database --- +info "Updating locate database..." +if command -v updatedb &>/dev/null; then + sudo updatedb +else + info "Installing mlocate/plocate for 'updatedb'..." + case "$PM" in + apt|nala) + sudo apt install -y plocate || sudo apt install -y mlocate + ;; + dnf) + sudo dnf install -y plocate || sudo dnf install -y mlocate + ;; + yum) + sudo yum install -y mlocate + ;; + pacman) + sudo pacman -S --noconfirm mlocate + ;; + zypper) + sudo zypper install -y mlocate + ;; + esac + sudo updatedb +fi +success "Locate database updated." + +# --- Remove Orphaned Packages (Pacman/DNF) --- +case "$PM" in + pacman) + info "Removing orphaned packages (pacman)..." + sudo pacman -Rns $(pacman -Qtdq) --noconfirm 2>/dev/null || true + ;; + dnf) + info "Removing orphaned packages (dnf)..." + sudo dnf remove --unused -y + ;; +esac + +# --- Check if Restart is Recommended --- +REBOOT_REQUIRED=false + +# Check for kernel updates (Debian/Ubuntu) +if [ -f /var/run/reboot-required ]; then + REBOOT_REQUIRED=true +fi + +# Check for pending Docker daemon restart +if sudo systemctl is-active docker >/dev/null 2>&1 && [ -n "$(sudo docker info 2>/dev/null | grep 'Pending updates')" ]; then + REBOOT_REQUIRED=true +fi + +# Check for other common restart triggers (e.g., glibc, systemd) +if [ -f /var/run/reboot-required.pkgs ]; then + REBOOT_REQUIRED=true +fi + +# --- Final Message --- +echo -e "${GREEN}${BOLD}✅ System update and maintenance completed!${RESET}" +if [ "$REBOOT_REQUIRED" = true ]; then + warn "⚠ A system restart is recommended to apply all updates (e.g., kernel, Docker, or critical libraries)." + warn " This is especially important for cryptocurrency nodes, Proxmox, and UniFi services." +else + echo -e "${GREEN}✅ No restart required.${RESET}" +fi