#!/bin/bash # installed packages from remote repos pkgs=($(pacman -Qqn | \ # also some select additional packages cat - /usr/local/share/select.pkgs | \ # get corresponding URLs pacman -Sp - | \ # filter out cached files grep -v 'file://')) # clip URLs into just the file names pkgs=(${pkgs[@]##*/}) # clip off version, release, architecture.extension(s), and download pacman -Sw ${pkgs[@]%-*-*-*} # update package database cd /var/cache/pacman/pkg make # trash old packages paccache -r