misc-scripts/xbps-clean

17 lines
309 B
Bash
Executable File

#!/bin/sh
while getopts :d OPT; do
case "$OPT" in
d) DEL=1 ;;
*) echo "invalid option: -$OPTARG" && exit 1 ;;
esac
done
for x in /var/cache/xbps/*.xbps; do
xbps-query "$(xbps-uhelper binpkgver "$x")" 1>/dev/null 2>&1
if [ $? -eq 2 ]; then
echo "${x%.*}"
[ -n "$DEL" ] && rm "${x%.*}".*
fi
done