archlinux.plugin.zsh 5.58 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

KeLiu's avatar
KeLiu committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
if (( $+commands[yay] )); then
  alias yaconf='yay -Pg'
  alias yaupg='yay -Syu'
  alias yasu='yay -Syu --noconfirm'
  alias yain='yay -S'
  alias yains='yay -U'
  alias yare='yay -R'
  alias yarem='yay -Rns'
  alias yarep='yay -Si'
  alias yareps='yay -Ss'
  alias yaloc='yay -Qi'
  alias yalocs='yay -Qs'
  alias yalst='yay -Qe'
  alias yaorph='yay -Qtd'
  alias yainsd='yay -S --asdeps'
  alias yamir='yay -Syy'


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

88
if (( $+commands[pacaur] )); then
Ning Sun's avatar
Ning Sun committed
89
90
  alias paupg='pacaur -Syu'
  alias pasu='pacaur -Syu --noconfirm'
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  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

115
if (( $+commands[trizen] )); then
116
  function upgrade() {
117
118
119
    trizen -Syu
  }
elif (( $+commands[pacaur] )); then
120
  function upgrade() {
121
122
123
    pacaur -Syu
  }
elif (( $+commands[yaourt] )); then
124
  function upgrade() {
125
126
    yaourt -Syu
  }
KeLiu's avatar
KeLiu committed
127
128
129
130
elif (( $+commands[yay] )); then
  function upgrade() {
    yay -Syu
  }
131
else
132
  function upgrade() {
133
    sudo pacman -Syu
134
135
136
  }
fi

Benjamin Boudreau's avatar
Benjamin Boudreau committed
137
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
138
139
140
141
142
143
144
145
146
147
148
149
150
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)'
151
alias pacfileupg='sudo pacman -Fy'
152
alias pacfiles='pacman -F'
153
154
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
155
156


157
if (( $+commands[abs] && $+commands[aur] )); then
158
  alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
159
elif (( $+commands[abs] )); then
160
  alias pacupd='sudo pacman -Sy && sudo abs'
161
elif (( $+commands[aur] )); then
162
  alias pacupd='sudo pacman -Sy && sudo aur'
163
else
164
  alias pacupd='sudo pacman -Sy'
165
fi
Benjamin Boudreau's avatar
Benjamin Boudreau committed
166

167
function paclist() {
168
169
170
  # 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
171
}
Benjamin Boudreau's avatar
Benjamin Boudreau committed
172

173
function pacdisowned() {
174
  local tmp db fs
Benjamin Boudreau's avatar
Benjamin Boudreau committed
175
176
177
178
179
  tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  db=$tmp/db
  fs=$tmp/fs

  mkdir "$tmp"
180
  trap 'rm -rf "$tmp"' EXIT
Benjamin Boudreau's avatar
Benjamin Boudreau committed
181
182
183

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

184
185
  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
186
187
188

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

190
function pacmanallkeys() {
191
192
  curl -sL https://www.archlinux.org/people/{developers,trusted-users}/ | \
    awk -F\" '(/keyserver.ubuntu.com/) { sub(/.*search=0x/,""); print $1}' | \
193
    xargs sudo pacman-key --recv-keys
194
195
}

196
function pacmansignkeys() {
197
198
  local key
  for key in $@; do
199
200
201
202
203
204
    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
}
205
206
207

if (( $+commands[xdg-open] )); then
  function pacweb() {
208
209
    local pkg="$1"
    local infos="$(LANG=C pacman -Si "$pkg")"
210
211
212
    if [[ -z "$infos" ]]; then
      return
    fi
213
214
    local repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
    local arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
215
216
217
    xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
  }
fi