Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Step 1: Reset dconf settings
- echo "Resetting system settings..."
- dconf reset -f /
- # Step 2: Backup and clear user-specific configurations
- echo "Backing up and clearing user-specific configurations..."
- timestamp=$(date +%Y%m%d_%H%M%S)
- mkdir -p ~/backup_configs_$timestamp
- mv ~/.config ~/.local ~/.cache ~/backup_configs_$timestamp 2>/dev/null
- # Step 3: Remove all packages installed after the initial setup
- echo "Identifying and removing user-installed packages..."
- install_log="/var/log/apt/history.log"
- if [ -f "$install_log" ]; then
- grep "Install:" $install_log | awk '{print $4}' | sed 's/,//g' > /tmp/user_installed_packages.txt
- while IFS= read -r package; do
- sudo apt purge -y "$package"
- done < /tmp/user_installed_packages.txt
- else
- echo "APT history log not found. Skipping package removal."
- fi
- # Step 4: Clean up unused dependencies and cache
- echo "Cleaning up unused dependencies and cache..."
- sudo apt autoremove -y
- sudo apt autoclean
- # Step 5: Reinstall Lubuntu desktop environment
- echo "Reinstalling Lubuntu desktop environment..."
- sudo apt install --reinstall lubuntu-desktop -y
- # Step 6: Notify completion
- echo "System reset complete. Rebooting now..."
- sudo reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement