blob: 5edcbf7a705633c2673db40ac06e55ef54b3bc88 (
plain) (
blame)
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
#compdef fwupdmgr
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for fwupdmgr 1.2.9 (https://github.com/hughsie/fwupd).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
_fwupdmgr() {
local context state state_descr line
typeset -A opt_args
_arguments -C \
'(- : *)'{-h,--help}'[display help information]' \
'(- : *)'{-v,--version}'[display version information]' \
{-v,--verbose}'[show extra debugging information]' \
--offline'[schedule installation for next reboot when possible]' \
--allow-reinstall'[allow re-installing existing firmware versions]' \
--allow-older'[allow downgrading firmware versions]' \
--force'[override warnings and force the action]' \
'(-y, --assume-yes)'{-y,--assume-yes}'[answer yes to all questions]' \
--sign'[sign the uploaded data with the client certificate]' \
--no-unreported-check'[do not check for unreported history]' \
--no-metadata-check'[do not check for old metadata]' \
--no-reboot-check'[do not check for reboot after update]' \
--no-history'[do not write to the history database]' \
--show-all-devices'[show devices that are not updatable]' \
'(-): :->command' \
'(-)*:: :->arguments' \
&& ret=0
case $state in
(command)
_fwupdmgr_commands
;;
(arguments)
curcontext=${curcontext%:*:*}:fwupdmgr-$words[1]:
if (( $+functions[_fwupdmgr_${words[1]}_args] )); then
_fwupdmgr_${words[1]}_args
else
_message "unknown command ${words[1]}" && ret=1
fi
;;
(*)
_message "unknown state $state" && ret=1
;;
esac
}
(( $+functions[_fwupdmgr_commands] )) ||
_fwupdmgr_commands() {
local commands=(
'activate:activate devices'
'clear-history:erase all firmware update history'
'clear-offline:clears any updates scheduled to be updated offline'
'clear-results:clears the results from the last update'
'disable-remote:disables a given remote'
'downgrade:downgrades the firmware on a device'
'enable-remote:enables a given remote'
'get-approved-firmware:gets the list of approved firmware'
'get-details:gets details about a firmware file'
'get-devices:get all devices that support firmware updates'
'get-history:show history of firmware updates'
'get-releases:gets the releases for a device'
'get-remotes:gets the configured remotes'
'get-results:gets the results from the last update'
'get-topology:get all devices according to the system topology'
'get-updates:gets the list of updates for connected hardware'
'install:install a firmware file on this hardware'
'modify-config:modifies a daemon configuration value'
'modify-remote:modifies a given remote'
'refresh:refresh metadata from remote server'
'report-history:share firmware history with the developers'
'set-approved-firmware:sets the list of approved firmware'
'unlock:unlocks the device for firmware access'
'update:updates all firmware to latest versions available'
'verify:gets the cryptographic hash of the dumped firmware'
'verify-update:update the stored metadata with current ROM contents'
)
_describe -t commands commands commands
}
(( $+functions[_fwupdmgr_activate_args] )) ||
_fwupdmgr_activate_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_clear-history_args] )) ||
_fwupdmgr_clear-history_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_clear-results_args] )) ||
_fwupdmgr_clear-results_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_disable-remote_args] )) ||
_fwupdmgr_disable-remote_args() {
_arguments -C \
'1: :_fwupdmgr_remote_ids'
}
(( $+functions[_fwupdmgr_downgrade_args] )) ||
_fwupdmgr_downgrade_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_enable-remote_args] )) ||
_fwupdmgr_enable-remote_args() {
_arguments -C \
'1: :_fwupdmgr_remote_ids'
}
(( $+functions[_fwupdmgr_get-approved-firmware_args] )) ||
_fwupdmgr_get-approved-firmware_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_get-details_args] )) ||
_fwupdmgr_get-details_args() {
_files
}
(( $+functions[_fwupdmgr_get-devices_args] )) ||
_fwupdmgr_get-devices_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_get-history_args] )) ||
_fwupdmgr_get-history_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_get-releases_args] )) ||
_fwupdmgr_get-releases_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_get-remotes_args] )) ||
_fwupdmgr_get-remotes_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_get-results_args] )) ||
_fwupdmgr_get-results_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_get-topology_args] )) ||
_fwupdmgr_get-topology_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_get-updates_args] )) ||
_fwupdmgr_get-updates_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_install_args] )) ||
_fwupdmgr_install_args() {
_arguments -C \
'1: :_files' \
'2: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_TODO_args] )) ||
_fwupdmgr_TODO_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_modify-config_args] )) ||
_fwupdmgr_modify-config_args() {
local ret=1
if compset -P '*,'; then
_wanted config-value expl 'config value' _fwupdmgr_config_values ${IPREFIX%=} && ret=0
else
_wanted config-key expl 'config key' _fwupdmgr_config_keys -qS, && ret=0
fi
return ret
}
(( $+functions[_fwupdmgr_modify-remote_args] )) ||
_fwupdmgr_modify-remote_args() {
_arguments -C \
'1: :_fwupdmgr_remote_ids' \
'2: :_fwupdmgr_remote_keys' \
'3: :_fwupdmgr_remote_values'
}
(( $+functions[_fwupdmgr_refresh_args] )) ||
_fwupdmgr_refresh_args() {
_arguments -C \
'1: :_files' \
'2:file signature:' \
'3: :_fwupdmgr_remote_ids'
}
(( $+functions[_fwupdmgr_report-history_args] )) ||
_fwupdmgr_report-history_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_set-approved-firmware_args] )) ||
_fwupdmgr_set-approved-firmware_args() {
_message 'checksum' && ret=0
}
(( $+functions[_fwupdmgr_unlock_args] )) ||
_fwupdmgr_unlock_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_update_args] )) ||
_fwupdmgr_update_args() {
_message 'no more arguments' && ret=0
}
(( $+functions[_fwupdmgr_verify_args] )) ||
_fwupdmgr_verify_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_verify-update_args] )) ||
_fwupdmgr_verify-update_args() {
_arguments -C \
'1: :_fwupdmgr_device_ids'
}
(( $+functions[_fwupdmgr_device_ids] )) ||
_fwupdmgr_device_ids() {
# TODO add device name as description
local devices=($(_call_program devices fwupdmgr get-devices | grep -Po 'DeviceId:\s+\K(.*)'))
_describe -t devices 'device ID' devices
}
(( $+functions[_fwupdmgr_remote_ids] )) ||
_fwupdmgr_remote_ids() {
# TODO add remote description
local remotes=($(_call_program remotes fwupdmgr get-remotes | grep -Po 'Remote ID:\s+\K(.*)'))
_describe -t remotes 'remote ID' remotes
}
(( $+functions[_fwupdmgr_checksums] )) ||
_fwupdmgr_checksums() {
_guard '[^\-]#' 'checksum'
}
(( $+functions[_fwupdmgr_config_keys] )) ||
_fwupdmgr_config_keys() {
_guard '[^\-]#' 'config key'
}
(( $+functions[_fwupdmgr_config_values] )) ||
_fwupdmgr_config_values() {
_guard '[^\-]#' 'config value'
}
(( $+functions[_fwupdmgr_remote_keys] )) ||
_fwupdmgr_remote_keys() {
_guard '[^\-]#' 'remote key'
}
(( $+functions[_fwupdmgr_remote_values] )) ||
_fwupdmgr_remote_values() {
_guard '[^\-]#' 'remote value'
}
_fwupdmgr "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
|