|
|
@@ -2,35 +2,35 @@
|
|
|
|
|
|
# Make sure we're running as root or with sudo
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
|
- gum style --foreground 196 --bold "This script must be run as root or with sudo"
|
|
|
- exit 1
|
|
|
+ gum style --foreground 196 --bold "This script must be run as root or with sudo"
|
|
|
+ exit 1
|
|
|
fi
|
|
|
|
|
|
# Check if gum is installed
|
|
|
if ! command -v gum &>/dev/null; then
|
|
|
- echo "This script uses gum for a nice interface."
|
|
|
- echo "Please install gum first: pacman -S gum"
|
|
|
- exit 1
|
|
|
+ echo "This script uses gum for a nice interface."
|
|
|
+ echo "Please install gum first: pacman -S gum"
|
|
|
+ exit 1
|
|
|
fi
|
|
|
|
|
|
# Function to print section headers
|
|
|
print_section() {
|
|
|
- gum style --border normal --border-foreground 39 --margin "1" --padding "0 2" --bold "$1"
|
|
|
+ gum style --border normal --border-foreground 39 --margin "1" --padding "0 2" --bold "$1"
|
|
|
}
|
|
|
|
|
|
# Function to print tasks
|
|
|
print_task() {
|
|
|
- echo "→ $1..."
|
|
|
+ echo "→ $1..."
|
|
|
}
|
|
|
|
|
|
# Function to print success messages
|
|
|
print_success() {
|
|
|
- gum style --foreground 46 "✓ $1"
|
|
|
+ gum style --foreground 46 "✓ $1"
|
|
|
}
|
|
|
|
|
|
# Function to print warning messages
|
|
|
print_warning() {
|
|
|
- gum style --foreground 226 "⚠ $1"
|
|
|
+ gum style --foreground 226 "⚠ $1"
|
|
|
}
|
|
|
|
|
|
# Starting message
|
|
|
@@ -55,11 +55,11 @@ print_success "Pacman cache cleaned"
|
|
|
|
|
|
# Clean AUR cache if paru is installed
|
|
|
if command -v paru &>/dev/null; then
|
|
|
- print_task "Cleaning paru cache"
|
|
|
- paru -Sc --noconfirm
|
|
|
- print_success "Paru cache cleaned"
|
|
|
+ print_task "Cleaning paru cache"
|
|
|
+ paru -Sc --noconfirm
|
|
|
+ print_success "Paru cache cleaned"
|
|
|
else
|
|
|
- print_warning "paru not found. Skipping AUR cache cleanup."
|
|
|
+ print_warning "paru not found. Skipping AUR cache cleanup."
|
|
|
fi
|
|
|
|
|
|
# Remove orphaned packages
|
|
|
@@ -67,14 +67,14 @@ print_section "Removing Orphaned Packages"
|
|
|
print_task "Finding orphaned packages"
|
|
|
ORPHANS=$(pacman -Qtdq)
|
|
|
if [ -n "$ORPHANS" ]; then
|
|
|
- echo "Found orphaned packages:"
|
|
|
- echo "$ORPHANS"
|
|
|
+ echo "Found orphaned packages:"
|
|
|
+ echo "$ORPHANS"
|
|
|
|
|
|
- print_task "Removing orphaned packages"
|
|
|
- pacman -Rns $(pacman -Qtdq) --noconfirm
|
|
|
- print_success "Orphaned packages removed"
|
|
|
+ print_task "Removing orphaned packages"
|
|
|
+ pacman -Rns $(pacman -Qtdq) --noconfirm
|
|
|
+ print_success "Orphaned packages removed"
|
|
|
else
|
|
|
- print_success "No orphaned packages found"
|
|
|
+ print_success "No orphaned packages found"
|
|
|
fi
|
|
|
|
|
|
# # Clean user cache directory
|
|
|
@@ -144,8 +144,8 @@ print_section "Resetting Failed Systemd Units"
|
|
|
print_task "Checking for failed systemd units"
|
|
|
FAILED_UNITS=$(systemctl --failed --no-legend | awk '{print $1}')
|
|
|
if [ -n "$FAILED_UNITS" ]; then
|
|
|
- echo "Failed units found:"
|
|
|
- echo "$FAILED_UNITS"
|
|
|
+ echo "Failed units found:"
|
|
|
+ echo "$FAILED_UNITS"
|
|
|
fi
|
|
|
print_task "Clearing failed systemd units"
|
|
|
systemctl reset-failed
|
|
|
@@ -160,11 +160,11 @@ print_success "Temporary files removed"
|
|
|
# Update file database
|
|
|
print_section "Updating File Database"
|
|
|
if command -v updatedb &>/dev/null; then
|
|
|
- print_task "Updating file database for locate command"
|
|
|
- updatedb
|
|
|
- print_success "File database updated"
|
|
|
+ print_task "Updating file database for locate command"
|
|
|
+ updatedb
|
|
|
+ print_success "File database updated"
|
|
|
else
|
|
|
- print_warning "updatedb not found. Skipping file database update."
|
|
|
+ print_warning "updatedb not found. Skipping file database update."
|
|
|
fi
|
|
|
|
|
|
# Check for and install security updates
|
|
|
@@ -172,24 +172,24 @@ print_section "Security Updates Check"
|
|
|
print_task "Checking for security updates"
|
|
|
SECURITY_UPDATES=$(pacman -Qu | grep -i "security")
|
|
|
if [ -n "$SECURITY_UPDATES" ]; then
|
|
|
- echo "Security updates available:"
|
|
|
- echo "$SECURITY_UPDATES"
|
|
|
+ echo "Security updates available:"
|
|
|
+ echo "$SECURITY_UPDATES"
|
|
|
|
|
|
- print_task "Installing security updates"
|
|
|
- pacman -S --needed $(echo "$SECURITY_UPDATES" | awk '{print $1}') --noconfirm
|
|
|
- print_success "Security updates installed"
|
|
|
+ print_task "Installing security updates"
|
|
|
+ pacman -S --needed $(echo "$SECURITY_UPDATES" | awk '{print $1}') --noconfirm
|
|
|
+ print_success "Security updates installed"
|
|
|
else
|
|
|
- print_success "No security updates needed"
|
|
|
+ print_success "No security updates needed"
|
|
|
fi
|
|
|
|
|
|
# Check for pacman database errors
|
|
|
print_section "Checking Pacman Database"
|
|
|
print_task "Verifying package database integrity"
|
|
|
if command -v paccheck &>/dev/null; then
|
|
|
- paccheck --md5sum --quiet
|
|
|
- print_success "Pacman database check complete"
|
|
|
+ paccheck --md5sum --quiet
|
|
|
+ print_success "Pacman database check complete"
|
|
|
else
|
|
|
- print_warning "paccheck not found. Consider installing pacutils package."
|
|
|
+ print_warning "paccheck not found. Consider installing pacutils package."
|
|
|
fi
|
|
|
|
|
|
# Cleanup pacnew/pacsave files
|
|
|
@@ -197,13 +197,13 @@ print_section "Configuration File Management"
|
|
|
print_task "Checking for .pacnew and .pacsave files"
|
|
|
PACFILES=$(find /etc -name "*.pacnew" -o -name "*.pacsave" 2>/dev/null)
|
|
|
if [ -n "$PACFILES" ]; then
|
|
|
- echo "Found the following .pacnew/.pacsave files:"
|
|
|
- echo "$PACFILES"
|
|
|
+ echo "Found the following .pacnew/.pacsave files:"
|
|
|
+ echo "$PACFILES"
|
|
|
|
|
|
- print_warning "You may want to merge these configuration files"
|
|
|
- echo "Use 'pacdiff' to help manage these files (install pacdiff from pacman-contrib)"
|
|
|
+ print_warning "You may want to merge these configuration files"
|
|
|
+ echo "Use 'pacdiff' to help manage these files (install pacdiff from pacman-contrib)"
|
|
|
else
|
|
|
- print_success "No .pacnew or .pacsave files found"
|
|
|
+ print_success "No .pacnew or .pacsave files found"
|
|
|
fi
|
|
|
|
|
|
# System status
|
|
|
@@ -211,11 +211,11 @@ print_section "System Status"
|
|
|
|
|
|
# Disk usage with duf
|
|
|
print_task "Checking disk usage"
|
|
|
-if command -v duf &>/dev/null; then
|
|
|
- duf --only local
|
|
|
+if command -v dysk &>/dev/null; then
|
|
|
+ dysk
|
|
|
else
|
|
|
- print_warning "duf not found. Using df instead. Consider installing duf for better disk usage display."
|
|
|
- df -h | grep -v "tmpfs" | grep -v "udev"
|
|
|
+ print_warning "duf not found. Using df instead. Consider installing duf for better disk usage display."
|
|
|
+ df -h | grep -v "tmpfs" | grep -v "udev"
|
|
|
fi
|
|
|
|
|
|
# Memory usage
|