Last active
August 22, 2022 08:13
-
-
Save stephanschielke/536de91148e0e5d68b1b5905843bd685 to your computer and use it in GitHub Desktop.
ARCH linux package update script for pacman and yaourt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo ========== | |
echo Check root | |
echo ========== | |
if [[ $UID == 0 ]]; then | |
echo "Please run this script WITHOUT sudo:" | |
echo "$0 $*" | |
exit 1 | |
fi | |
echo =========== | |
echo pacman -Syu | |
echo =========== | |
sudo pacman -Syu | |
echo ============ | |
echo List Orphans | |
echo ============ | |
orphans=$(sudo pacman -Qdt) | |
if [ -z "$orphans" ] | |
then | |
echo No oprhans | |
else | |
echo ============== | |
echo Remove Orphans | |
echo ============== | |
sudo pacman -Rsn $(sudo pacman -Qdtq) | |
fi | |
echo ==================== | |
read -e -p "Update AUR Packages? " -i "Y" REPLY | |
echo ==================== | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
#sudo echo "SUDO HACK" | |
user=$(whoami) | |
echo "Change user to '\$(whoami)'" | |
yaourt -Syua | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment