Add pacman-cleaner script

This commit is contained in:
2021-10-17 20:43:28 +03:00
parent 05ac06090d
commit 8946d03003

26
bin/pacman-cleaner Executable file
View File

@@ -0,0 +1,26 @@
#! /bin/bash
packages=$(pacman -Qqe)
packagesToDelete=()
_GREEN=$(tput setaf 2)
_RED=$(tput setaf 1)
_RESET=$(tput sgr0)
for package in ${packages[@]}
do
description=`pacman -Qi $package | grep -i description | awk -F: '{ print $2 }'`
echo "${_GREEN}$package${_RESET} - $description"
read -p "${_RED}Delete it? (y/N)${_RESET}: " yes
if [ "$yes" == "Y" -o "$yes" == "y" ] ; then
packagesToDelete+=("$package")
echo "Added $package to list of packages to delete"
else
echo "Ok, skipping"
fi
done
sudo pacman -Rs ${packagesToDelete[@]}