xolo-admin 2.2.4 → 2.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2b0f21f5f3a7a55117054a2fe5cd35e7e702debd3909669f969e009b603cbbe
4
- data.tar.gz: 27f012b50a0986d7a06854f5cef89af6b549efe7a22b30faf3601418be3dc56d
3
+ metadata.gz: 93b88b4836493ad597c2417b6c83f5ed5526a71e1b434ef391ccfe3cc46bfbd6
4
+ data.tar.gz: b6647511a33dfcdf8812be9dc615c7134df5b8ce989b766c6fd6f33886b188d3
5
5
  SHA512:
6
- metadata.gz: 854b8cf91c614184a51b2753931135dbb91d697965b5531859d886d96e554fcfb33c60abc141c47bb0748a4150cec8fa0d357a4cbfb4dbf44625b439229adf9a
7
- data.tar.gz: bbcbf4275c621a79829d365b0a4d0bd4ac09775516efb924fbb4bd8f1f9039c17e0b1d8c2ce22293793ffbb83696e86b385cdd57fa2c41c6f706080c69bd1b2e
6
+ metadata.gz: 7e797fdfa95678ab2f6811f44f860a0b5018c72fce7654bb11260d35b176dd19ef84c7d1c250f414dd26d643f21596624cf97cff498fd2c27f005845b5dec330
7
+ data.tar.gz: de7997dd22b4c59149e1d8b9c565628e959b0636130699997dbb3e339a7debdadc12ac6f5d592eeb188e493b8a7b10d178f7118c6dc798fd839c742a8919b5b8
data/data/client/xolo CHANGED
@@ -27,6 +27,9 @@ zmodload zsh/zutil
27
27
  ###############################
28
28
  ###############################
29
29
 
30
+ # just in case
31
+ export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/libexec:$PATH"
32
+
30
33
  # Needed for the UTF-8 chars in the lsreg output
31
34
  export LANG="en_US.UTF-8"
32
35
  export LC_ALL="en_US.UTF-8"
@@ -356,42 +359,43 @@ function debug() {
356
359
  debugging_on && echo "DEBUG: $*" 1>&2
357
360
  }
358
361
 
359
- # Gather all installed bundle ids and installed versions from lsreg
362
+ # Gather all installed bundle ids and installed versions from system_profiler
360
363
  # store them in an associative array in $installed_apps.
361
364
  # keys are bundle ids, values are app name & installed version
362
365
  # separated by a semicolon
363
366
  # e.g. 'com.apple.Safari => Safari.app;14.0.3'
364
367
  ###############################
