-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathzypper.sh
More file actions
189 lines (157 loc) · 2.91 KB
/
Copy pathzypper.sh
File metadata and controls
189 lines (157 loc) · 2.91 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/env sh
# Purpose: OpenSUSE support
# Author : Anh K. Huynh
# License: Fair license (http://www.opensource.org/licenses/fair)
# Source : http://github.com/icy/pacapt/
# Copyright (C) 2010 - 2014 Anh K. Huynh
#
# 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.
_zypper_init() {
:
}
zypper_Qc() {
rpm -q --changelog "$@"
}
zypper_Qi() {
zypper info "$@"
}
zypper_Ql() {
rpm -ql "$@"
}
zypper_Qu() {
zypper list-updates "$@"
}
zypper_Qm() {
zypper search -si "$@" \
| grep 'System Packages'
}
zypper_Qo() {
if cmd="$(command -v -- "$@")"; then
rpm -qf "$cmd"
else
rpm -qf "$@"
fi
}
zypper_Qp() {
rpm -qip "$@"
}
zypper_Qs() {
zypper search --search-descriptions --installed-only "$@" \
| {
if [ "$_TOPT" = "q" ]; then
awk -F ' *| *' '/^[a-z]/ {print $3}'
else
cat
fi
}
}
zypper_Q() {
if [ "$_TOPT" = "q" ]; then
zypper search -i "$@" \
| grep ^i \
| awk '{print $3}'
elif [ -z "$_TOPT" ]; then
zypper search -i "$@"
else
_not_implemented
fi
}
zypper_Rs() {
if [ "$_TOPT" = "s" ]; then
zypper remove "$@" --clean-deps
else
_not_implemented
fi
}
zypper_R() {
zypper remove "$@"
}
zypper_Rn() {
# Remove configuration files
rpm -ql "$@" \
| while read -r file; do
if [ -f "$file" ]; then
rm -fv "$file"
fi
done
# Now remove the package per-se
zypper remove "$@"
}
zypper_Rns() {
# Remove configuration files
rpm -ql "$@" \
| while read -r file; do
if [ -f "$file" ]; then
rm -fv "$file"
fi
done
zypper remove "$@" --clean-deps
}
zypper_Suy() {
zypper dup "$@"
}
zypper_Sy() {
zypper refresh "$@"
}
zypper_Sl() {
if [ $# -eq 0 ]; then
zypper pa -R
else
zypper pa -r "$@"
fi
}
zypper_Sg() {
if [ $# -gt 0 ]; then
zypper info "$@"
else
zypper patterns
fi
}
zypper_Ss() {
zypper search "$@"
}
zypper_Su() {
zypper --no-refresh dup "$@"
}
zypper_Sc() {
zypper clean "$@"
}
zypper_Scc() {
zypper clean "$@"
}
zypper_Sccc() {
# Not way to do this in zypper
_not_implemented
}
zypper_Si() {
zypper info --requires "$@"
}
zypper_Sii() {
if [ $# -eq 0 ]; then
_error "Missing some package name."
return 1
fi
_not_implemented
return
# TOO SLOW ! # # Ugly and slow, but does the trick
# TOO SLOW ! # local_packages="$( \
# TOO SLOW ! # zypper pa --installed-only -R \
# TOO SLOW ! # | grep -E '^[a-z]' \
# TOO SLOW ! # | cut -d \| -f 3 | sort -u)"
# TOO SLOW ! #
# TOO SLOW ! # for package in $local_packages; do
# TOO SLOW ! # zypper info --requires "$package" \
# TOO SLOW ! # | grep -q "$@" && echo "$package"
# TOO SLOW ! # done
}
zypper_S() {
# shellcheck disable=SC2086
zypper install $_TOPT "$@"
}
zypper_U() {
zypper install "$@"
}