Created
April 9, 2022 06:15
-
-
Save Mrfiregem/c94f193f4454692d60f8bf25dd3e4b6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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