archlinux.plugin.zsh 4.79 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
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
122
123


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

134
function paclist() {
135
136
137
  # 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
138
}
Benjamin Boudreau's avatar
Benjamin Boudreau committed
139

140
function pacdisowned() {
141
142
  emulate -L zsh

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

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

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

152
153
  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
154
155
156

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

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

165
function pacmansignkeys() {
166
  emulate -L zsh
167
168
169
170
171
172
173
  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
}
174
175
176
177
178
179
180
181
182
183
184
185
186

if (( $+commands[xdg-open] )); then
  function pacweb() {
    pkg="$1"
    infos="$(pacman -Si "$pkg")"
    if [[ -z "$infos" ]]; then
      return
    fi
    repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
    arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
    xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
  }
fi