365
368
  function get_installed_apps() {
369
+ # debug "PATH is $PATH"
366
370
  debug "Getting all installed .apps on this Mac..."
367
371
  local app_name
368
372
  local app_bundle_id
369
373
  local app_vers
374
+ local app_plist
370
375
 
371
- # loop thru lsreg output
372
- "$LSREG" -dump Bundle | while IFS= read -r line ; do
373
- # a line if ------ starts a new record
374
- if [[ "$line" =~ '^-+$' ]] ; then
375
- unset app_name
376
- unset app_bundle_id
377
- unset app_vers
378
- continue
379
- fi
376
+ json_app_data=$(/usr/sbin/system_profiler -json SPApplicationsDataType )
377
+
378
+ apps_to_look_at=$(echo "$json_app_data" | grep '"path"' | cut -d'"' -f4 | grep -v '^/System/')
379
+
380
+ for app_path in ${(f)apps_to_look_at} ; do
381
+ app_name=$(/usr/bin/basename "$app_path")
382
+ app_plist="$app_path/Contents/Info.plist"
380
383
 
381
- # $MATCH is the whole matched string, $match is the array of captures
382
- # NOTE this only works if the path is listed before the CFBundleIdentifier
383
- # which seems to be the case in the lsreg output
384
- [[ "$line" =~ '^path:[[:space:]]+/.*/(.+\.app) \(' ]] && app_name=$match[1]
385
- [[ "$line" =~ '^[[:space:]]+CFBundleIdentifier = \"(.+)\";' ]] && app_bundle_id=$match[1]
386
- [[ "$line" =~ '^[[:space:]]+CFBundleShortVersionString = \"(.+)\";' ]] && app_vers=$match[1]
384
+ if [[ -f "$app_plist" ]] ; then
385
+ app_bundle_id=$(/usr/bin/plutil -extract CFBundleIdentifier raw "$app_plist" 2>/dev/null)
386
+
387
+ app_vers=$(/usr/bin/plutil -extract CFBundleShortVersionString raw "$app_plist" 2>/dev/null)
388
+
389
+ # Use CFBundleVersion if no CFBundleShortVersionString
390
+ [[ -z "$app_vers" ]] && \
391
+ app_vers=$(/usr/bin/plutil -extract CFBundleVersion raw "$app_plist" 2>/dev/null)
387
392
 
388
- if [[ -n "$app_name" && -n "$app_bundle_id" && -n "$app_vers" ]] ; then
389
393
  installed_apps[$app_bundle_id]="$app_name;$app_vers"
390
- unset app_name
391
- unset app_bundle_id
392
- unset app_vers
394
+ else
395
+ debug "App Path '$app_path' has no Info.plist"
393
396
  fi
394
397
  done
398
+
395
399
  # installed_apps is now an associative array with bundle ids as keys and app names as values
396
400
 
397
401
  # print the installed apps - this is a long list
@@ -402,8 +406,70 @@ function get_installed_apps() {
402
406
  done
403
407
  fi
404
408
 
409
+ # debug "PATH is $PATH"
405
410
  } # end installed_apps
406
411
 
412
+ ########################################
413
+ ########################################
414
+ ########################################
415
+ ########################################
416
+ ########################################
417
+ ########################################
418
+ # Gather all installed bundle ids and installed versions from lsreg
419
+ # store them in an associative array in $installed_apps.
420
+ # keys are bundle ids, values are app name & installed version
421
+ # separated by a semicolon
422
+ # e.g. 'com.apple.Safari => Safari.app;14.0.3'
423
+ ###############################
424
+ # function get_installed_apps() {
425
+ # debug "Getting all installed .apps on this Mac..."
426
+ # local app_name
427
+ # local app_bundle_id
428
+ # local app_vers
429
+
430
+ # # loop thru lsreg output
431
+ # "$LSREG" -dump Bundle | while IFS= read -r line ; do
432
+ # # a line if ------ starts a new record
433
+ # if [[ "$line" =~ '^-+$' ]] ; then
434
+ # unset app_name
435
+ # unset app_bundle_id
436
+ # unset app_vers
437
+ # continue
438
+ # fi
439
+
440
+ # # $MATCH is the whole matched string, $match is the array of captures
441
+ # # NOTE this only works if the path is listed before the CFBundleIdentifier
442
+ # # which seems to be the case in the lsreg output
443
+ # [[ "$line" =~ '^path:[[:space:]]+/.*/(.+\.app) \(' ]] && app_name=$match[1]
444
+ # [[ "$line" =~ '^[[:space:]]+CFBundleIdentifier = \"(.+)\";' ]] && app_bundle_id=$match[1]
445
+ # [[ "$line" =~ '^[[:space:]]+CFBundleShortVersionString = \"(.+)\";' ]] && app_vers=$match[1]
446
+
447
+ # if [[ -n "$app_name" && -n "$app_bundle_id" && -n "$app_vers" ]] ; then
448
+ # installed_apps[$app_bundle_id]="$app_name;$app_vers"
449
+ # unset app_name
450
+ # unset app_bundle_id
451
+ # unset app_vers
452
+ # fi
453
+ # done
454
+ # # installed_apps is now an associative array with bundle ids as keys and app names as values
455
+
456
+ # # print the installed apps - this is a long list
457
+ # if debugging_on ; then
458
+ # debug "All installed .apps on this Mac:"
459
+ # for bundle app in ${(kv)installed_apps}; do
460
+ # debug "'$bundle' -> '$app'"
461
+ # done
462
+ # fi
463
+
464
+ # } # end installed_apps
465
+ ########################################
466
+ ########################################
467
+ ########################################
468
+ ########################################
469
+ ########################################
470
+ ########################################
471
+ ########################################
472
+
407
473
  # Extract data from the client-data.json file
408
474
  #
409
475
  # TODO: Once we only support macOS 15 (Sequoia) and higher, we
@@ -463,7 +529,7 @@ function all_xolo_titles() {
463
529
  read -r -d '' jscode <<ENDJAVASCRIPT
464
530
  result = Object.keys(parsed_data.titles).join('\n');
465
531
  ENDJAVASCRIPT
466
- extract_json_data "$jscode" | sort
532
+ extract_json_data "$jscode" | /usr/bin/sort
467
533
  }
468
534
 
469
535
  # Outputs all known titles, one per line, with versions and statuses
@@ -1020,12 +1086,15 @@ function list_installed_titles() {
1020
1086
  local ttl
1021
1087
  local app_data
1022
1088
 
1023
-
1024
1089
  verbose "Locating installed titles..."
1025
1090
 
1026
1091
  # populate the installed_apps associative array
1027
1092
  get_installed_apps
1028
1093
 
1094
+ # gather output here, display it at the end
1095
+ # rather than interspersed with debug lines
1096
+ installed_titles_report=""
1097
+
1029
1098
  while IFS= read -r ttl; do
1030
1099
  app_data=$(app_data_for_title $ttl)
1031
1100
 
@@ -1036,6 +1105,8 @@ function list_installed_titles() {
1036
1105
  display_title_if_installed_by_version_script $ttl
1037
1106
  fi
1038
1107
  done <<<"$(all_xolo_titles)"
1108
+
1109
+ say "$installed_titles_report"
1039
1110
  return 0
1040
1111
  }
1041
1112
 
@@ -1075,9 +1146,9 @@ function display_title_if_installed_by_app_data() {
1075
1146
  [[ "$inst_app_name" == "$app_name" ]] || return
1076
1147
 
1077
1148
  if [[ -n "$no_versions" ]] ; then
1078
- echo $ttl
1149
+ installed_titles_report="$installed_titles_report\n$ttl"
1079
1150
  else
1080
- echo "$ttl ($inst_app_vers)"
1151
+ installed_titles_report="$installed_titles_report\n$ttl ($inst_app_vers)"
1081
1152
  fi
1082
1153
  }
1083
1154
 
@@ -1114,9 +1185,9 @@ function display_title_if_installed_by_version_script() {
1114
1185
  [[ -n "$app_vers" ]] || return
1115
1186
 
1116
1187
  if [[ -n "$no_versions" ]] ; then
1117
- echo $ttl
1188
+ installed_titles_report="$installed_titles_report\n$ttl"
1118
1189
  else
1119
- echo "$ttl ($app_vers)"
1190
+ installed_titles_report="$installed_titles_report\n$ttl ($inst_app_vers)"
1120
1191
  fi
1121
1192
  }
1122
1193
 
@@ -12,7 +12,7 @@ module Xolo
12
12
 
13
13
  module Version
14
14
 
15
- VERSION = '2.2.4'.freeze
15
+ VERSION = '2.3.0'.freeze
16
16
 
17
17
  end
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xolo-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Lasell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-24 00:00:00.000000000 Z
11
+ date: 2026-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday