forked from Macjutsu/super
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuper
More file actions
executable file
·10834 lines (10181 loc) · 791 KB
/
super
File metadata and controls
executable file
·10834 lines (10181 loc) · 791 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
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# S.U.P.E.R.M.A.N.
# Software Update/Upgrade Policy Enforcement (with) Recursive Messaging And Notification
# https://github.com/Macjutsu/super
# by Kevin M. White
# The next line disables specific ShellCheck codes (https://github.com/koalaman/shellcheck) for the entire script.
# shellcheck disable=SC2012,SC2024,SC2207
SUPER_VERSION="5.0.0"
readonly SUPER_VERSION
SUPER_DATE="2024/10/17"
readonly SUPER_DATE
# MARK: *** Documentation ***
################################################################################
# Show usage documentation.
show_usage() {
echo "
S.U.P.E.R.M.A.N.
Software Update/Upgrade Policy Enforcement (with) Recursive
Messaging And Notification
Version ${SUPER_VERSION}
${SUPER_DATE}
https://github.com/Macjutsu/super
Usage:
sudo ./super
Installation Options:
[--install-macos-major-upgrades] [--install-macos-major-upgrades-off]
[--install-macos-major-version-target=number]
[--install-rapid-security-responses] [--install-rapid-security-responses-off]
[--install-non-system-updates-without-restarting]
[--install-non-system-updates-without-restarting-off]
[--install-jamf-policy-triggers=PolicyTrigger,PolicyTrigger,etc...]
[--install-jamf-policy-triggers-without-restarting]
[--install-jamf-policy-triggers-without-restarting-off]
Workflow Options:
[--workflow-install-now] [--workflow-install-now-off]
[--workflow-only-download] [--workflow-only-download-off]
[--workflow-restart-without-updates] [--workflow-restart-without-updates-off]
[--workflow-disable-update-check] [--workflow-disable-update-check-off]
[--workflow-disable-relaunch] [--workflow-disable-relaunch-off]
[--workflow-reset-super-after-completion]
Deferral Timer Options:
[--deferral-timer-default=minutes]
[--deferral-timer-menu=minutes,minutes,etc...]
[--deferral-timer-focus=minutes] [--deferral-timer-error=minutes]
[--deferral-timer-workflow-relaunch=minutes] [--deferral-timer-reset-all]
Scheduling Options:
[--schedule-workflow-active=DAY:hh:mm-hh:mm,DAY:hh:mm-hh:mm,etc...]
[--schedule-zero-date-release] [--schedule-zero-date-release-off]
[--schedule-zero-date-sofa-custom-url=URL]
[--schedule-zero-date-manual=YYYY-MM-DD:hh:mm]
[--scheduled-install-days=number] [--scheduled-install-date=YYYY-MM-DD:hh:mm]
[--scheduled-install-user-choice] [--scheduled-install-user-choice-off]
[--scheduled-install-reminder=minutes,minutes,etc...]
[--scheduled-install-delete-all]
Deadline COUNT Options:
[--deadline-count-focus=number] [--deadline-count-soft=number]
[--deadline-count-hard=number] [--deadline-count-restart-all]
[--deadline-count-delete-all]
Deadline DAYS Options:
[--deadline-days-focus=number] [--deadline-days-soft=number]
[--deadline-days-hard=number] [--deadline-days-restart-all]
[--deadline-days-delete-all]
Deadline DATE Options:
[--deadline-date-focus=YYYY-MM-DD:hh:mm]
[--deadline-date-soft=YYYY-MM-DD:hh:mm]
[--deadline-date-hard=YYYY-MM-DD:hh:mm] [--deadline-date-delete-all]
Display Behavior Options:
[--dialog-timeout-default=seconds] [--dialog-timeout-user-auth=seconds]
[--dialog-timeout-user-choice=seconds]
[--dialog-timeout-user-schedule=seconds]
[--dialog-timeout-soft-deadline=seconds]
[--dialog-timeout-insufficient-storage=seconds]
[--dialog-timeout-power-required=seconds] [--dialog-timeout-delete-all]
[--display-unmovable=ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR]
[--display-hide-background=ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR]
[--display-silently=ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR]
[--display-hide-progress-bar=ALWAYS,DEADLINE,SCHEDULED,INSTALLNOW,ERROR]
[--display-notifications-centered=ALWAYS,DEADLINE,SCHEDULED,INSTALLNOW,ERROR]
Display Interface Options:
[--display-icon-size=pixels] [--display-icon-file=/local/path or URL]
[--display-icon-light-file=/local/path or URL]
[--display-icon-dark-file=/local/path or URL]
[--display-accessory-type=TEXTBOX|HTMLBOX|HTML|IMAGE|VIDEO|VIDEOAUTO]
[--display-accessory-default-file=/local/path or URL]
[--display-accessory-macos-minor-update-file=/local/path or URL]
[--display-accessory-macos-major-upgrade-file=/local/path or URL]
[--display-accessory-non-system-updates-file=/local/path or URL]
[--display-accessory-jamf-policy-triggers-file=/local/path or URL]
[--display-accessory-restart-without-updates-file=/local/path or URL]
[--display-help-button-string=plain text or URL]
[--display-warning-button-string=plain text or URL]
Apple Silicon Authentication Options:
[--auth-ask-user-to-save-password] [--auth-ask-user-to-save-password-off]
[--auth-local-account=AccountName] [--auth-local-password=Password]
[--auth-service-add-via-admin-account=AccountName]
[--auth-service-add-via-admin-password=Password]
[--auth-service-account=AccountName] [--auth-service-password=Password]
[--auth-jamf-client=ClientID] [--auth-jamf-secret=ClientSecret]
[--auth-jamf-account=AccountName] [--auth-jamf-password=Password]
[--auth-jamf-custom-url=URL] [--auth-delete-all]
[--auth-credential-failover-to-user] [--auth-credential-failover-to-user-off]
[--auth-mdm-failover-to-user=ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR]
Test Mode Options:
[--test-mode] [--test-mode-off] [--test-mode-timeout=seconds]
[--test-storage-update=gigabytes] [--test-storage-upgrade=gigabytes]
[--test-battery-level=percentage]
Troubleshooting and Documentation Options:
[--open-logs] [--reset-super] [--verbose-mode] [--verbose-mode-off]
[--usage] [--help]
** Managed preferences override local options via domain: com.macjutsu.super
<key>InstallMacOSMajorUpgrades</key> <true/> | <false/>
<key>InstallMacOSMajorVersionTarget</key> <string>version</string>
<key>InstallRapidSecurityResponses</key> <true/> | <false/>
<key>InstallNonSystemUpdatesWithoutRestarting</key> <true/> | <false/>
<key>InstallJamfPolicyTriggers</key>
<string>PolicyTrigger,PolicyTrigger,etc...</string>
<key>InstallJamfPolicyTriggersWithoutRestarting</key> <true/> | <false/>
<key>WorkflowInstallNow</key> <true/> | <false/>
<key>WorkflowOnlyDownload</key> <true/> | <false/>
<key>WorkflowRestartWithoutUpdates</key> <true/> | <false/>
<key>WorkflowDisableUpdateCheck</key> <true/> | <false/>
<key>WorkflowDisableRelaunch</key> <true/> | <false/>
<key>DeferralTimerDefault</key> <string>minutes</string>
<key>DeferralTimerMenu</key> <string>minutes,minutes,etc...</string>
<key>DeferralTimerFocus</key> <string>minutes</string>
<key>DeferralTimerError</key> <string>minutes</string>
<key>DeferralTimerWorkflowRelaunch</key> <string>minutes</string>
<key>ScheduleWorkflowActive</key>
<string>DAY:hh:mm-hh:mm,DAY:hh:mm-hh:mm,etc...</string>
<key>ScheduleZeroDateRelease</key> <true/> | <false/>
<key>ScheduleZeroDateSOFACustomURL</key> <string>URL</string>
<key>ScheduleZeroDateManual</key> <string>YYYY-MM-DD:hh:mm</string>
<key>ScheduledInstallDays</key> <string>number</string>
<key>ScheduledInstallDate</key> <string>YYYY-MM-DD:hh:mm</string>
<key>ScheduledInstallUserChoice</key> <true/> | <false/>
<key>ScheduledInstallReminder</key> <string>minutes,minutes,etc...</string>
<key>DeadlineCountFocus</key> <string>number</string>
<key>DeadlineCountSoft</key> <string>number</string>
<key>DeadlineCountHard</key> <string>number</string>
<key>DeadlineDaysFocus</key> <string>number</string>
<key>DeadlineDaysSoft</key> <string>number</string>
<key>DeadlineDaysHard</key> <string>number</string>
<key>DeadlineDateFocus</key> <string>YYYY-MM-DD:hh:mm</string>
<key>DeadlineDateSoft</key> <string>YYYY-MM-DD:hh:mm</string>
<key>DeadlineDateHard</key> <string>YYYY-MM-DD:hh:mm</string>
<key>DialogTimeoutDefault</key> <string>seconds</string>
<key>DialogTimeoutUserAuth</key> <string>seconds</string>
<key>DialogTimeoutUserChoice</key> <string>seconds</string>
<key>DialogTimeoutUserSchedule</key> <string>seconds</string>
<key>DialogTimeoutSoftDeadline</key> <string>seconds</string>
<key>DialogTimeoutInsufficientStorage</key> <string>seconds</string>
<key>DialogTimeoutPowerRequired</key> <string>seconds</string>
<key>DisplayUnmovable</key>
<string>ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR</string>
<key>DisplayHideBackground</key>
<string>ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR</string>
<key>DisplaySilently</key>
<string>ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR</string>
<key>DisplayHideProgressBar</key>
<string>ALWAYS,DEADLINE,SCHEDULED,INSTALLNOW,ERROR</string>
<key>DisplayNotificationsCentered</key>
<string>ALWAYS,DEADLINE,SCHEDULED,INSTALLNOW,ERROR</string>
<key>DisplayIconSize</key> <string>pixels</string>
<key>DisplayIconFile</key> <string>path</string>
<key>DisplayIconLightFile</key> <string>path</string>
<key>DisplayIconDarkFile</key> <string>path</string>
<key>DisplayAccessoryType</key>
<string>TEXTBOX|HTMLBOX|HTML|IMAGE|VIDEO|VIDEOAUTO</string>
<key>DisplayAccessoryDefaultFile</key> <string>path or URL</string>
<key>DisplayAccessoryMacOSMinorUpdateFile</key> <string>path or URL</string>
<key>DisplayAccessoryMacOSMajorUpgradeFile</key> <string>path or URL</string>
<key>DisplayAccessoryNonSystemUpdatesFile</key> <string>path or URL</string>
<key>DisplayAccessoryJamfPolicyTriggersFile</key> <string>path or URL</string>
<key>DisplayAccessoryRestartWithoutUpdatesFile</key> <string>path or URL</string>
<key>DisplayHelpButtonString</key> <string>plain text or URL</string>
<key>DisplayWarningButtonString</key> <string>plain text or URL</string>
<key>AuthAskUserToSavePassword</key> <true/> | <false/>
<key>AuthJamfCustomURL</key> <string>URL</string>
<key>AuthCredentialFailoverToUser</key> <true/> | <false/>
<key>AuthMDMFailoverToUser</key>
<string>ALWAYS,DIALOG,DEADLINE,SCHEDULED,INSTALLNOW,ERROR</string>
<key>TestMode</key> <true/> | <false/>
<key>TestModeTimeout</key> <string>seconds</string>
<key>TestStorageUpdate</key> <string>gigabytes</string>
<key>TestStorageUpgrade</key> <string>gigabytes</string>
<key>TestBatteryLevel</key> <string>percentage</string>
<key>VerboseMode</key> <true/> | <false/>
** For detailed documentation visit: https://github.com/Macjutsu/super/wiki
** Or use --help to automatically open the S.U.P.E.R.M.A.N. Wiki.
"
# Error log any unrecognized options.
if [[ -n "${unrecognized_options_array[*]}" ]]; then
if [[ $(id -u) -eq 0 ]] && [[ -d "${SUPER_LOG_FOLDER}" ]]; then
log_super "Parameter Error: Unrecognized Options: ${unrecognized_options_array[*]%%=*}"
[[ "${parent_process_is_jamf}" == "TRUE" ]] && log_super "Warning: Note that each Jamf Pro Policy Parameter can only contain a single option."
log_status "Inactive Error: Unrecognized Options: ${unrecognized_options_array[*]%%=*}"
else # super is not running as root or not installed yet.
log_echo "Parameter Error: Unrecognized Options: ${unrecognized_options_array[*]%%=*}"
[[ "${parent_process_is_jamf}" == "TRUE" ]] && log_echo "Warning: Note that each Jamf Pro Policy Parameter can only contain a single option."
fi
fi
log_echo "**** S.U.P.E.R.M.A.N. ${SUPER_VERSION} - EXIT USAGE ****"
exit 0
}
# If there is a real current user then open the S.U.P.E.R.M.A.N. Wiki, otherwise run the show_usage() function.
show_help() {
check_current_user
if [[ "${current_user_account_name}" != "FALSE" ]]; then
log_echo "Status: Opening S.U.P.E.R.M.A.N. Wiki for user account: ${current_user_account_name}."
sudo -u "${current_user_account_name}" open "https://github.com/Macjutsu/super/wiki" &
log_echo "**** S.U.P.E.R.M.A.N. ${SUPER_VERSION} - EXIT HELP ****"
else # No current GUI user.
log_echo "Warning: Unable to open S.U.P.E.R.M.A.N. Wiki because there is no GUI user."
show_usage
fi
exit 0
}
# MARK: *** Parameters ***
################################################################################
# Set default parameters that are used throughout the script.
set_defaults() {
# Path to the super working folder:
SUPER_FOLDER="/Library/Management/super"
readonly SUPER_FOLDER
# Path to the super Symbolic link in default binary folder.
SUPER_LINK="/usr/local/bin/super"
readonly SUPER_LINK
# IMPORTANT DETAIL: Changing this path provides no benefit as this is the default location for most non-system command line tools.
# Path to the super PID file:
SUPER_PID_FILE="/var/run/super.pid"
readonly SUPER_PID_FILE
# IMPORTANT DETAIL: Changing this path provides no benefit as this is the default location for PID files.
# Label name for the super LaunchDaemon.
SUPER_LAUNCH_DAEMON_LABEL="com.macjutsu.super" # No trailing ".plist"
readonly SUPER_LAUNCH_DAEMON_LABEL
# Path to the local property list file:
SUPER_LOCAL_PLIST="${SUPER_FOLDER}/com.macjutsu.super" # No trailing ".plist"
readonly SUPER_LOCAL_PLIST
# Path to the managed property list file:
SUPER_MANAGED_PLIST="/Library/Managed Preferences/com.macjutsu.super" # No trailing ".plist"
readonly SUPER_MANAGED_PLIST
# IMPORTANT DETAIL: While you can customize the identifier "com.macjutsu.super", you must keep the "/Library/Managed Preferences/" folder path intact.
# Path to the super log folder:
SUPER_LOG_FOLDER="${SUPER_FOLDER}/logs"
readonly SUPER_LOG_FOLDER
# Path to the super log archive folder:
SUPER_LOG_ARCHIVE_FOLDER="${SUPER_FOLDER}/logs-archive"
readonly SUPER_LOG_ARCHIVE_FOLDER
# The maximum size (in KB) for any super log that triggers an archival of log files at startup:
SUPER_LOG_ARCHIVE_SIZE=1000
readonly SUPER_LOG_ARCHIVE_SIZE
# Path to the log for the main super workflow:
SUPER_LOG="${SUPER_LOG_FOLDER}/super.log"
readonly SUPER_LOG
# Path to the log for the current "mdmclient AvailableOSUpdates" command response:
MDMCLIENT_LIST_LOG="${SUPER_LOG_FOLDER}/mdmclient-list.log"
readonly MDMCLIENT_LIST_LOG
# Path to the log for the current "mist list" command response:
MACOS_INSTALLERS_LIST_LOG="${SUPER_LOG_FOLDER}/macos-installers-list.log"
readonly MACOS_INSTALLERS_LIST_LOG
# Path to the log for the current "softwareupdate --list" command response:
MSU_LIST_LOG="${SUPER_LOG_FOLDER}/msu-list.log"
readonly MSU_LIST_LOG
# URL to the default SOFA macOS machine readable json feed:
SOFA_MACOS_DEFAULT_URL="https://sofafeed.macadmins.io/v1/macos_data_feed.json"
readonly SOFA_MACOS_DEFAULT_URL
# Path to the local copy of the SOFA machine readable feed:
SOFA_MACOS_JSON_CACHE="${SUPER_LOG_FOLDER}/sofa-macos-data-feed.json"
readonly SOFA_MACOS_JSON_CACHE
# Path to the local copy of the SOFA etag cache:
SOFA_MACOS_JSON_ETAG_CACHE="${SUPER_LOG_FOLDER}/sofa-macos-data-feed-etag.txt"
readonly SOFA_MACOS_JSON_ETAG_CACHE
# Path to the log for all softwareupdate download/install workflows:
MSU_WORKFLOW_LOG="${SUPER_LOG_FOLDER}/msu-workflow.log"
readonly MSU_WORKFLOW_LOG
# Path to the log for all macOS installer application download/install workflows:
INSTALLER_WORKFLOW_LOG="${SUPER_LOG_FOLDER}/installer-workflow.log"
readonly INSTALLER_WORKFLOW_LOG
# Path to the log for filtered MDM client command progress:
MDM_COMMAND_LOG="${SUPER_LOG_FOLDER}/mdm-command.log"
readonly MDM_COMMAND_LOG
# Path to the log for debug MDM client command progress:
MDM_COMMAND_DEBUG_LOG="${SUPER_LOG_FOLDER}/mdm-command-debug.log"
readonly MDM_COMMAND_DEBUG_LOG
# Path to the log for filtered MDM update/upgrade workflow progress:
MDM_WORKFLOW_LOG="${SUPER_LOG_FOLDER}/mdm-workflow.log"
readonly MDM_WORKFLOW_LOG
# Path to the log for debug MDM update/upgrade workflow progress:
MDM_WORKFLOW_DEBUG_LOG="${SUPER_LOG_FOLDER}/mdm-workflow-debug.log"
readonly MDM_WORKFLOW_DEBUG_LOG
# Path to the jamf binary:
JAMF_PRO_BINARY="/usr/local/bin/jamf"
readonly JAMF_PRO_BINARY
# IMPORTANT DETAIL: Changing this path provides no benefit as this is the default location for the jamf binary.
# URL to the IBM Notifier.app download:
IBM_NOTIFIER_DOWNLOAD_URL="https://github.com/IBM/mac-ibm-notifications/releases/download/v-3.2.1-b-127/IBM.Notifier.zip"
readonly IBM_NOTIFIER_DOWNLOAD_URL
# Target version for IBM Notifier.app:
IBM_NOTIFIER_TARGET_VERSION="3.2.1"
readonly IBM_NOTIFIER_TARGET_VERSION
# Path to the local IBM Notifier.app:
IBM_NOTIFIER_APP="${SUPER_FOLDER}/IBM Notifier.app"
readonly IBM_NOTIFIER_APP
# IMPORTANT DETAIL: super does not move the IBM Notifier.app to another custom location.
# Changing this folder path to anything besides "${SUPER_FOLDER}/IBM Notifier.app" requires that you must also deploy the IBM Notifier.app to the custom location prior to using super.
# Path to the local IBM Notifier.app binary:
IBM_NOTIFIER_BINARY="${IBM_NOTIFIER_APP}/Contents/MacOS/IBM Notifier"
readonly IBM_NOTIFIER_BINARY
# URL to the mist-cli package installer:
MIST_CLI_DOWNLOAD_URL="https://github.com/ninxsoft/mist-cli/releases/download/v2.1.1/mist-cli.2.1.1.pkg"
readonly MIST_CLI_DOWNLOAD_URL
# Target version for mist-cli:
MIST_CLI_TARGET_VERSION="2.1.1"
readonly MIST_CLI_TARGET_VERSION
# Path to the local mist-cli binary:
MIST_CLI_BINARY="/usr/local/bin/mist"
readonly MIST_CLI_BINARY
# IMPORTANT DETAIL: super does not move the mist-cli binary to another custom location.
# Changing this folder path to anything besides "/usr/local/bin/mist" requires that you must also deploy the mist-cli binary to the custom location prior to using super.
# Path to the local preference file that would contain any software update settings:
MSU_LOCAL_PLIST="/Library/Preferences/com.apple.SoftwareUpdate" # No trailing ".plist"
readonly MSU_LOCAL_PLIST
# IMPORTANT DETAIL: Changing this path provides no benefit as this is the default location for the local software update settings property list file.
# Path to the managed preference file that would contain any automatic software update settings:
MSU_MANAGED_PLIST="/Library/Managed Preferences/com.apple.SoftwareUpdate" # No trailing ".plist"
readonly MSU_MANAGED_PLIST
# IMPORTANT DETAIL: Changing this path provides no benefit as this is the default location for the managed software update settings property list file.
# Path to the managed preference file that would contain any software update deferral restrictions:
APPLICATION_ACCESS_MANAGED_PLIST="/Library/Managed Preferences/com.apple.applicationaccess" # No trailing ".plist"
readonly APPLICATION_ACCESS_MANAGED_PLIST
# IMPORTANT DETAIL: Changing this path provides no benefit as this is the default location for the software update deferral restrictions property list file.
# The default number of minutes to defer the super workflow (except for the relaunch workflow deferral timer).
DEFERRAL_TIMER_DEFAULT_MINUTES=60
readonly DEFERRAL_TIMER_DEFAULT_MINUTES
# The default number of minutes to defer once the super workflow is complete (aka. automatically relaunch the super workflow).
DEFERRAL_TIMER_WORKFLOW_RELAUNCH_DEFAULT_MINUTES=360
readonly DEFERRAL_TIMER_WORKFLOW_RELAUNCH_DEFAULT_MINUTES
# The default number of minutes to defer the super restart validation workflow if there is a workflow error.
DEFERRAL_TIMER_RESTART_VALIDATION_ERROR_MINUTES=5
readonly DEFERRAL_TIMER_RESTART_VALIDATION_ERROR_MINUTES
# The the minimum number of minutes in the future a user can select a scheduled install.
DIALOG_USER_SCHEDULE_MINIMUM_SELECTION_MINUTES=2
readonly DIALOG_USER_SCHEDULE_MINIMUM_SELECTION_MINUTES
# Default icon size for dialogs and notifications.
DISPLAY_ICON_DEFAULT_SIZE=96
readonly DISPLAY_ICON_DEFAULT_SIZE
# Path to for the local cached light mode display icon (the file type must be set to .png):
DISPLAY_ICON_LIGHT_FILE_CACHE="${SUPER_FOLDER}/icon-light.png"
readonly DISPLAY_ICON_LIGHT_FILE_CACHE
# Path to for the local cached dark mode display icon (the file type must be set to .png):
DISPLAY_ICON_DARK_FILE_CACHE="${SUPER_FOLDER}/icon-dark.png"
readonly DISPLAY_ICON_DARK_FILE_CACHE
# The default icon in the if no ${display_icon_light_file_path} or ${display_icon_dark_file_path} is specified or found.
DISPLAY_ICON_DEFAULT_FILE="/System/Library/PrivateFrameworks/SoftwareUpdate.framework/Versions/Current/Resources/SoftwareUpdate.icns"
readonly DISPLAY_ICON_DEFAULT_FILE
# Deadline date display format.
DISPLAY_STRING_FORMAT_DATE="%a %b %d" # Formatting options can be found in the man page for the date command.
readonly DISPLAY_STRING_FORMAT_DATE
# Deadline date/time separator display string.
DISPLAY_STRING_FORMAT_DATE_TIME_SEPARATOR=" "
readonly DISPLAY_STRING_FORMAT_DATE_TIME_SEPARATOR
# Deadline time display format.
DISPLAY_STRING_FORMAT_TIME="%l:%M %p" # Formatting options can be found in the man page for the date command.
readonly DISPLAY_STRING_FORMAT_TIME
# The default minium storage space in gigabytes required for a macOS minor update.
STORAGE_REQUIRED_UPDATE_DEFAULT_GB=15
readonly STORAGE_REQUIRED_UPDATE_DEFAULT_GB
# The default minium storage space in gigabytes required for a macOS major upgrade.
STORAGE_REQUIRED_UPGRADE_DEFAULT_GB=25
readonly STORAGE_REQUIRED_UPGRADE_DEFAULT_GB
# The number of seconds between storage checks when displaying the insufficient storage notification via the dialog_insufficient_storage() function.
STORAGE_REQUIRED_RECHECK_SECONDS=5
readonly STORAGE_REQUIRED_RECHECK_SECONDS
# The default battery level percentage required for a macOS software update/upgrade on Mac computers with Apple Silicon.
POWER_REQUIRED_BATTERY_APPLE_SILICON_PERCENT=20
readonly POWER_REQUIRED_BATTERY_APPLE_SILICON_PERCENT
# The default battery level percentage required for a macOS software update/upgrade on Mac computers with Intel.
POWER_REQUIRED_BATTERY_INTEL_PERCENT=50
readonly POWER_REQUIRED_BATTERY_INTEL_PERCENT
# The number of seconds between AC power checks when displaying the insufficient battery notification via the dialog_insufficient_storage() function.
POWER_REQUIRED_RECHECK_SECONDS=1
readonly POWER_REQUIRED_RECHECK_SECONDS
# The number of seconds to timeout various workflow startup processes if no progress is reported.
TIMEOUT_START_SECONDS=120
readonly TIMEOUT_START_SECONDS
# The number of seconds to timeout the macOS 11+ softwareupdate download/prepare workflow if no progress is reported.
TIMEOUT_MSU_SYSTEM_SECONDS=1200
readonly TIMEOUT_MSU_SYSTEM_SECONDS
# The number of seconds to timeout the softwareupdate non-system update workflow if no progress is reported.
TIMEOUT_non_system_msu_SECONDS=600
readonly TIMEOUT_non_system_msu_SECONDS
# The number of seconds to timeout the macOS installer download workflow if no progress is reported.
TIMEOUT_INSTALLER_DOWNLOAD_SECONDS=300
readonly TIMEOUT_INSTALLER_DOWNLOAD_SECONDS
# The number of seconds to timeout the macOS installation workflow if no progress is reported.
TIMEOUT_INSTALLER_WORKFLOW_SECONDS=600
readonly TIMEOUT_INSTALLER_DOWNLOAD_SECONDS
# The number of seconds to timeout MDM commands if no response is reported.
TIMEOUT_MDM_COMMAND_SECONDS=300
readonly TIMEOUT_MDM_COMMAND_SECONDS
# The number of seconds to timeout the MDM download/prepare workflow if no progress is reported.
TIMEOUT_MDM_WORKFLOW_SECONDS=600
readonly TIMEOUT_MDM_WORKFLOW_SECONDS
# The default amount of time in seconds to leave test notifications and dialogs open before moving on with the test mode workflow.
TEST_MODE_DEFAULT_TIMEOUT=10
readonly TEST_MODE_DEFAULT_TIMEOUT
# Various regular expressions used for parameter validation.
REGEX_MACOS_MAJOR_VERSION="^([1][1-9])$"
readonly REGEX_MACOS_MAJOR_VERSION
REGEX_ANY_WHOLE_NUMBER="^[0-9]+$"
readonly REGEX_ANY_WHOLE_NUMBER
REGEX_CSV_WHOLE_NUMBERS="^[0-9*,]+$"
readonly REGEX_CSV_WHOLE_NUMBERS
REGEX_HOURS_MINUTES="^(2[0-3]|[01][0-9]):[0-5][0-9]$"
readonly REGEX_HOURS_MINUTES
REGEX_DATE_HOURS_MINUTES="^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]):(2[0-3]|[01][0-9]):[0-5][0-9]$"
readonly REGEX_DATE_HOURS_MINUTES
REGEX_DATE_HOURS_MINUTES_SECONDS="^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]):(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
readonly REGEX_DATE_HOURS_MINUTES_SECONDS
REGEX_DATE="^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$"
readonly REGEX_DATE
REGEX_WEEKDAY="^(MON|TUE|WED|THU|FRI|SAT|SUN)$"
readonly REGEX_WEEKDAY
REGEX_HOURS_MINUTES_RANGE="^(2[0-3]|[01][0-9]):[0-5][0-9]-(2[0-3]|[01][0-9]):[0-5][0-9]$"
readonly REGEX_HOURS_MINUTES_RANGE
REGEX_schedule_workflow_active_time_frame="^(MON|TUE|WED|THU|FRI|SAT|SUN):(2[0-3]|[01][0-9]):[0-5][0-9]-(2[0-3]|[01][0-9]):[0-5][0-9]$"
readonly REGEX_schedule_workflow_active_time_frame
REGEX_HTML_URL="^http:\/\/|^https:\/\/"
readonly REGEX_HTML_URL
REGEX_HTTPS="^https:\/\/.*"
readonly REGEX_HTTPS
REGEX_WORKFLOW_OPTIONS="^ALWAYS$|^DIALOG$|^DEADLINE$|^SCHEDULED$|^INSTALLNOW$|^ERROR$"
readonly REGEX_WORKFLOW_OPTIONS
}
# Collect input options and set associated parameters.
get_options() {
# If super is running via Jamf Pro Policy installation then the first 3 input parameters are skipped.
if [[ "$1" == "/" ]] || [[ $(ps -p "${PPID}" | grep -c -e 'bin/jamf' -e 'jamf/bin' -e '\sjamf\s') -gt 0 ]]; then
shift 3
parent_process_is_jamf="TRUE"
fi
# get_options debug mode.
# log_super "Debug Mode: Function ${FUNCNAME[0]}: @ is:\n$@"
# This is a standard while/case loop to collect all the input parameters.
while [[ -n "$1" ]]; do
case "$1" in
-u | -U | --usage)
show_usage
;;
-h | -H | --help)
show_help
;;
--install-macos-major-upgrades)
install_macos_major_upgrades="TRUE"
;;
--install-macos-major-upgrades-off)
install_macos_major_upgrades="FALSE"
;;
--install-macos-major-version-target=*)
install_macos_major_version_target_option="${1##*=}"
;;
--install-rapid-security-responses)
install_rapid_security_responses_option="TRUE"
;;
--install-rapid-security-responses-off)
install_rapid_security_responses_option="FALSE"
;;
--install-non-system-updates-without-restarting)
install_non_system_updates_without_restarting_option="TRUE"
;;
--install-non-system-updates-without-restarting-off)
install_non_system_updates_without_restarting_option="FALSE"
;;
--install-jamf-policy-triggers=*)
install_jamf_policy_triggers_option="${1##*=}"
;;
--install-jamf-policy-triggers-without-restarting)
install_jamf_policy_triggers_without_restarting_option="TRUE"
;;
--install-jamf-policy-triggers-without-restarting-off)
install_jamf_policy_triggers_without_restarting_option="FALSE"
;;
--workflow-install-now)
workflow_install_now_option="TRUE"
;;
--workflow-install-now-off)
workflow_install_now_option="FALSE"
;;
--workflow-only-download)
workflow_only_download_option="TRUE"
;;
--workflow-only-download-off)
workflow_only_download_option="FALSE"
;;
--workflow-restart-without-updates)
workflow_restart_without_updates_option="TRUE"
;;
--workflow-restart-without-updates-off)
workflow_restart_without_updates_option="FALSE"
;;
--workflow-disable-update-check)
workflow_disable_update_check_option="TRUE"
;;
--workflow-disable-update-check-off)
workflow_disable_update_check_option="FALSE"
;;
--workflow-disable-relaunch)
workflow_disable_relaunch_option="TRUE"
;;
--workflow-disable-relaunch-off)
workflow_disable_relaunch_option="FALSE"
;;
--workflow-reset-super-after-completion)
workflow_reset_super_after_completion_active="TRUE"
;;
--deferral-timer-default=*)
deferral_timer_default_option="${1##*=}"
;;
--deferral-timer-menu=*)
deferral_timer_menu_option="${1##*=}"
;;
--deferral-timer-focus=*)
deferral_timer_focus_option="${1##*=}"
;;
--deferral-timer-error=*)
deferral_timer_error_option="${1##*=}"
;;
--deferral-timer-workflow-relaunch=*)
deferral_timer_workflow_relaunch_option="${1##*=}"
;;
--deferral-timer-reset-all)
deferral_timer_reset_all_option="TRUE"
;;
--schedule-workflow-active=*)
schedule_workflow_active_option="${1##*=}"
;;
--schedule-zero-date-release)
schedule_zero_date_release_option="TRUE"
;;
--schedule-zero-date-release-off)
schedule_zero_date_release_option="FALSE"
;;
--schedule-zero-date-sofa-custom-url=*)
schedule_zero_date_sofa_custom_url_option="${1##*=}"
;;
--schedule-zero-date-manual=*)
schedule_zero_date_manual_option="${1##*=}"
;;
--scheduled-install-days=*)
scheduled_install_days_option="${1##*=}"
;;
--scheduled-install-date=*)
scheduled_install_date_option="${1##*=}"
;;
--scheduled-install-user-choice)
scheduled_install_user_choice_option="TRUE"
;;
--scheduled-install-user-choice-off)
scheduled_install_user_choice_option="FALSE"
;;
--scheduled-install-reminder=*)
scheduled_install_reminder_option="${1##*=}"
;;
--scheduled-install-delete-all)
scheduled_install_delete_all_option="TRUE"
;;
--deadline-count-focus=*)
deadline_count_focus_option="${1##*=}"
;;
--deadline-count-soft=*)
deadline_count_soft_option="${1##*=}"
;;
--deadline-count-hard=*)
deadline_count_hard_option="${1##*=}"
;;
--deadline-count-restart-all)
deadline_count_restart_all_option="TRUE"
;;
--deadline-count-delete-all)
deadline_count_delete_all_option="TRUE"
;;
--deadline-days-focus=*)
deadline_days_focus_option="${1##*=}"
;;
--deadline-days-soft=*)
deadline_days_soft_option="${1##*=}"
;;
--deadline-days-hard=*)
deadline_days_hard_option="${1##*=}"
;;
--deadline-days-restart-all)
deadline_days_restart_all_option="TRUE"
;;
--deadline-days-delete-all)
deadline_days_delete_all_option="TRUE"
;;
--deadline-date-focus=*)
deadline_date_focus_option="${1##*=}"
;;
--deadline-date-soft=*)
deadline_date_soft_option="${1##*=}"
;;
--deadline-date-hard=*)
deadline_date_hard_option="${1##*=}"
;;
--deadline-date-delete-all)
deadline_date_delete_all_option="TRUE"
;;
--dialog-timeout-default=*)
dialog_timeout_default_option="${1##*=}"
;;
--dialog-timeout-user-auth=*)
dialog_timeout_user_auth_option="${1##*=}"
;;
--dialog-timeout-user-choice=*)
dialog_timeout_user_choice_option="${1##*=}"
;;
--dialog-timeout-user-schedule=*)
dialog_timeout_user_schedule_option="${1##*=}"
;;
--dialog-timeout-soft-deadline=*)
dialog_timeout_soft_deadline_option="${1##*=}"
;;
--dialog-timeout-insufficient-storage=*)
dialog_timeout_insufficient_storage_option="${1##*=}"
;;
--dialog-timeout-power-required=*)
dialog_timeout_power_required_option="${1##*=}"
;;
--dialog-timeout-delete-all)
dialog_timeout_delete_all_option="TRUE"
;;
--display-unmovable=*)
display_unmovable_option="${1##*=}"
;;
--display-hide-background=*)
display_hide_background_option="${1##*=}"
;;
--display-silently=*)
display_silently_option="${1##*=}"
;;
--display-hide-progress-bar=*)
display_hide_progress_bar_option="${1##*=}"
;;
--display-notifications-centered=*)
display_notifications_centered_option="${1##*=}"
;;
--display-icon-size=*)
display_icon_size_option="${1##*=}"
;;
--display-icon-file=*)
display_icon_file_option="${1##*=}"
;;
--display-icon-light-file=*)
display_icon_light_file_option="${1##*=}"
;;
--display-icon-dark-file=*)
display_icon_dark_file_option="${1##*=}"
;;
--display-accessory-type=*)
display_accessory_type_option="${1##*=}"
;;
--display-accessory-default-file=*)
display_accessory_default_file_option="${1##*=}"
;;
--display-accessory-macos-minor-update-file=*)
display_accessory_macos_minor_update_file_option="${1##*=}"
;;
--display-accessory-macos-major-upgrade-file=*)
display_accessory_macos_major_upgrade_file_option="${1##*=}"
;;
--display-accessory-non-system-updates-file=*)
display_accessory_non_system_updates_file_option="${1##*=}"
;;
--display-accessory-jamf-policy-triggers-file=*)
display_accessory_jamf_policy_triggers_file_option="${1##*=}"
;;
--display-accessory-restart-without-updates-file=*)
display_accessory_restart_without_updates_file_option="${1##*=}"
;;
--display-help-button-string=*)
display_help_button_string_option="${1##*=}"
;;
--display-warning-button-string=*)
display_warning_button_string_option="${1##*=}"
;;
--auth-ask-user-to-save-password)
auth_ask_user_to_save_password="TRUE"
;;
--auth-ask-user-to-save-password-off)
auth_ask_user_to_save_password="FALSE"
;;
--auth-local-account=*)
auth_local_account_option="${1##*=}"
;;
--auth-local-password=*)
auth_local_password_option="${1##*=}"
;;
--auth-service-add-via-admin-account=*)
auth_service_add_via_admin_account_option="${1##*=}"
;;
--auth-service-add-via-admin-password=*)
auth_service_add_via_admin_password_option="${1##*=}"
;;
--auth-service-account=*)
auth_service_account_option="${1##*=}"
;;
--auth-service-password=*)
auth_service_password_option="${1##*=}"
;;
--auth-jamf-client=*)
auth_jamf_client_option="${1##*=}"
;;
--auth-jamf-secret=*)
auth_jamf_secret_option="${1##*=}"
;;
--auth-jamf-account=*)
auth_jamf_account_option="${1##*=}"
;;
--auth-jamf-password=*)
auth_jamf_password_option="${1##*=}"
;;
--auth-delete-all)
auth_delete_all_option="TRUE"
;;
--auth-jamf-custom-url=*)
auth_jamf_custom_url_option="${1##*=}"
;;
--auth-credential-failover-to-user)
auth_credential_failover_to_user_option="TRUE"
;;
--auth-credential-failover-to-user-off)
auth_credential_failover_to_user_option="FALSE"
;;
--auth-mdm-failover-to-user=*)
auth_mdm_failover_to_user_option="${1##*=}"
;;
-T | --test-mode)
test_mode_option="TRUE"
;;
-t | --test-mode-off)
test_mode_option="FALSE"
;;
--test-mode-timeout=*)
test_mode_timeout_option="${1##*=}"
;;
--test-storage-update=*)
test_storage_update_option="${1##*=}"
;;
--test-storage-upgrade=*)
test_storage_upgrade_option="${1##*=}"
;;
--test-battery-level=*)
test_battery_level_option="${1##*=}"
;;
-l | -L | --open-logs)
open_logs_option="TRUE"
;;
-x | -X | --reset-super)
reset_super_option="TRUE"
;;
-V | --verbose-mode)
verbose_mode_option="TRUE"
;;
-v | --verbose-mode-off)
verbose_mode_option="FALSE"
;;
*)
unrecognized_options_array+=("$1")
;;
esac
shift
done
# Error log any unrecognized options.
[[ -n "${unrecognized_options_array[*]}" ]] && show_usage
}
# Collect any parameters stored in ${SUPER_MANAGED_PLIST} and/or ${SUPER_LOCAL_PLIST}.
get_preferences() {
# First handle any preference deletion requests.
local workflow_reset_super_after_completion_now_local
workflow_reset_super_after_completion_now_local=$(defaults read "${SUPER_LOCAL_PLIST}" WorkflowResetSuperAfterCompletionNow 2>/dev/null)
if [[ "${reset_super_option}" == "TRUE" ]] || [[ "${workflow_reset_super_after_completion_now_local}" -eq 1 ]]; then
log_super "Status: Deleting all local (non-managed and non-authentication) preferences."
# Backup any preferences made before this function and saved authentication preferences first.
local auth_ask_user_to_save_password_backup
auth_ask_user_to_save_password_backup=$(defaults read "${SUPER_LOCAL_PLIST}" AuthAskUserToSavePassword 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_ask_user_to_save_password_backup: ${auth_ask_user_to_save_password_backup}"
local auth_local_account_backup
auth_local_account_backup=$(defaults read "${SUPER_LOCAL_PLIST}" AuthLocalAccount 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_local_account_backup: ${auth_local_account_backup}"
local auth_service_account_backup
auth_service_account_backup=$(defaults read "${SUPER_LOCAL_PLIST}" AuthServiceAccount 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_service_account_backup: ${auth_service_account_backup}"
local auth_jamf_client_backup
auth_jamf_client_backup=$(defaults read "${SUPER_LOCAL_PLIST}" AuthJamfClient 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_jamf_client_backup: ${auth_jamf_client_backup}"
local auth_jamf_account_backup
auth_jamf_account_backup=$(defaults read "${SUPER_LOCAL_PLIST}" AuthJamfAccount 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_jamf_account_backup: ${auth_jamf_account_backup}"
local auth_legacy_local_account_backup
auth_legacy_local_account_backup=$(defaults read "${SUPER_LOCAL_PLIST}" LocalAccount 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_legacy_local_account_backup: ${auth_legacy_local_account_backup}"
local auth_legacy_super_account_backup
auth_legacy_super_account_backup=$(defaults read "${SUPER_LOCAL_PLIST}" SuperAccount 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_legacy_super_account_backup: ${auth_legacy_super_account_backup}"
local auth_legacy_jamf_account_backup
auth_legacy_jamf_account_backup=$(defaults read "${SUPER_LOCAL_PLIST}" JamfAccount 2>/dev/null)
[[ "${verbose_mode_option}" == "TRUE" ]] && log_super "Verbose Mode: Function ${FUNCNAME[0]}: Line ${LINENO}: auth_legacy_jamf_account_backup: ${auth_legacy_jamf_account_backup}"
# Delete and/or reset locally saved items.
defaults delete "${SUPER_LOCAL_PLIST}"
rm -f "${SUPER_FOLDER}/.WorkflowInstallNow" 2>/dev/null # This is cleaning up a legacy item.
rm -f "${SUPER_FOLDER}/.WorkflowRestartValidate" 2>/dev/null # This is cleaning up a legacy item.
rm -r "${SUPER_FOLDER}/icon.png" 2>/dev/null # This is cleaning up a legacy item.
rm -r "${DISPLAY_ICON_LIGHT_FILE_CACHE}" 2>/dev/null
rm -r "${DISPLAY_ICON_DARK_FILE_CACHE}" 2>/dev/null
check_software_status_required="TRUE" # This will trigger the reset_software_update_status() function.
rm -f "${SOFA_MACOS_JSON_ETAG_CACHE}" 2>/dev/null
rm -f "${SOFA_MACOS_JSON_CACHE}" 2>/dev/null
defaults write "${SUPER_LOCAL_PLIST}" SuperVersion -string "${SUPER_VERSION}"
[[ "${verbose_mode_option}" == "TRUE" ]] && defaults write "${SUPER_LOCAL_PLIST}" VerboseMode -bool true
# Restore any saved preferences from backup.
[[ "${auth_ask_user_to_save_password_backup}" -eq 1 ]] && defaults write "${SUPER_LOCAL_PLIST}" AuthAskUserToSavePassword -bool true
[[ "${auth_local_account_backup}" -eq 1 ]] && defaults write "${SUPER_LOCAL_PLIST}" AuthLocalAccount -bool true
[[ "${auth_service_account_backup}" -eq 1 ]] && defaults write "${SUPER_LOCAL_PLIST}" AuthServiceAccount -bool true
[[ "${auth_jamf_client_backup}" -eq 1 ]] && defaults write "${SUPER_LOCAL_PLIST}" AuthJamfClient -bool true
[[ "${auth_jamf_account_backup}" -eq 1 ]] && defaults write "${SUPER_LOCAL_PLIST}" AuthJamfAccount -bool true
[[ -n "${auth_legacy_local_account_backup}" ]] && defaults write "${SUPER_LOCAL_PLIST}" LocalAccount -string "${auth_legacy_local_account_backup}"
[[ -n "${auth_legacy_super_account_backup}" ]] && defaults write "${SUPER_LOCAL_PLIST}" SuperAccount -string "${auth_legacy_super_account_backup}"
[[ -n "${auth_legacy_jamf_account_backup}" ]] && defaults write "${SUPER_LOCAL_PLIST}" JamfAccount -string "${auth_legacy_jamf_account_backup}"
else # Lesser delete/reset options.
if [[ "${deferral_timer_reset_all_option}" == "TRUE" ]]; then
log_super "Status: Resetting all local deferral timer preferences."
defaults delete "${SUPER_LOCAL_PLIST}" DeferralTimerDefault 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeferralTimerMenu 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeferralTimerFocus 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeferralTimerError 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeferralTimerWorkflowRelaunch 2>/dev/null
fi
if [[ "${scheduled_install_delete_all_option}" == "TRUE" ]]; then
log_super "Status: Deleting all scheduled installation preferences."
defaults delete "${SUPER_LOCAL_PLIST}" ScheduledInstallDays 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" ScheduledInstallDate 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" ScheduledInstallUserChoice 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" ScheduledInstallReminder 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" WorkflowScheduledInstall 2>/dev/null
fi
if [[ "${deadline_count_delete_all_option}" == "TRUE" ]]; then
log_super "Status: Deleting all local deadline count preferences."
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineCountFocus 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineCountSoft 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineCountHard 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineCounterFocus 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineCounterSoft 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineCounterHard 2>/dev/null
fi
if [[ "${deadline_days_delete_all_option}" == "TRUE" ]]; then
log_super "Status: Deleting all local deadline days preferences."
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineDaysFocus 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineDaysSoft 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineDaysHard 2>/dev/null
fi
if [[ "${deadline_date_delete_all_option}" == "TRUE" ]]; then
log_super "Status: Deleting all local deadline date preferences."
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineDateFocus 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineDateSoft 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DeadlineDateHard 2>/dev/null
fi
if [[ "${dialog_timeout_delete_all_option}" == "TRUE" ]]; then
log_super "Status: Deleting all local dialog timeout preferences."
defaults delete "${SUPER_LOCAL_PLIST}" DialogTimeoutDefault 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DialogTimeoutUserChoice 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DialogTimeoutSoftDeadline 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DialogTimeoutUserAuth 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DialogTimeoutInsufficientStorage 2>/dev/null
defaults delete "${SUPER_LOCAL_PLIST}" DialogTimeoutPowerRequired 2>/dev/null
fi
fi
# Collect any managed preferences from ${SUPER_MANAGED_PLIST}.
if [[ -f "${SUPER_MANAGED_PLIST}.plist" ]]; then
local install_macos_major_upgrades_managed
install_macos_major_upgrades_managed=$(defaults read "${SUPER_MANAGED_PLIST}" InstallMacOSMajorUpgrades 2>/dev/null)
local install_macos_major_version_target_managed
install_macos_major_version_target_managed=$(defaults read "${SUPER_MANAGED_PLIST}" InstallMacOSMajorVersionTarget 2>/dev/null)
local install_rapid_security_responses_managed
install_rapid_security_responses_managed=$(defaults read "${SUPER_MANAGED_PLIST}" InstallRapidSecurityResponses 2>/dev/null)
local install_non_system_updates_without_restarting_managed
install_non_system_updates_without_restarting_managed=$(defaults read "${SUPER_MANAGED_PLIST}" InstallNonSystemUpdatesWithoutRestarting 2>/dev/null)
local install_jamf_policy_triggers_managed
install_jamf_policy_triggers_managed=$(defaults read "${SUPER_MANAGED_PLIST}" InstallJamfPolicyTriggers 2>/dev/null)
local install_jamf_policy_triggers_without_restarting_managed
install_jamf_policy_triggers_without_restarting_managed=$(defaults read "${SUPER_MANAGED_PLIST}" InstallJamfPolicyTriggersWithoutRestarting 2>/dev/null)
local workflow_install_now_managed
workflow_install_now_managed=$(defaults read "${SUPER_MANAGED_PLIST}" WorkflowInstallNow 2>/dev/null)
local workflow_only_download_managed
workflow_only_download_managed=$(defaults read "${SUPER_MANAGED_PLIST}" WorkflowOnlyDownload 2>/dev/null)
local workflow_restart_without_updates_managed
workflow_restart_without_updates_managed=$(defaults read "${SUPER_MANAGED_PLIST}" WorkflowRestartWithoutUpdates 2>/dev/null)
local workflow_disable_update_check_managed
workflow_disable_update_check_managed=$(defaults read "${SUPER_MANAGED_PLIST}" WorkflowDisableUpdateCheck 2>/dev/null)
local workflow_disable_relaunch_managed
workflow_disable_relaunch_managed=$(defaults read "${SUPER_MANAGED_PLIST}" WorkflowDisableRelaunch 2>/dev/null)
local deferral_timer_default_managed
deferral_timer_default_managed=$(defaults read "${SUPER_MANAGED_PLIST}" DeferralTimerDefault 2>/dev/null)
local deferral_timer_menu_managed
deferral_timer_menu_managed=$(defaults read "${SUPER_MANAGED_PLIST}" DeferralTimerMenu 2>/dev/null)
local deferral_timer_focus_managed
deferral_timer_focus_managed=$(defaults read "${SUPER_MANAGED_PLIST}" DeferralTimerFocus 2>/dev/null)
local deferral_timer_error_managed