Created
November 30, 2021 12:27
-
-
Save sickcodes/37760f4380c6cf22e7b010867a646685 to your computer and use it in GitHub Desktop.
Unattended Reinstall All Arch Linux Packages and AUR Packages
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 | |
# Author: sickcodes | |
# Contact: https://twitter.com/sickcodes | |
# Copyright: sickcodes (C) 2021 | |
# License: GPLv3+ | |
# reinstall all packages, unattended | |
# does not include any manual makepkg'ed installations | |
# said packages, plus any unavailable AUR packages will be listed at ~/yay_reinstall_failed.log | |
# you need to be a NOPASSWD sudoer | |
# user ALL=(ALL) NOPASSWD: ALL | |
native_packages (){ | |
ALL_PACKAGES="$(sudo pacman -Qqn)" | |
IGNORABLES="$(grep --no-filename ^IgnorePkg /etc/pacman.* 2>/dev/null \ | |
| sed -E -e 's/IgnorePkg[\ ]+\=[\ ]+//g')" | |
yes | sudo pacman -Qqn \ | |
| grep -v "${IGNORABLES}" \ | |
| sudo pacman -Syu - --noconfirm | |
} | |
yays (){ | |
MANUAL_PACKAGES=($(sudo pacman -Qm -q)) | |
for PACKAGE in "${MANUAL_PACKAGES[@]}"; do | |
yes | yay -S "${PACKAGE}" --noconfirm | |
case $? in | |
0 ) true | |
;; | |
1 ) tee -a ~/yay_reinstall_failed.log <<< "${PACKAGE}" | |
;; | |
esac | |
yes | yay -Scc --noconfirm | |
done | |
} | |
native_packages | |
yays |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
but woulnd't that also install dependencies as explicitly installed packages, removing it's dependency status?