#!/bin/sh # keeping a fresh list of all explicitly installed packages pacman -Qqe > "/home/jay/stuf/ARESEES/pkglist.txt" pacman -Qqen > "/home/jay/stuf/ARESEES/pkglist_native.txt" pacman -Qqem > "/home/jay/stuf/ARESEES/pkglist_foreign.txt" # pacman -S --needed - < pkglist.txt to install them # pacman -S --needed $(comm -12 <(pacman -Slq | sort) <(sort pkglist.txt)) to filter out the AUR ones # pacman -Rsu $(comm -23 <(pacman -Qq | sort) <(sort pkglist.txt)) final check to make sure only listed packages are present on the system # ----------------------------------------------------------------------------------------------------------------------------- # removing all but 3 most recent package versions paccache -r paccache -ruk0 # every version if said package is uninstalled # you can enable/start paccache.timer for the first one to happen automatically # ----------------------------------------------------------------------------------------------------------------------------- # removing orphaned packages pacman -Qtdq | pacman -Rns - # will throw an error if list is empty, this is fine # pacman -Qqd | pacman -Rsu --print - does the same as above(?) but also hits circular and excessive dependencies # ----------------------------------------------------------------------------------------------------------------------------- # figure something out for dotfiles (google: rmshit.py)