pt-repolist 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. pacman -Qi >./all_files
  3. if [ -z "$1" ] ; then
  4. echo -e "\033[0;37mNo repo given!"
  5. echo " usage: scriptname reponame"
  6. fi
  7. reponame=$1
  8. list=$1_list
  9. pacman -Sl $reponame >./$list
  10. sed -i "s|\$reponame |g|" ./$list
  11. repo=`cat ./$list | cut --fields 2 --delim " "`
  12. for pkg in $repo ; do
  13. if [[ $(cat ./all_files | grep -w "$pkg") ]] ; then
  14. echo -e "\033[0;34m$pkg\033[0;37m is installed"
  15. echo "$pkg" >>./installed_files
  16. elif [ "$2" == "all" ] ; then
  17. echo -e "\033[0;31m$pkg\033[0;37m is NOT installed"
  18. fi
  19. done
  20. echo
  21. echo -n "Would you like to save the names of these pkgs to a file? (Y/n) "
  22. read choice
  23. if [ "$choice" == "Y" -o "$choice" == "y" ] ; then
  24. echo "Currently in `pwd`"
  25. echo -n " Save as: "
  26. read filename
  27. if [ -z $filename ] ; then
  28. echo "No name given saved as ./installed_files_$reponame"
  29. cp -u ./installed_files ./installed_files_$reponame
  30. else
  31. cp -u ./installed_files $filename
  32. fi
  33. rm ./installed_files
  34. else
  35. rm ./installed_files
  36. fi
  37. rm ./$list ./all_files