-
Notifications
You must be signed in to change notification settings - Fork 69
/
cave.sh
162 lines (137 loc) · 2.78 KB
/
cave.sh
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env bash
# Purpose: Gentoo (+ Paludis) / Exherbo support
# Author : Somasis <[email protected]>
# License: Fair license (http://www.opensource.org/licenses/fair)
# Source : http://github.com/somasis/pacapt/
# Copyright (C) 2014 Somasis
#
# Usage of the works is permitted provided that this instrument is
# retained with the works, so that any entity that uses the works is
# notified of this instrument.
#
# DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
# cave uses asterisks pretty liberally, this is for output parsing correctness
# FIXME: This is the only thing we can't port this script to POSIX
_cave_init() {
shopt -u globstar
}
cave_Q() {
if [ "$_TOPT" = "q" ]; then
cave show -f "${@:-world}" \
| grep -v '^$'
else
cave show -f "${@:-world}"
fi
}
cave_Qi() {
cave show "$@"
}
cave_Ql() {
if [ $# -ge 1 ]; then
cave contents "$@"
return
fi
cave show -f "${@:-world}" \
| grep -v '^$' \
| while read -r _pkg; do
if [ "$_TOPT" = "q" ]; then
cave --color no contents "$_pkg"
else
cave contents "$_pkg"
fi
done
}
cave_Qo() {
if cmd="$(command -v -- "$@")"; then
cave owner "$cmd"
else
cave owner "$@"
fi
}
cave_Qp() {
_not_implemented
}
cave_Qu() {
if [ $# -eq 0 ];then
cave resolve -c world \
| grep '^u.*' \
| while read -r _pkg; do
echo "$_pkg" | cut -d'u' -f2-
done
else
cave resolve -c world \
| grep '^u.*' \
| grep -- "$@"
fi
}
cave_Qs() {
cave show -f world | grep -- "$@"
}
cave_Rs() {
if [ -z "$_TOPT" ]; then
cave uninstall -r "$@" \
&& echo "Control-C to stop uninstalling..." \
&& sleep 2s \
&& cave uninstall -xr "$@"
else
cave purge "$@" \
&& echo "Control-C to stop uninstalling (+ dependencies)..." \
&& sleep 2s \
&& cave purge -x "$@"
fi
}
cave_Rn() {
_not_implemented
}
cave_Rns() {
_not_implemented
}
cave_R() {
cave uninstall "$@" \
&& echo "Control-C to stop uninstalling..." \
&& sleep 2s \
&& cave uninstall -x "$@"
}
cave_Si() {
cave show "$@"
}
cave_Suy() {
cave sync && cave resolve -c "${@:-world}" \
&& echo "Control-C to stop upgrading..." \
&& sleep 2s \
&& cave resolve -cx "${@:-world}"
}
cave_Su() {
cave resolve -c "$@" \
&& echo "Control-C to stop upgrading..." \
&& sleep 2s \
&& cave resolve -cx "$@"
}
cave_Sy() {
cave sync "$@"
}
cave_Ss() {
cave search "$@"
}
cave_Sc() {
cave fix-cache "$@"
}
cave_Scc() {
cave fix-cache "$@"
}
# cave_Sccc _not_implemented
cave_Sccc() {
#rm -fv /var/cache/paludis/*
_not_implemented
}
cave_S() {
# shellcheck disable=SC2086
cave resolve $_TOPT "$@" \
&& echo "Control-C to stop installing..." \
&& sleep 2s \
&& cave resolve -x $_TOPT "$@"
}
# cave_U _not_implemented
cave_U() {
_not_implemented
}