xolo-server 1.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/client/xolo +182 -82
- data/lib/xolo/core/base_classes/title.rb +261 -20
- data/lib/xolo/core/base_classes/version.rb +53 -8
- data/lib/xolo/core/constants.rb +7 -3
- data/lib/xolo/core/security_cmd.rb +128 -0
- data/lib/xolo/core/version.rb +1 -1
- data/lib/xolo/core.rb +1 -0
- data/lib/xolo/server/app.rb +7 -0
- data/lib/xolo/server/configuration.rb +243 -37
- data/lib/xolo/server/constants.rb +10 -0
- data/lib/xolo/server/helpers/auth.rb +19 -2
- data/lib/xolo/server/helpers/autopkg.rb +170 -0
- data/lib/xolo/server/helpers/client_data.rb +91 -61
- data/lib/xolo/server/helpers/file_transfers.rb +412 -82
- data/lib/xolo/server/helpers/jamf_pro.rb +30 -7
- data/lib/xolo/server/helpers/log.rb +2 -0
- data/lib/xolo/server/helpers/maintenance.rb +1 -0
- data/lib/xolo/server/helpers/notification.rb +4 -3
- data/lib/xolo/server/helpers/pkg_signing.rb +16 -12
- data/lib/xolo/server/helpers/progress_streaming.rb +9 -12
- data/lib/xolo/server/helpers/subscriptions.rb +119 -0
- data/lib/xolo/server/helpers/titles.rb +27 -3
- data/lib/xolo/server/helpers/versions.rb +23 -11
- data/lib/xolo/server/mixins/changelog.rb +9 -16
- data/lib/xolo/server/mixins/title_jamf_access.rb +395 -383
- data/lib/xolo/server/mixins/title_ted_access.rb +29 -3
- data/lib/xolo/server/mixins/version_jamf_access.rb +185 -159
- data/lib/xolo/server/mixins/version_ted_access.rb +25 -0
- data/lib/xolo/server/object_locks.rb +2 -1
- data/lib/xolo/server/routes/auth.rb +2 -2
- data/lib/xolo/server/routes/jamf_pro.rb +11 -1
- data/lib/xolo/server/routes/maint.rb +2 -1
- data/lib/xolo/server/routes/subscriptions.rb +126 -0
- data/lib/xolo/server/routes/title_editor.rb +1 -1
- data/lib/xolo/server/routes/titles.rb +30 -17
- data/lib/xolo/server/routes/uploads.rb +0 -14
- data/lib/xolo/server/routes/versions.rb +22 -17
- data/lib/xolo/server/routes.rb +9 -0
- data/lib/xolo/server/title.rb +107 -78
- data/lib/xolo/server/tmp_overrides.rb +38 -0
- data/lib/xolo/server/version.rb +193 -15
- data/lib/xolo/server.rb +12 -0
- metadata +8 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5762b1b18f24e90927cac0c748c873b32150a55e5037d1e3db4792c93bb79e82
|
|
4
|
+
data.tar.gz: 5a068566e8e4c28687a26493d29a7c9506ce2247e1cd846fb1a8768d4833fdd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afbc831c4e4662ccd04ef70f5cf8eef8511a65e2138b220dd74cd53efa45596b566b7dec7b3ccce0c73f9bcfbb61d444f913457ba62cb94b8a497927fcf4180d
|
|
7
|
+
data.tar.gz: 0cadf36f4e99a2ba8f394228bbb9cb131bd9d8b80179313528f6c4f6a8130b4581c32637646cc6cea6166d3d552ba0c44862b478ae2e0e87c5c917ab7cd0bc17
|
data/data/client/xolo
CHANGED
|
@@ -14,9 +14,12 @@
|
|
|
14
14
|
zmodload zsh/zutil
|
|
15
15
|
|
|
16
16
|
# for perl-style regexps
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
17
|
+
#
|
|
18
|
+
# DISABLED FOR NOW - macOS before 15 Sequoia doesn't have the pcre module,
|
|
19
|
+
# and we want to support 14 Sonoma for now.
|
|
20
|
+
# The file required is /usr/lib/zsh/5.9/zsh/pcre.so
|
|
21
|
+
#
|
|
22
|
+
# Until then, all our regexps now use posix style
|
|
20
23
|
#
|
|
21
24
|
# setopt RE_MATCH_PCRE
|
|
22
25
|
|
|
@@ -37,10 +40,10 @@ export LC_ALL="en_US.UTF-8"
|
|
|
37
40
|
XOLO_VERSION="0.0.0"
|
|
38
41
|
|
|
39
42
|
# The usage message for xolo
|
|
40
|
-
USAGE='xolo [options] <command> [
|
|
43
|
+
USAGE='xolo [options] <command> [ title1[=version1] [ title2[=version2] ... ]]'
|
|
41
44
|
|
|
42
45
|
# The URL for more information about xolo
|
|
43
|
-
XOLO_DOX_URL='
|
|
46
|
+
XOLO_DOX_URL='https://pixaranimationstudios.github.io/xolo-home/'
|
|
44
47
|
|
|
45
48
|
# The long path to the lsregister command
|
|
46
49
|
LSREG='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
|
|
@@ -51,9 +54,34 @@ JAMF='/usr/local/bin/jamf'
|
|
|
51
54
|
# The path to the client data json file
|
|
52
55
|
CLIENT_DATA_JSON_FILE="/Library/Application Support/xolo/client-data.json"
|
|
53
56
|
|
|
57
|
+
# The path to the test client data json file, from a text xolo server
|
|
58
|
+
TEST_CLIENT_DATA_JSON_FILE="/Library/Application Support/xolo/test-client-data.json"
|
|
59
|
+
|
|
54
60
|
# The jamf policy trigger to update the client data
|
|
55
61
|
UPDATE_CLIENT_DATA_TRIGGER='update-xolo-client-data'
|
|
56
62
|
|
|
63
|
+
# The jamf policy trigger to update the test client data
|
|
64
|
+
TEST_UPDATE_CLIENT_DATA_TRIGGER='test-update-xolo-client-data'
|
|
65
|
+
|
|
66
|
+
# In the CLI args, titles and versions are separated by the first
|
|
67
|
+
# occurrence of the equals sign
|
|
68
|
+
TITLE_VERSION_SEPARATOR='='
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# These commands must be run as root
|
|
72
|
+
ROOT_COMMANDS=(
|
|
73
|
+
install
|
|
74
|
+
i
|
|
75
|
+
uninstall
|
|
76
|
+
u
|
|
77
|
+
update
|
|
78
|
+
U
|
|
79
|
+
refresh
|
|
80
|
+
r
|
|
81
|
+
expire
|
|
82
|
+
e
|
|
83
|
+
)
|
|
84
|
+
|
|
57
85
|
# GLOBAL VARIABLES
|
|
58
86
|
###############################
|
|
59
87
|
###############################
|
|
@@ -63,13 +91,13 @@ UPDATE_CLIENT_DATA_TRIGGER='update-xolo-client-data'
|
|
|
63
91
|
# options
|
|
64
92
|
show_help=
|
|
65
93
|
be_verbose=
|
|
66
|
-
be_quiet=
|
|
67
94
|
debugging_on=
|
|
68
95
|
no_versions=
|
|
69
96
|
show_xolo_version=
|
|
70
97
|
|
|
71
98
|
# arguments
|
|
72
99
|
command=
|
|
100
|
+
targets=
|
|
73
101
|
title=
|
|
74
102
|
version=
|
|
75
103
|
|
|
@@ -92,10 +120,18 @@ function die() {
|
|
|
92
120
|
local mystat=1
|
|
93
121
|
|
|
94
122
|
[[ -n "$2" ]] && mystat=$2
|
|
95
|
-
echoerr "$msg"
|
|
123
|
+
echoerr "ERROR: $msg"
|
|
96
124
|
exit $mystat
|
|
97
125
|
}
|
|
98
126
|
|
|
127
|
+
# Die if not root and the command being run is in the list of root commands
|
|
128
|
+
#################################
|
|
129
|
+
function must_be_root() {
|
|
130
|
+
if (( $ROOT_COMMANDS[(Ie)$command] )); then
|
|
131
|
+
[[ $EUID -ne 0 ]] && die "You must be root to use the '$command' command."
|
|
132
|
+
fi
|
|
133
|
+
return 0
|
|
134
|
+
}
|
|
99
135
|
|
|
100
136
|
# Show the help message
|
|
101
137
|
###############################
|
|
@@ -109,8 +145,12 @@ Usage:
|
|
|
109
145
|
Options:
|
|
110
146
|
-h, -H, --help: Show this help message.
|
|
111
147
|
-v, --verbose: Enable verbose mode, extra information will be printed.
|
|
112
|
-
-q, --quiet: Enable quiet mode, only errors will be printed to stderr.
|
|
113
148
|
-d, --debug: Enable debug mode, extra debug information will be printed.
|
|
149
|
+
Implies --verbose.
|
|
150
|
+
-t, --test If your site has a "test" xolo server running via the same
|
|
151
|
+
Jamf Pro server, this causes 'xolo' to only see data, titles,
|
|
152
|
+
policies, etc, from test xolo server, not the production server.
|
|
153
|
+
Setting the XOLO_TEST_MODE env. variable does the same thing.
|
|
114
154
|
-r, --recon: With 'install' or 'uninstall' run a 'jamf recon' after the
|
|
115
155
|
operation completes successfully.
|
|
116
156
|
-n, --no-versions: With the 'list-titles' and 'list-installed' commands,
|
|
@@ -118,15 +158,12 @@ Options:
|
|
|
118
158
|
installed, respectively.
|
|
119
159
|
-V, --version: Show the version of xolo.
|
|
120
160
|
|
|
121
|
-
NOTE: Debug mode will also enable verbose mode. Both debug and verbose modes
|
|
122
|
-
override quiet mode.
|
|
123
|
-
|
|
124
161
|
Commands:
|
|
125
|
-
install, i <title> [<
|
|
162
|
+
install, i <title>[=<version>] [<title2>[=<version2>] ...]
|
|
126
163
|
Install a title, or specific version thereof (e.g. a version currently in pilot)
|
|
127
164
|
If no version is specified, the currently released version will be installed.
|
|
128
165
|
|
|
129
|
-
uninstall, u <title>
|
|
166
|
+
uninstall, u <title> [<title2> ...]
|
|
130
167
|
Uninstall a title, if possible. Not all titles are uninstallable via xolo.
|
|
131
168
|
|
|
132
169
|
update, U
|
|
@@ -150,8 +187,10 @@ Commands:
|
|
|
150
187
|
a few moments, since all titles with version scripts will run those scripts
|
|
151
188
|
to see if they are installed.
|
|
152
189
|
|
|
153
|
-
details, d <title> [<
|
|
154
|
-
Show detailed information about
|
|
190
|
+
details, d <title>[=<version>] [<title2>[=<version2>] ...]
|
|
191
|
+
Show detailed information about titles, or a specific versions thereof.
|
|
192
|
+
Note that titles and versions contain different sets of information, so the output
|
|
193
|
+
will differ depending on what you specify.
|
|
155
194
|
|
|
156
195
|
expire, e
|
|
157
196
|
Expire the given title if it has not been used in its defined expiration period.
|
|
@@ -161,6 +200,26 @@ Commands:
|
|
|
161
200
|
help, h
|
|
162
201
|
Show this help message. The same as -h or --help.
|
|
163
202
|
|
|
203
|
+
Examples:
|
|
204
|
+
xolo install transmogrifier
|
|
205
|
+
Installs the currently released version of the title "transmogrifier".
|
|
206
|
+
|
|
207
|
+
xolo install laserbeam transmogrifier=2.0
|
|
208
|
+
Installs the currently released version of the title "laserbeam" and version 2.0 of
|
|
209
|
+
the title "transmogrifier", if it is in pilot or already released.
|
|
210
|
+
|
|
211
|
+
xolo uninstall transmogrifier laserbeam
|
|
212
|
+
Uninstalls the titles "transmogrifier" and "laserbeam, if they are uninstallable via
|
|
213
|
+
xolo and currently installed. Note that versions are ignored for uninstalling, since
|
|
214
|
+
only one version of a title can be installed at a time.
|
|
215
|
+
|
|
216
|
+
xolo list-titles
|
|
217
|
+
Lists all titles known to xolo, with their versions and statuses.
|
|
218
|
+
|
|
219
|
+
xolo details laserbeam transmogrifier=2.0
|
|
220
|
+
Shows detailed information about the title "laserbeam" and version 2.0 of the title
|
|
221
|
+
"transmogrifier".
|
|
222
|
+
|
|
164
223
|
For more information about xolo, see $XOLO_DOX_URL
|
|
165
224
|
ENDHELP
|
|
166
225
|
} # end show_help
|
|
@@ -171,8 +230,8 @@ function parse_cli() {
|
|
|
171
230
|
zparseopts -D -F -E -- \
|
|
172
231
|
{h,H,-help}=show_help \
|
|
173
232
|
{v,-verbose}=be_verbose \
|
|
174
|
-
{q,-quiet}=be_quiet \
|
|
175
233
|
{d,-debug}=debugging_on \
|
|
234
|
+
{t,-test}=test_mode \
|
|
176
235
|
{n,-no-versions}=no_versions \
|
|
177
236
|
{r,-recon}=do_recon \
|
|
178
237
|
{V,-version}=show_xolo_version || \
|
|
@@ -181,46 +240,57 @@ function parse_cli() {
|
|
|
181
240
|
# they are in arrays, but we want regular vars
|
|
182
241
|
show_help=$show_help[-1]
|
|
183
242
|
be_verbose=$be_verbose[-1]
|
|
184
|
-
be_quiet=$be_quiet[-1]
|
|
185
243
|
debugging_on=$debugging_on[-1]
|
|
244
|
+
test_mode=$test_mode[-1]
|
|
186
245
|
no_versions=$no_versions[-1]
|
|
187
246
|
do_recon=$do_recon[-1]
|
|
188
247
|
show_xolo_version=$show_xolo_version[-1]
|
|
189
248
|
|
|
249
|
+
# test mode can be triggered by an env var
|
|
250
|
+
[[ -n "$XOLO_TEST_MODE" ]] && test_mode=1
|
|
251
|
+
|
|
190
252
|
# if debugging is on, verbose is also on
|
|
191
253
|
[[ -n $debugging_on ]] && be_verbose=1
|
|
192
254
|
|
|
193
|
-
# if we're in verbose mode, we're not in quiet mode
|
|
194
|
-
[[ -n $be_verbose ]] && unset be_quiet
|
|
195
|
-
|
|
196
255
|
command=$1
|
|
197
256
|
[[ ${#@} -gt 0 ]] && shift
|
|
198
257
|
|
|
199
|
-
|
|
200
|
-
[[ ${#@} -gt 0 ]] && shift
|
|
201
|
-
|
|
202
|
-
version=$1
|
|
203
|
-
|
|
204
|
-
# echo "show_help is: $show_help"
|
|
205
|
-
# echo "be_verbose is: $be_verbose"
|
|
206
|
-
# echo "be_quiet is: $be_quiet"
|
|
207
|
-
# echo "debugging_on is: $debugging_on"
|
|
208
|
-
# echo "command is: $command"
|
|
209
|
-
# echo "title is: $title"
|
|
210
|
-
# echo "version is: $version"
|
|
211
|
-
|
|
258
|
+
targets=("${(@)@}")
|
|
212
259
|
|
|
213
260
|
debug "Parsed command line:"
|
|
214
261
|
debug "..show_help is: $show_help"
|
|
215
262
|
debug "..be_verbose is: $be_verbose"
|
|
216
|
-
debug "..be_quiet is: $be_quiet"
|
|
217
263
|
debug "..debugging_on is: $debugging_on"
|
|
264
|
+
debug "..test_mode is: $test_mode"
|
|
265
|
+
[[ -n "$XOLO_TEST_MODE" ]] && debug " ..via XOLO_TEST_MODE env."
|
|
218
266
|
debug "..no_versions is: $no_versions"
|
|
219
267
|
debug "..show_xolo_version is: $show_xolo_version"
|
|
220
268
|
|
|
221
269
|
debug "..command is: $command"
|
|
222
|
-
debug "..
|
|
223
|
-
|
|
270
|
+
debug "..targets are: $targets"
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
# Parse a title and version from the command line, where they may be given in the form
|
|
274
|
+
# title or title=version
|
|
275
|
+
#################################
|
|
276
|
+
function parse_title_and_version() {
|
|
277
|
+
local arg=$1
|
|
278
|
+
debug "Parsing title and version from arg: '$arg'"
|
|
279
|
+
|
|
280
|
+
if [[ "$arg" == *"$TITLE_VERSION_SEPARATOR"* ]] ; then
|
|
281
|
+
# everything before the first = is title
|
|
282
|
+
title=${arg%%$TITLE_VERSION_SEPARATOR*}
|
|
283
|
+
# everything after the first = is version
|
|
284
|
+
version=${arg#*$TITLE_VERSION_SEPARATOR}
|
|
285
|
+
else
|
|
286
|
+
title="$arg"
|
|
287
|
+
version=''
|
|
288
|
+
fi
|
|
289
|
+
|
|
290
|
+
debug "..title is: '$title'"
|
|
291
|
+
debug "..version is: '$version'"
|
|
292
|
+
|
|
293
|
+
return 0
|
|
224
294
|
}
|
|
225
295
|
|
|
226
296
|
# quick test for debugging_on
|
|
@@ -235,16 +305,10 @@ function be_verbose() {
|
|
|
235
305
|
[[ -n "$be_verbose" ]]
|
|
236
306
|
}
|
|
237
307
|
|
|
238
|
-
#
|
|
239
|
-
###############################
|
|
240
|
-
function be_quiet() {
|
|
241
|
-
[[ -n "$be_quiet" ]]
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
# Print a message to stout if we're not in quiet mode
|
|
308
|
+
# Print a message to stout
|
|
245
309
|
###############################
|
|
246
310
|
function say() {
|
|
247
|
-
|
|
311
|
+
echo "$*"
|
|
248
312
|
}
|
|
249
313
|
|
|
250
314
|
# Print a message to stdout if we're in verbose or debug mode
|
|
@@ -334,7 +398,7 @@ app.includeStandardAdditions = true;
|
|
|
334
398
|
|
|
335
399
|
// run() is automatically executed when the program is called, and will print any output returned.
|
|
336
400
|
function run() {
|
|
337
|
-
var parsed_data = JSON.parse(app.read("${
|
|
401
|
+
var parsed_data = JSON.parse(app.read("${client_data_json_file}"));
|
|
338
402
|
var result;
|
|
339
403
|
|
|
340
404
|
// the line below will sub-in whatever code we were passed
|
|
@@ -366,7 +430,7 @@ function all_xolo_titles() {
|
|
|
366
430
|
read -r -d '' jscode <<ENDJAVASCRIPT
|
|
367
431
|
result = Object.keys(parsed_data.titles).join('\n');
|
|
368
432
|
ENDJAVASCRIPT
|
|
369
|
-
extract_json_data "$jscode"
|
|
433
|
+
extract_json_data "$jscode" | sort
|
|
370
434
|
}
|
|
371
435
|
|
|
372
436
|
# Outputs all known titles, one per line, with versions and statuses
|
|
@@ -399,7 +463,7 @@ function all_xolo_titles_with_versions() {
|
|
|
399
463
|
result = result.slice(0, -1);
|
|
400
464
|
|
|
401
465
|
ENDJAVASCRIPT
|
|
402
|
-
extract_json_data "$jscode"
|
|
466
|
+
extract_json_data "$jscode" | sort
|
|
403
467
|
}
|
|
404
468
|
|
|
405
469
|
|
|
@@ -680,39 +744,24 @@ ENDJAVASCRIPT
|
|
|
680
744
|
# Run a Jamf policy trigger
|
|
681
745
|
# $1 = the policy trigger to run
|
|
682
746
|
# $2 = any extra options to pass to the jamf command
|
|
683
|
-
# be_verbose()
|
|
747
|
+
# be_verbose() will automatically be honored
|
|
684
748
|
#######################################
|
|
685
749
|
function run_jamf_policy_trigger() {
|
|
686
750
|
local policy_trigger=$1
|
|
687
751
|
local jamf_options=$2
|
|
688
752
|
local jamf_verbose=''
|
|
689
|
-
local jamf_quiet=''
|
|
690
753
|
local cmd
|
|
691
754
|
|
|
692
|
-
|
|
693
|
-
if be_verbose ; then
|
|
694
|
-
jamf_verbose='-verbose'
|
|
695
|
-
else
|
|
696
|
-
# if told to be quiet, do so
|
|
697
|
-
if be_quiet ; then
|
|
698
|
-
jamf_quiet=1
|
|
699
|
-
|
|
700
|
-
# but if we're refreshing client data as part of
|
|
701
|
-
# another command, always be quiet.
|
|
702
|
-
elif [[ $policy_trigger == $UPDATE_CLIENT_DATA_TRIGGER && "$command" != 'refresh' ]] ; then
|
|
703
|
-
jamf_quiet=1
|
|
704
|
-
fi
|
|
705
|
-
fi
|
|
706
|
-
|
|
755
|
+
be_verbose && jamf_verbose='-verbose'
|
|
707
756
|
|
|
708
757
|
cmd="$JAMF policy -trigger $policy_trigger $jamf_options $jamf_verbose"
|
|
758
|
+
tempfile=$(mktemp /tmp/xolo-policy.XXXXXXXX)
|
|
759
|
+
|
|
709
760
|
debug "Running jamf policy command: $cmd"
|
|
761
|
+
eval "$cmd" | tee "$tempfile"
|
|
710
762
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
else
|
|
714
|
-
policy_output=$( eval "$cmd" | tee /dev/tty )
|
|
715
|
-
fi
|
|
763
|
+
policy_output=$(<"$tempfile")
|
|
764
|
+
rm -f "$tempfile"
|
|
716
765
|
|
|
717
766
|
[[ $policy_output =~ 'Submitting log to https://' ]] && return 0
|
|
718
767
|
|
|
@@ -723,12 +772,13 @@ function run_jamf_policy_trigger() {
|
|
|
723
772
|
# Refresh the client data
|
|
724
773
|
###############################
|
|
725
774
|
function refresh_client_data() {
|
|
775
|
+
|
|
726
776
|
# if we've already refreshed during this run, we're done
|
|
727
777
|
[[ -n "$client_data_refreshed" ]] && return
|
|
728
778
|
|
|
729
779
|
[[ "$command" == 'refresh' ]] && say "Refreshing client data..." || debug "Refreshing client data..."
|
|
730
780
|
|
|
731
|
-
run_jamf_policy_trigger $
|
|
781
|
+
run_jamf_policy_trigger "$update_client_data_trigger"
|
|
732
782
|
|
|
733
783
|
client_data_refreshed=1
|
|
734
784
|
}
|
|
@@ -744,8 +794,9 @@ function validate_title() {
|
|
|
744
794
|
# die if no title given
|
|
745
795
|
[[ -z "$title" ]] && die "No title given.\nUsage: $USAGE\nUse --help for more information."
|
|
746
796
|
|
|
747
|
-
# make sure the JSON data file is up to date
|
|
748
|
-
|
|
797
|
+
# make sure the JSON data file is up to date, if we are root
|
|
798
|
+
|
|
799
|
+
[[ $EUID -eq 0 ]] && refresh_client_data
|
|
749
800
|
|
|
750
801
|
# die if no such title
|
|
751
802
|
# all titles in an array
|
|
@@ -776,9 +827,21 @@ function validate_version() {
|
|
|
776
827
|
version_is_valid=1
|
|
777
828
|
}
|
|
778
829
|
|
|
830
|
+
# Install all the items on the command line, which may be titles or specific versions of titles
|
|
831
|
+
#################################
|
|
832
|
+
function install_cli_args() {
|
|
833
|
+
debug "Installing Targets: $targets"
|
|
834
|
+
for item in $targets ; do
|
|
835
|
+
parse_title_and_version "$item"
|
|
836
|
+
install
|
|
837
|
+
done
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
|
|
779
841
|
# Install a title, or a specific version thereof
|
|
780
842
|
###############################
|
|
781
843
|
function install() {
|
|
844
|
+
|
|
782
845
|
validate_title
|
|
783
846
|
|
|
784
847
|
# if no version is given, we'll find the current release
|
|
@@ -814,12 +877,25 @@ function install() {
|
|
|
814
877
|
fi
|
|
815
878
|
}
|
|
816
879
|
|
|
880
|
+
# uninstall CLI args, which are just titles since versions don't matter for uninstalling
|
|
881
|
+
##############################
|
|
882
|
+
function uninstall_cli_args() {
|
|
883
|
+
debug "Uninstalling Targets: $targets"
|
|
884
|
+
for item in $targets ; do
|
|
885
|
+
parse_title_and_version "$item"
|
|
886
|
+
uninstall
|
|
887
|
+
done
|
|
888
|
+
}
|
|
889
|
+
|
|
817
890
|
# Unnstall a title
|
|
818
891
|
# This might not do anything if the title is not uninstallable,
|
|
819
892
|
# or if the title is not installed
|
|
820
893
|
###############################
|
|
821
894
|
function uninstall() {
|
|
822
895
|
validate_title
|
|
896
|
+
|
|
897
|
+
details_for_title $title | grep -q 'Uninstallable: true' || die "Title $title is not uninstallable via xolo"
|
|
898
|
+
|
|
823
899
|
say "Uninstalling title $title..."
|
|
824
900
|
|
|
825
901
|
if run_jamf_policy_trigger "xolo-${title}-uninstall" ; then
|
|
@@ -843,8 +919,6 @@ function run_recon() {
|
|
|
843
919
|
say 'Running jamf recon...'
|
|
844
920
|
if be_verbose ; then
|
|
845
921
|
$JAMF recon -verbose
|
|
846
|
-
elif be_quiet ; then
|
|
847
|
-
$JAMF recon &> /dev/null
|
|
848
922
|
else
|
|
849
923
|
$JAMF recon
|
|
850
924
|
fi
|
|
@@ -861,8 +935,6 @@ function update() {
|
|
|
861
935
|
debug "Running jamf policy..."
|
|
862
936
|
if be_verbose ; then
|
|
863
937
|
$JAMF policy -verbose
|
|
864
|
-
elif be_quiet ; then
|
|
865
|
-
$JAMF policy &> /dev/null
|
|
866
938
|
else
|
|
867
939
|
$JAMF policy
|
|
868
940
|
fi
|
|
@@ -881,9 +953,20 @@ function list_all_titles() {
|
|
|
881
953
|
all_xolo_titles_with_versions
|
|
882
954
|
}
|
|
883
955
|
|
|
956
|
+
# Show detailed information about all titles, or specific versions thereof, given on the command line
|
|
957
|
+
########################
|
|
958
|
+
function show_details_cli_args() {
|
|
959
|
+
debug "Showing details for targets: $targets"
|
|
960
|
+
for item in $targets; do
|
|
961
|
+
parse_title_and_version "$item"
|
|
962
|
+
show_details
|
|
963
|
+
done
|
|
964
|
+
}
|
|
965
|
+
|
|
884
966
|
# Show detailed information about a title or a version thereof
|
|
885
967
|
###############################
|
|
886
968
|
function show_details() {
|
|
969
|
+
debug "Showing details for title '$title' and version '$version'..."
|
|
887
970
|
validate_title
|
|
888
971
|
|
|
889
972
|
if [[ -z "$version" ]] ; then
|
|
@@ -901,7 +984,7 @@ function list_installed_titles() {
|
|
|
901
984
|
local app_data
|
|
902
985
|
|
|
903
986
|
|
|
904
|
-
verbose "
|
|
987
|
+
verbose "Locating installed titles..."
|
|
905
988
|
|
|
906
989
|
# populate the installed_apps associative array
|
|
907
990
|
get_installed_apps
|
|
@@ -916,6 +999,7 @@ function list_installed_titles() {
|
|
|
916
999
|
display_title_if_installed_by_version_script $ttl
|
|
917
1000
|
fi
|
|
918
1001
|
done <<<"$(all_xolo_titles)"
|
|
1002
|
+
return 0
|
|
919
1003
|
}
|
|
920
1004
|
|
|
921
1005
|
# given a title and some app data (name, bundle id)
|
|
@@ -1081,11 +1165,18 @@ function expire() {
|
|
|
1081
1165
|
uninstall
|
|
1082
1166
|
}
|
|
1083
1167
|
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
|
|
1084
1171
|
# MAIN
|
|
1085
1172
|
###############################
|
|
1086
1173
|
###############################
|
|
1087
1174
|
|
|
1088
1175
|
function main() {
|
|
1176
|
+
# defaults
|
|
1177
|
+
client_data_json_file="$CLIENT_DATA_JSON_FILE"
|
|
1178
|
+
update_client_data_trigger="$UPDATE_CLIENT_DATA_TRIGGER"
|
|
1179
|
+
|
|
1089
1180
|
# Parse the command line
|
|
1090
1181
|
parse_cli "$@"
|
|
1091
1182
|
|
|
@@ -1101,22 +1192,31 @@ function main() {
|
|
|
1101
1192
|
exit 0
|
|
1102
1193
|
fi
|
|
1103
1194
|
|
|
1195
|
+
# use the test data file if in test mode
|
|
1196
|
+
if [[ -n "$test_mode" ]] ; then
|
|
1197
|
+
client_data_json_file="$TEST_CLIENT_DATA_JSON_FILE"
|
|
1198
|
+
update_client_data_trigger="$TEST_UPDATE_CLIENT_DATA_TRIGGER"
|
|
1199
|
+
fi
|
|
1200
|
+
|
|
1104
1201
|
if [[ "$command" != "refresh" ]] ; then
|
|
1105
1202
|
# If we're not refreshing, we need to have the client data file
|
|
1106
1203
|
# and it needs to be up to date
|
|
1107
|
-
[[ -f "$
|
|
1204
|
+
[[ -f "$client_data_json_file" ]] || die "No client data file found at $client_data_json_file.\nPlease run the 'refresh' command to update the client data."
|
|
1108
1205
|
fi
|
|
1109
1206
|
|
|
1110
1207
|
[[ -z "$command" ]] && die "No command given.\nUsage: $USAGE\nUse --help for more information."
|
|
1111
1208
|
|
|
1209
|
+
# confirm we are root for those commands that need it
|
|
1210
|
+
must_be_root
|
|
1211
|
+
|
|
1112
1212
|
case "$command" in
|
|
1113
1213
|
install|i)
|
|
1114
1214
|
debug "processing command 'install'"
|
|
1115
|
-
|
|
1215
|
+
install_cli_args
|
|
1116
1216
|
;;
|
|
1117
1217
|
uninstall|u)
|
|
1118
1218
|
debug "processing command 'uninstall'"
|
|
1119
|
-
|
|
1219
|
+
uninstall_cli_args
|
|
1120
1220
|
;;
|
|
1121
1221
|
update|U)
|
|
1122
1222
|
debug "processing command 'update'"
|
|
@@ -1138,7 +1238,7 @@ function main() {
|
|
|
1138
1238
|
;;
|
|
1139
1239
|
details|d)
|
|
1140
1240
|
debug "processing command 'details'"
|
|
1141
|
-
|
|
1241
|
+
show_details_cli_args
|
|
1142
1242
|
;;
|
|
1143
1243
|
expire|e)
|
|
1144
1244
|
debug "processing command 'expire'"
|
|
@@ -1157,4 +1257,4 @@ function main() {
|
|
|
1157
1257
|
|
|
1158
1258
|
# RUN!
|
|
1159
1259
|
###########################
|
|
1160
|
-
main "$@"
|
|
1260
|
+
main "$@"
|