Skip to content

Instantly share code, notes, and snippets.

@Myl0g
Last active January 21, 2018 19:03
Show Gist options
  • Save Myl0g/c99ff17721ac75d7456cac329779e538 to your computer and use it in GitHub Desktop.
Save Myl0g/c99ff17721ac75d7456cac329779e538 to your computer and use it in GitHub Desktop.
Audit and remove the packages on an Arch system (yaourt needed)
#! /usr/bin/env bash
set -e
blue=$(tput setaf 4)
normal=$(tput sgr0)
yaourt -Qqe > packages.txt
cp packages.txt wanted.txt
echo "Delete the packages from the list in order to mark them for removal..."
sleep 4
vim wanted.txt
comm -23 <(sort packages.txt) <(sort wanted.txt) > to_delete.txt
cat to_delete.txt
printf "${blue}Really delete these packages? Y or N.${normal} "
read USER_CONT
if [ "$USER_CONT" == "y" ] || [ "$USER_CONT" == "Y" ]
then
yaourt -Rsn - < to_delete.txt
fi
rm packages.txt wanted.txt to_delete.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment