archlinux.plugin.zsh 4.39 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if (( $+commands[trizen] )); then
  alias trconf='trizen -C'
  alias trupg='trizen -Syua'
  alias trsu='trizen -Syua --noconfirm'
  alias trin='trizen -S'
  alias trins='trizen -U'
  alias trre='trizen -R'
  alias trrem='trizen -Rns'
  alias trrep='trizen -Si'
  alias trreps='trizen -Ss'
  alias trloc='trizen -Qi'
  alias trlocs='trizen -Qs'
  alias trlst='trizen -Qe'
  alias trorph='trizen -Qtd'
  alias trinsd='trizen -S --asdeps'
  alias trmir='trizen -Syy'


  if (( $+commands[abs] && $+commands[aur] )); then
    alias trupd='trizen -Sy && sudo abs && sudo aur'
  elif (( $+commands[abs] )); then
    alias trupd='trizen -Sy && sudo abs'
  elif (( $+commands[aur] )); then
    alias trupd='trizen -Sy && sudo aur'
  else
    alias trupd='trizen -Sy'
  fi
fi

30
if (( $+commands[yaourt] )); then
31
32
  alias yaconf='yaourt -C'
  alias yaupg='yaourt -Syua'
33
  alias yasu='yaourt -Syua --noconfirm'
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  alias yain='yaourt -S'
  alias yains='yaourt -U'
  alias yare='yaourt -R'
  alias yarem='yaourt -Rns'
  alias yarep='yaourt -Si'
  alias yareps='yaourt -Ss'
  alias yaloc='yaourt -Qi'
  alias yalocs='yaourt -Qs'
  alias yalst='yaourt -Qe'
  alias yaorph='yaourt -Qtd'
  alias yainsd='yaourt -S --asdeps'
  alias yamir='yaourt -Syy'


48
  if (( $+commands[abs] && $+commands[aur] )); then
49
    alias yaupd='yaourt -Sy && sudo abs && sudo aur'
50
  elif (( $+commands[abs] )); then
51
    alias yaupd='yaourt -Sy && sudo abs'
52
  elif (( $+commands[aur] )); then
53
    alias yaupd='yaourt -Sy && sudo aur'
54
  else
55
    alias yaupd='yaourt -Sy'
56
  fi
Benjamin Boudreau's avatar
Benjamin Boudreau committed
57
58
fi

59
if (( $+commands[pacaur] )); then
Ning Sun's avatar
Ning Sun committed
60
61
  alias paupg='pacaur -Syu'
  alias pasu='pacaur -Syu --noconfirm'
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  alias pain='pacaur -S'
  alias pains='pacaur -U'
  alias pare='pacaur -R'
  alias parem='pacaur -Rns'
  alias parep='pacaur -Si'
  alias pareps='pacaur -Ss'
  alias paloc='pacaur -Qi'
  alias palocs='pacaur -Qs'
  alias palst='pacaur -Qe'
  alias paorph='pacaur -Qtd'
  alias painsd='pacaur -S --asdeps'
  alias pamir='pacaur -Syy'

  if (( $+commands[abs] && $+commands[aur] )); then
    alias paupd='pacaur -Sy && sudo abs && sudo aur'
  elif (( $+commands[abs] )); then
    alias paupd='pacaur -Sy && sudo abs'
  elif (( $+commands[aur] )); then
    alias paupd='pacaur -Sy && sudo aur'
  else
    alias paupd='pacaur -Sy'
  fi
fi

86
if (( $+commands[trizen] )); then
87
  function upgrade() {
88
89
90
    trizen -Syu
  }
elif (( $+commands[pacaur] )); then
91
  function upgrade() {
92
93
94
    pacaur -Syu
  }
elif (( $+commands[yaourt] )); then
95
  function upgrade() {
96
97
98
    yaourt -Syu
  }
else
99
  function upgrade() {
100
    sudo pacman -Syu
101
102
103
  }
fi

Benjamin Boudreau's avatar
Benjamin Boudreau committed
104
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
105
106
107
108
109
110
111
112
113
114
115
116
117
alias pacupg='sudo pacman -Syu'
alias pacin='sudo pacman -S'
alias pacins='sudo pacman -U'
alias pacre='sudo pacman -R'
alias pacrem='sudo pacman -Rns'
alias pacrep='pacman -Si'
alias pacreps='pacman -Ss'
alias pacloc='pacman -Qi'
alias paclocs='pacman -Qs'
alias pacinsd='sudo pacman -S --asdeps'
alias pacmir='sudo pacman -Syy'
alias paclsorphans='sudo pacman -Qdt'
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
118
alias pacfileupg='sudo pacman -Fy'
119
alias pacfiles='pacman -Fs'
120
121


122
if (( $+commands[abs] && $+commands[aur] )); then
123
  alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
124
elif (( $+commands[abs] )); then
125
  alias pacupd='sudo pacman -Sy && sudo abs'
126
elif (( $+commands[aur] )); then
127
  alias pacupd='sudo pacman -Sy && sudo aur'
128
else
129
  alias pacupd='sudo pacman -Sy'
130
fi
Benjamin Boudreau's avatar
Benjamin Boudreau committed
131

132
function paclist() {
133
134
135
  # Source: https://bbs.archlinux.org/viewtopic.php?id=93683
  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}'
Benjamin Boudreau's avatar
Benjamin Boudreau committed
136
}
Benjamin Boudreau's avatar
Benjamin Boudreau committed
137

138
function pacdisowned() {
139
140
  emulate -L zsh

Benjamin Boudreau's avatar
Benjamin Boudreau committed
141
142
143
144
145
146
147
148
149
  tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  db=$tmp/db
  fs=$tmp/fs

  mkdir "$tmp"
  trap  'rm -rf "$tmp"' EXIT

  pacman -Qlq | sort -u > "$db"

150
151
  find /bin /etc /lib /sbin /usr ! -name lost+found \
    \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
Benjamin Boudreau's avatar
Benjamin Boudreau committed
152
153
154

  comm -23 "$fs" "$db"
}
155

156
function pacmanallkeys() {
157
158
  emulate -L zsh
  curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
159
160
    awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
    xargs sudo pacman-key --recv-keys
161
162
}

163
function pacmansignkeys() {
164
  emulate -L zsh
165
166
167
168
169
170
171
  for key in $*; do
    sudo pacman-key --recv-keys $key
    sudo pacman-key --lsign-key $key
    printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
      --no-permission-warning --command-fd 0 --edit-key $key
  done
}