archlinux.plugin.zsh 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Archlinux zsh aliases and functions
  2. # Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
  3. # Look for yaourt, and add some useful functions if we have it.
  4. if [[ -x `which yaourt` ]]; then
  5. upgrade () {
  6. yaourt -Syu
  7. }
  8. alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
  9. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  10. alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
  11. alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
  12. alias yain='yaourt -S' # Install specific package(s) from the repositories
  13. alias yains='yaourt -U' # Install specific package not from the repositories but from a file
  14. alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
  15. alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
  16. alias yarep='yaourt -Si' # Display information about a given package in the repositories
  17. alias yareps='yaourt -Ss' # Search for package(s) in the repositories
  18. alias yaloc='yaourt -Qi' # Display information about a given package in the local database
  19. alias yalocs='yaourt -Qs' # Search for package(s) in the local database
  20. # Additional yaourt alias examples
  21. if [[ -x `which abs` ]]; then
  22. alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
  23. else
  24. alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories
  25. fi
  26. alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
  27. alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
  28. else
  29. upgrade() {
  30. sudo pacman -Syu
  31. }
  32. fi
  33. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  34. alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
  35. alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
  36. alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
  37. alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
  38. alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
  39. alias pacrep='pacman -Si' # Display information about a given package in the repositories
  40. alias pacreps='pacman -Ss' # Search for package(s) in the repositories
  41. alias pacloc='pacman -Qi' # Display information about a given package in the local database
  42. alias paclocs='pacman -Qs' # Search for package(s) in the local database
  43. # Additional pacman alias examples
  44. if [[ -x `which abs` ]]; then
  45. alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
  46. else
  47. alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories
  48. fi
  49. alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
  50. alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
  51. # https://bbs.archlinux.org/viewtopic.php?id=93683
  52. paclist() {
  53. sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
  54. }
  55. alias paclsorphans='sudo pacman -Qdt'
  56. alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
  57. pacdisowned() {
  58. tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  59. db=$tmp/db
  60. fs=$tmp/fs
  61. mkdir "$tmp"
  62. trap 'rm -rf "$tmp"' EXIT
  63. pacman -Qlq | sort -u > "$db"
  64. find /bin /etc /lib /sbin /usr \
  65. ! -name lost+found \
  66. \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
  67. comm -23 "$fs" "$db"
  68. }
  69. pacmanallkeys() {
  70. # Get all keys for developers and trusted users
  71. curl https://www.archlinux.org/{developers,trustedusers}/ |
  72. awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
  73. xargs sudo pacman-key --recv-keys
  74. }
  75. pacmansignkeys() {
  76. for key in $*; do
  77. sudo pacman-key --recv-keys $key
  78. sudo pacman-key --lsign-key $key
  79. printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
  80. --no-permission-warning --command-fd 0 --edit-key $key
  81. done
  82. }