Skip to content

Instantly share code, notes, and snippets.

@Mrfiregem
Created April 9, 2022 06:15
Show Gist options
  • Save Mrfiregem/c94f193f4454692d60f8bf25dd3e4b6c to your computer and use it in GitHub Desktop.
Save Mrfiregem/c94f193f4454692d60f8bf25dd3e4b6c to your computer and use it in GitHub Desktop.
#!/bin/sh
repo=${RCREPOPATH:-/usr/local/repo/custom/custom.db.tar.gz}
repo_name=$(echo "$repo" | awk -F '/' '{print $(NF-1)}')
list=$(pacman -Sl "$repo_name" | sed '/\[installed\]/d' | cut -d ' ' -f 2)
if [ -n "$list" ]; then
printf 'Remove packages: %s? [Y/n]: ' "$list"
read -r ans
case "$ans" in
[yY]*|'')
printf '%s\n' "$list" | xargs repo-remove -s "$repo"
;;
*)
exit 1
;;
esac
else
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment