archlinux.plugin.zsh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 (( $+commands[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 -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) 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. alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
  21. alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
  22. # Additional yaourt alias examples
  23. if (( $+commands[abs] && $+commands[aur] )); then
  24. alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
  25. elif (( $+commands[abs] )); then
  26. alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
  27. elif (( $+commands[aur] )); then
  28. alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
  29. else
  30. alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
  31. fi
  32. alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
  33. alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
  34. else
  35. upgrade() {
  36. sudo pacman -Syu
  37. }
  38. fi
  39. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  40. alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
  41. alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
  42. alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
  43. alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
  44. alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
  45. alias pacrep='pacman -Si' # Display information about a given package in the repositories
  46. alias pacreps='pacman -Ss' # Search for package(s) in the repositories
  47. alias pacloc='pacman -Qi' # Display information about a given package in the local database
  48. alias paclocs='pacman -Qs' # Search for package(s) in the local database
  49. # Additional pacman alias examples
  50. if (( $+commands[abs] && $+commands[aur] )); then
  51. alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
  52. elif (( $+commands[abs] )); then
  53. alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
  54. elif (( $+commands[aur] )); then
  55. alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
  56. else
  57. alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
  58. fi
  59. alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
  60. alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
  61. # https://bbs.archlinux.org/viewtopic.php?id=93683
  62. paclist() {
  63. LC_ALL=C pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
  64. }
  65. alias paclsorphans='sudo pacman -Qdt'
  66. alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
  67. pacdisowned() {
  68. tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  69. db=$tmp/db
  70. fs=$tmp/fs
  71. mkdir "$tmp"
  72. trap 'rm -rf "$tmp"' EXIT
  73. pacman -Qlq | sort -u > "$db"
  74. find /bin /etc /lib /sbin /usr \
  75. ! -name lost+found \
  76. \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
  77. comm -23 "$fs" "$db"
  78. }
  79. pacmanallkeys() {
  80. # Get all keys for developers and trusted users
  81. curl https://www.archlinux.org/{developers,trustedusers}/ |
  82. awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
  83. xargs sudo pacman-key --recv-keys
  84. }
  85. pacmansignkeys() {
  86. for key in $*; do
  87. sudo pacman-key --recv-keys $key
  88. sudo pacman-key --lsign-key $key
  89. printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
  90. --no-permission-warning --command-fd 0 --edit-key $key
  91. done
  92. }