-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinit.zsh
145 lines (105 loc) · 3.23 KB
/
init.zsh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#
# Pacman aliases
#
# The zpacman_frontend is _only_ used for package installs.
#
# Setup
#
# ensure pacman is available
if (( ! ${+commands[pacman]} )); then
return 1
fi
if ! zstyle -s ':zim:pacman' priv_cmd 'zpriv_cmd'; then
zpriv_cmd=sudo
elif [[ ${zpriv_cmd} != (sudo|doas) ]]; then
print -u2 "Privilege command \"${zpriv_cmd}\" is invalid. Reverting to \"sudo\"."
zpriv_cmd=sudo
elif (( ! ${+commands[${zpriv_cmd}]} )); then
print -u2 "Privilege command \"${zpriv_cmd}\" is not installed. Reverting to \"sudo\"."
zpriv_cmd=sudo
fi
if ! zstyle -s ':zim:pacman' frontend 'zpacman_frontend'; then
zpacman_frontend=pacman
zpacman_frontend_priv="${zpriv_cmd} pacman"
elif (( ! ${+commands[${zpacman_frontend}]} )); then
print -u2 "pacman frontend \"${zpacman_frontend}\" is invalid or not installed. Reverting to \"pacman\"."
zpacman_frontend=pacman
zpacman_frontend_priv="${zpriv_cmd} pacman"
elif [[ ${zpacman_frontend} == (pacaur|pikaur|yaourt|yay) ]]; then
# those AUR helpers handle SUID themselves
zpacman_frontend_priv=${zpacman_frontend}
else
zpacman_frontend_priv="${zpriv_cmd} ${zpacman_frontend}"
fi
#
# General
#
alias pac=${zpacman_frontend}
#
# Build
#
# build package in current directory, cleanup, and install
alias pacb='makepkg -sci'
#
# Install
#
#NOTE: Installing/upgrading individual packages is NOT supported. Sync and upgrade ALL on install.
# install, sync, and upgrade packages
alias paci="${zpacman_frontend_priv} -Syu"
# install packages without syncing
alias pacI="${zpacman_frontend_priv} -S"
# install, sync, and upgrade packages (forcibly refresh package lists)
alias pacu="${zpacman_frontend_priv} -Syyu"
# install packages by filename
alias pacU="${zpacman_frontend_priv} -U"
# install all packages in current directory
alias pacd="${zpacman_frontend_priv} -U *.pkg.*"
#
# Remove
#
# remove package and unneeded dependencies
alias pacr="${zpacman_frontend_priv} -R"
# remove package, unneeded dependencies, and configuration files
alias pacrm="${zpacman_frontend_priv} -Rns"
#
# Query
#
# query package information from the remote repository
alias pacq="${zpacman_frontend} -Si"
# query package information from the local repository
alias pacQ="${zpacman_frontend} -Qi"
#
# Search
#
# search for package in the remote repository
alias pacs="${zpacman_frontend} -Ss"
# search for the package in the local repository
alias pacS="${zpacman_frontend} -Qs"
#
# Orphans
#
# list orphan packages
alias pacol="${zpacman_frontend} -Qdt"
# remove orphan packages
alias pacor="${zpacman_frontend_priv} -Rns \$(pacman -Qtdq)"
#
# Ownership
#
# list all files that belong to a package
alias pacown="${zpacman_frontend} -Ql"
# show package(s) owning the specified file
alias pacblame="${zpacman_frontend} -Qo"
#
# Helpers
#
# source helper functions/aliases
zstyle -a ':zim:pacman' helpers 'zpacman_helpers'
for zpacman_helper in ${zpacman_helpers}; do
if [[ -s ${0:h}/helper_${zpacman_helper}.zsh ]]; then
source ${0:h}/helper_${zpacman_helper}.zsh
else
print -u2 "no such helper script \"${0:h}/helper_${zpacman_helper}.zsh\""
fi
done
# cannot use anon function, with local variables, because we're evaluating ${0}
unset zpriv_cmd zpacman_frontend zpacman_frontend_priv zpacman_helper zpacman_helpers