-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathjamf-upload.sh
executable file
·1154 lines (1105 loc) · 55.1 KB
/
jamf-upload.sh
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
: <<DOC
A wrapper script for running the JamfUploader processors in a standalone fashion, without running an AutoPkg recipe.
DOC
###########
## USAGE ##
###########
usage() {
echo "
Usage:
./jamf-upload.sh [object_type] [--help] [arguments]
Valid object types:
account
category
group | computergroup
groupdelete | computergroupdelete
mobiledevicegroup
profile | computerprofile
mobiledeviceprofile
ea | extensionattribute
icon
ldap_server
logflush
macapp
patch
pkg | package
pkgdata
pkgclean
pkgcalc | packagerecalculate
policy
policydelete
policyflush
restriction | softwarerestriction
script
slack
teams
Arguments:
--prefs <path> Inherit AutoPkg prefs file provided by the full path to the file
-v[vvv] Set value of verbosity
--url <JSS_URL> The Jamf Pro URL
--user <API_USERNAME> The API username
--pass <API_PASSWORD> The API user's password
--clientid <ID> An API Client ID
--clientsecret <string> An API Client Secret
--recipe-dir <RECIPE_DIR>
Account arguments:
--name <string> The name
--type <string> The account type. Must be 'user' or 'group'.
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Category arguments:
--name <string> The name
--priority <int> The priority
--replace Replace existing item
Computer Group arguments:
--name <string> The name
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Computer Group Delete arguments:
--name <string> The computer group name
Computer Profile arguments:
--name <string> The name
--template <path> XML template
--payload <path> A profile payload
--mobileconfig <path> A mobileconfig file
--identifier <string> Identifier for the profile
--category <string> The category. Must exist.
--organization <string> Organisation for the profile
--description <string> Description for the profile
--computergroup <str> Computer Group to set as target in the profile
--key X=Y Substitutable values in the script. Multiple values can be supplied
--replace Replace existing item
--retain-scope Retain existing scope when updating an item
Dock Item arguments:
--name <string> The name
--type <string> Type of Dock Item - either 'App', 'File' or 'Folder'
--path <string> Path of Dock Item - e.g. 'file:///Applications/Safari.app/'
--replace Replace existing item
Extension Attribute arguments:
--name <string> The name
--script <path> Full path of the script to be uploaded
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Icon arguments:
--icon <path> Full path to an icon file
--icon-uri <url> The icon URI from https://ics.services.jamfcloud.com/icon
LDAP Server arguments:
--name <string> The name
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Mac App Store App arguments:
--name <string> The name
--cloned-from The name of the Mac App Store app from which to clone
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Mobile Device Group arguments:
--name <string> The name
--template <path> XML template
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Mobile Device Profile arguments:
--name <string> The name
--template <path> XML template
--mobileconfig <path> A mobileconfig file
--identifier <string> Identifier for the profile
--category <string> The category. Must exist.
--organization <string> Organisation for the profile
--description <string> Description for the profile
--mobiledevicegroup <string>
Mobile Device Group to set as target in the profile
--key X=Y Substitutable values in the script. Multiple values can be supplied
--replace Replace existing item
Package arguments:
--name <string> The package display name
--pkg_name <path> The package filename
--pkg <path> Full path to the package to upload
--priority <int> The priority
--category <string> The category. Must exist.
--smb-url <url> URL of the fileshare distribution point (on premises Jamf Pro only)
--smb-user <SMB_USERNAME>
Username with share access
--smb_pass <SMB_PASSWORD>
Password of the user
--info <string> Pkg information field
--notes <string> Pkg notes field
--reboot_required Set the 'reboot required' option
--os-requirement <string>
Set OS requirement for the pkg
--required-processor <string>
Set CPU type requirement for the pkg
--send-notification Set to send a notification when the package is installed
--replace-pkg-metadata Set to replace the pkg metadata if no package is uploaded
--skip-metadata-upload Set to skip pkg metadata upload
--replace Replace existing item
--jcds Deprecated, ignored
--jcds2 Use jcds endpoint for package upload to JCDS
--aws Use AWS CDP for package upload. Requires aws-cli to be installed
--api Use v1/packages endpoint for package upload to cloud DP
--recalculate Recalculate packages if using --jcds2 or --api modes
Package Clean arguments:
--name <string> The name to match
--smb-url <url> URL of the fileshare distribution point (on premises Jamf Pro only)
--smb-user <SMB_USERNAME>
Username with share access
--smb_pass <SMB_PASSWORD>
Password of the user
Package Metadata arguments:
--name <string> The package display name
--pkg <path> The package filename
--priority <int> The priority
--category <string> The category. Must exist.
--info <string> Pkg information field
--notes <string> Pkg notes field
--reboot_required Set the 'reboot required' option
--os-requirement <string>
Set OS requirement for the pkg
--required-processor <string>
Set CPU type requirement for the pkg
--send-notification Set to send a notification when the package is installed
--replace Set to replace the pkg metadata if no package is uploaded
Package Recalculate arguments: None
Policy arguments:
--name <string> The name
--template <path> XML template
--icon <path> Full path to an icon file for Self Service policies
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
--replace-icon Set to replace the existing icon if it has the same name
--retain-scope Retain existing scope when updating an item
Policy Delete arguments:
--name <string> The policy name
Policy Log Flush arguments:
--name <string> The policy name
--interval The log flush interval
Patch Policy arguments:
--name <string> The patch policy name
--pkg <path> Name of the package to uplaod
--version <string> The package (or app) version
--title <string> The patch software title
--template <path> XML template
--policy <string> Name of an existing policy containing the desired icon for the patch policy
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Script arguments:
--name <string> The name
--script <path> Full path of the script to be uploaded
--key X=Y Substitutable values in the script. Multiple values can be supplied
--parameter[4-11]
Script parameter labels
--replace Replace existing item
Software Restriction arguments
--name <string> The name
--template <path> XML template
--process-name Process name to restrict
--display-message Message to display to users when the restriction is invoked
--match-exact-process-name
Match only the exact process name if True
--send-notification Send a notification when the restriction is invoked if True
--kill-process Kill the process when the restriction is invoked if True
--delete-executable Delete the executable when the restriction is invoked if True
--key X=Y Substitutable values in the template. Multiple values can be supplied
--replace Replace existing item
Slack arguments:
--name <string> The name
--policy-category <string>
The POLICY_CATEGORY
--pkg-category <string> The PKG_CATEGORY
--pkg_name <string> The package name
--version <string> The package (or app) version
--pkg-uploaded Pretends that a package was uploaded (sets a value to jamfpackageuploader_summary_result)
--policy-uploaded Pretends that a policy was uploaded (sets a value to jamfpolicyuploader_summary_result)
--slack-url <url> The slack_webhook_url
--slack-user <string> The Slack user to display
--icon <url> The Slack icon URL
--channel <string> The Slack channel to post to
--emoji <string> the Slack icon emoji
Teams arguments:
--name <string> The name
--policy-category <string>
The POLICY_CATEGORY
--pkg-category <string> The PKG_CATEGORY
--patch_name <string> The patch policy name
--pkg_name <string> The package name
--version <string> The package (or app) version
--patch-uploaded Pretends that a patch was updated (sets a value to jamfpatchuploader_summary_result)
--pkg-uploaded Pretends that a package was uploaded (sets a value to jamfpackageuploader_summary_result)
--policy-uploaded Pretends that a policy was uploaded (sets a value to jamfpolicyuploader_summary_result)
--teams-url <url> The teams_webhook_url
--teams-user <string> The Teams user to display
--icon <url> The Slack icon URL
"
}
##############
## DEFAULTS ##
##############
temp_processor_plist="/tmp/processor.plist"
temp_receipt="/tmp/processor_receipt.plist"
# this folder
DIR=$(dirname "$0")
processors_directory="$DIR/JamfUploaderProcessors"
# processors_directory="$DIR/JamfUploaderProcessorsStandalone"
###############
## ARGUMENTS ##
###############
rm -rf "$temp_processor_plist" # delete any existing file (or folder) at temp_processor_plist path
/usr/libexec/PlistBuddy -c 'Clear dict' "$temp_processor_plist" # ensure an empty processor at the start of the run
# NOTE: DO NOT use "plutil -create" to create a new empty plist since that option is only available on macOS 12 Monterey and newer.
# set default for RECIPE_DIR (required for templates)
if plutil -replace RECIPE_DIR -string "." "$temp_processor_plist"; then
echo " [jamf-upload] Wrote RECIPE_DIR='.' into $temp_processor_plist"
fi
object="$1"
if [[ $object == "account" ]]; then
processor="JamfAccountUploader"
elif [[ $object == "category" ]]; then
processor="JamfCategoryUploader"
elif [[ $object == "group" || $object == "computergroup" ]]; then
processor="JamfComputerGroupUploader"
elif [[ $object == "groupdelete" || $object == "computergroupdelete" ]]; then
processor="JamfComputerGroupDeleter"
elif [[ $object == "profile" || $object == "computerprofile" ]]; then
processor="JamfComputerProfileUploader"
elif [[ $object == "dock" || $object == "dockitem" ]]; then
processor="JamfDockItemUploader"
elif [[ $object == "ea" || $object == "extensionattribute" ]]; then
processor="JamfExtensionAttributeUploader"
elif [[ $object == "icon" ]]; then
processor="JamfIconUploader"
elif [[ $object == "ldap_server" ]]; then
processor="JamfClassicAPIObjectUploader"
elif [[ $object == "macapp" ]]; then
processor="JamfMacAppUploader"
elif [[ $object == "mobiledevicegroup" ]]; then
processor="JamfMobileDeviceGroupUploader"
elif [[ $object == "mobiledeviceprofile" ]]; then
processor="JamfMobileDeviceProfileUploader"
elif [[ $object == "pkg" || $object == "package" ]]; then
processor="JamfPackageUploader"
elif [[ $object == "pkgclean" ]]; then
processor="JamfPackageCleaner"
elif [[ $object == "pkgdata" ]]; then
processor="JamfPkgMetadataUploader"
elif [[ $object == "pkgcalc" || $object == "packagerecalculate" ]]; then
processor="JamfPackageRecalculator"
elif [[ $object == "policy" ]]; then
processor="JamfPolicyUploader"
elif [[ $object == "policydelete" ]]; then
processor="JamfPolicyDeleter"
elif [[ $object == "policyflush" ]]; then
processor="JamfPolicyLogFlusher"
elif [[ $object == "patch" ]]; then
processor="JamfPatchUploader"
elif [[ $object == "restriction" || $object == "softwarerestriction" ]]; then
processor="JamfSoftwareRestrictionUploader"
elif [[ $object == "script" ]]; then
processor="JamfScriptUploader"
elif [[ $object == "slack" ]]; then
processor="JamfUploaderSlacker"
elif [[ $object == "teams" ]]; then
processor="JamfUploaderTeamsNotifier"
elif [[ $object == "--help" || $object == "help" || $object == "-h" ]]; then
usage
exit 0
else
usage
exit 1
fi
shift
if [[ ! "$1" ]]; then
usage
exit 1
fi
while test $# -gt 0 ; do
case "$1" in
--prefs)
shift
autopkg_prefs="$1"
if /usr/libexec/PlistBuddy -c 'Merge /dev/stdin' "$temp_processor_plist" <<< "$(defaults export "$autopkg_prefs" -)"; then # Existing keys in temp_processor_plist will be preserved, only non-existent keys from autopkg_prefs will be added to temp_processor_plist. Any existing duplicate keys WILL NOT be overwritten.
echo " [jamf-upload] Wrote autopkg prefs into $temp_processor_plist"
fi
;;
-v*)
verbose="${#1}"
verbosity=$(( verbose-1 ))
if plutil -replace verbose -integer $verbosity "$temp_processor_plist"; then
echo " [jamf-upload] Wrote verbose='$verbosity' into $temp_processor_plist"
fi
;;
--url)
shift
if plutil -replace JSS_URL -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote JSS_URL='$1' into $temp_processor_plist"
fi
;;
--recipe-dir)
shift
if plutil -replace RECIPE_DIR -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote RECIPE_DIR='$1' into $temp_processor_plist"
fi
;;
--user*)
## allows --user or --username
shift
if plutil -replace API_USERNAME -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote API_USERNAME='$1' into $temp_processor_plist"
fi
;;
--pass*)
## allows --pass or --password
shift
if plutil -replace API_PASSWORD -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote API_PASSWORD='[redacted]' into $temp_processor_plist"
fi
;;
--clientid)
shift
if plutil -replace CLIENT_ID -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote CLIENT_ID='$1' into $temp_processor_plist"
fi
;;
--clientsecret)
shift
if plutil -replace CLIENT_SECRET -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote CLIENT_SECRET='$1' into $temp_processor_plist"
fi
;;
--type)
shift
if [[ $processor == "JamfAccountUploader" ]]; then
if plutil -replace account_type -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote account_type='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfDockItemUploader" ]]; then
if plutil -replace dock_item_type -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote dock_item_type='$1' into $temp_processor_plist"
fi
fi
;;
--priority)
shift
if [[ $processor == "JamfCategoryUploader" ]]; then
if plutil -replace category_priority -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote category_priority='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace pkg_priority -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_priority='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace script_priority -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote script_priority='$1' into $temp_processor_plist"
fi
fi
;;
--replace)
if [[ $processor == "JamfAccountUploader" ]]; then
if plutil -replace replace_account -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_account='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfCategoryUploader" ]]; then
if plutil -replace replace_category -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_category='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfClassicAPIObjectUploader" ]]; then
if plutil -replace replace_object -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_object='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfComputerGroupUploader" || $processor == "JamfMobileDeviceGroupUploader" ]]; then
if plutil -replace replace_group -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_group='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace replace_profile -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_profile='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfDockItemUploader" ]]; then
if plutil -replace replace_dock_item -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_dock_item='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfExtensionAttributeUploader" ]]; then
if plutil -replace replace_ea -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_ea='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfMacAppUploader" ]]; then
if plutil -replace replace_macapp -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_macapp='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace replace_pkg -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_pkg='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPatchUploader" ]]; then
if plutil -replace replace_patch -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_patch='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPolicyUploader" ]]; then
if plutil -replace replace_policy -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_policy='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace replace_restriction -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_restriction='True' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace replace_script -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_script='True' into $temp_processor_plist"
fi
fi
;;
-n|--name)
shift
if [[ $processor == "JamfAccountUploader" ]]; then
if plutil -replace account_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote account_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfCategoryUploader" ]]; then
if plutil -replace category_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote category_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfClassicAPIObjectUploader" ]]; then
if plutil -replace object_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote object_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfComputerGroupUploader" || $processor == "JamfComputerGroupDeleter" ]]; then
if plutil -replace computergroup_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote computergroup_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace profile_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote profile_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfDockItemUploader" ]]; then
if plutil -replace dock_item_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote dock_item_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfExtensionAttributeUploader" ]]; then
if plutil -replace ea_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote ea_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfMacAppUploader" ]]; then
if plutil -replace macapp_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote macapp_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfMobileDeviceGroupUploader" ]]; then
if plutil -replace mobiledevicegroup_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote mobiledevicegroup_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace pkg_display_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_display_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPackageCleaner" ]]; then
if plutil -replace pkg_name_match -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_name_match='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPatchUploader" ]]; then
if plutil -replace patch_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote patch_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPolicyUploader" || $processor == "JamfPolicyDeleter" || $processor == "JamfPolicyLogFlusher" ]]; then
if plutil -replace policy_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote policy_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace restriction_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote restriction_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace script_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote script_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfUploaderSlacker" || $processor == "JamfUploaderTeamsNotifier" ]]; then
if plutil -replace NAME -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote NAME='$1' into $temp_processor_plist"
fi
fi
;;
--template)
shift
if [[ $processor == "JamfAccountUploader" ]]; then
if plutil -replace account_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote account_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfClassicAPIObjectUploader" ]]; then
if plutil -replace object_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote object_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfComputerGroupUploader" ]]; then
if plutil -replace computergroup_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote computergroup_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace profile_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote profile_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfMacAppUploader" ]]; then
if plutil -replace macapp_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote macapp_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfMobileDeviceGroupUploader" ]]; then
if plutil -replace mobiledevicegroup_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote mobiledevicegroup_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPatchUploader" ]]; then
if plutil -replace patch_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote patch_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPolicyUploader" ]]; then
if plutil -replace policy_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote policy_template='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace restriction_template -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote restriction_template='$1' into $temp_processor_plist"
fi
fi
;;
--payload)
shift
if [[ $processor == "JamfComputerProfileUploader" ]]; then
if plutil -replace payload -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote payload='$1' into $temp_processor_plist"
fi
fi
;;
--mobileconfig)
shift
if [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace mobileconfig -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote mobileconfig='$1' into $temp_processor_plist"
fi
fi
;;
--identifier)
shift
if [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace identifier -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote identifier='$1' into $temp_processor_plist"
fi
fi
;;
--category)
shift
if [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace profile_category -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote profile_category='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace pkg_category -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_category='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace script_category -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote script_category='$1' into $temp_processor_plist"
fi
fi
;;
--organization)
shift
if [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace organization -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote organization='$1' into $temp_processor_plist"
fi
fi
;;
--description)
shift
if [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace profile_description -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote profile_description='$1' into $temp_processor_plist"
fi
fi
;;
--computergroup)
shift
if [[ $processor == "JamfComputerProfileUploader" ]]; then
if plutil -replace profile_computergroup -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote profile_computergroup='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace restriction_computergroup -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote restriction_computergroup='$1' into $temp_processor_plist"
fi
fi
;;
--retain-existing-scope)
if [[ $processor == "JamfComputerProfileUploader" || $processor == "JamfPolicyUploader" ]]; then
if plutil -replace retain_scope -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote retain_scope='True' into $temp_processor_plist"
fi
fi
;;
--path)
shift
if [[ $processor == "JamfDockItemUploader" ]]; then
if plutil -replace dock_item_path -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote dock_item_path='$1' into $temp_processor_plist"
fi
fi
;;
--script|--script_path)
shift
if [[ $processor == "JamfExtensionAttributeUploader" ]]; then
if plutil -replace ea_script_path -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote ea_script_path='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace script_path -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote script_path='$1' into $temp_processor_plist"
fi
fi
;;
--icon)
shift
if [[ $processor == "JamfIconUploader" ]]; then
if plutil -replace icon_file -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote icon_file='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPolicyUploader" ]]; then
if plutil -replace icon -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote icon='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfUploaderSlacker" ]]; then
if plutil -replace slack_icon_url -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote slack_icon_url='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfUploaderTeamsNotifier" ]]; then
if plutil -replace teams_icon_url -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote teams_icon_url='$1' into $temp_processor_plist"
fi
fi
;;
--icon-uri|--icon-url)
shift
if [[ $processor == "JamfIconUploader" ]]; then
if plutil -replace icon_uri -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote icon_uri='$1' into $temp_processor_plist"
fi
fi
;;
--clone-from|--clone_from)
shift
if [[ $processor == "JamfMacAppUploader" ]]; then
if plutil -replace clone_from -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote clone_from='$1' into $temp_processor_plist"
fi
fi
;;
--mobiledevicegroup)
shift
if [[ $processor == "JamfMobileDeviceProfileUploader" ]]; then
if plutil -replace profile_mobiledevicegroup -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote profile_mobiledevicegroup='$1' into $temp_processor_plist"
fi
fi
;;
--smb_url|--smb-url)
shift
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace SMB_URL -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote SMB_URL='$1' into $temp_processor_plist"
fi
fi
;;
--smb_user*|--smb-user*)
## allows --smb_user, --smb_username, --smb-user, --smb-username
shift
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace SMB_USERNAME -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote SMB_USERNAME='$1' into $temp_processor_plist"
fi
fi
;;
--smb_pass*|--smb-pass*)
## allows --smb_pass, --smb_password, --smb-pass, --smb-password
shift
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace SMB_PASSWORD -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote SMB_PASSWORD='[redacted]' into $temp_processor_plist"
fi
fi
;;
--pkg|--pkg_path|--pkg-path)
shift
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace pkg_path -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_path='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace pkg_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_name='$1' into $temp_processor_plist"
fi
fi
;;
--pkg-name|--pkg_name)
shift
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" || $processor == "JamfUploaderSlacker" || $processor == "JamfUploaderTeamsNotifier" || $processor == "JamfPatchUploader" ]]; then
if plutil -replace pkg_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_name='$1' into $temp_processor_plist"
fi
fi
;;
--info)
shift
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace pkg_info -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_info='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace script_info -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote script_info='$1' into $temp_processor_plist"
fi
fi
;;
--notes)
shift
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace pkg_notes -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_notes='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace script_notes -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote script_notes='$1' into $temp_processor_plist"
fi
fi
;;
--reboot_required|--reboot-required)
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace reboot_required -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote reboot_required='$1' into $temp_processor_plist"
fi
fi
;;
--os_requirement*|--os-requirement*|--osrequirement*)
## allows --os_requirement, --os-requirement, --osrequirements
shift
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace os_requirements -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote os_requirements='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace osrequirements -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote osrequirements='$1' into $temp_processor_plist"
fi
fi
;;
--required_processor|--required-processor)
shift
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace required_processor -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote required_processor='$1' into $temp_processor_plist"
fi
fi
;;
--send_notification|--send-notification)
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace send_notification -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote send_notification='true' into $temp_processor_plist"
fi
elif [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace restriction_send_notification -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote restriction_send_notification='true' into $temp_processor_plist"
fi
fi
;;
--replace_pkg_metadata|--replace-pkg-metadata)
if [[ $processor == "JamfPackageUploader" || $processor == "JamfPkgMetadataUploader" ]]; then
if plutil -replace replace_pkg_metadata -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_pkg_metadata='True' into $temp_processor_plist"
fi
fi
;;
--skip_metadata_upload|--skip-metadata-upload)
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace skip_metadata_upload -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote skip_metadata_upload='True' into $temp_processor_plist"
fi
fi
;;
--jcds)
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace jcds_mode -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote jcds_mode='True' into $temp_processor_plist"
fi
fi
;;
--jcds2)
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace jcds2_mode -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote jcds2_mode='True' into $temp_processor_plist"
fi
fi
;;
--aws)
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace aws_cdp_mode -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote aws_cdp_mode='True' into $temp_processor_plist"
fi
fi
;;
--api)
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace pkg_api_mode -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote pkg_api_mode='True' into $temp_processor_plist"
fi
fi
;;
--recalculate)
if [[ $processor == "JamfPackageUploader" ]]; then
if plutil -replace recalculate -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote recalculate='True' into $temp_processor_plist"
fi
fi
;;
--keep)
shift
if [[ $processor == "JamfPackageCleaner" ]]; then
if plutil -replace versions_to_keep -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote versions_to_keep='$1' into $temp_processor_plist"
fi
fi
;;
--title)
shift
if [[ $processor == "JamfPatchUploader" ]]; then
if plutil -replace patch_softwaretitle -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote patch_softwaretitle='$1' into $temp_processor_plist"
fi
fi
;;
--policy-name)
shift
if [[ $processor == "JamfPatchUploader" ]]; then
if plutil -replace patch_icon_policy_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote patch_icon_policy_name='$1' into $temp_processor_plist"
fi
elif [[ $processor == "JamfUploaderSlacker" || $processor == "JamfUploaderTeamsNotifier" ]]; then
if plutil -replace policy_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote policy_name='$1' into $temp_processor_plist"
fi
fi
;;
--version)
shift
if [[ $processor == "JamfPatchUploader" || $processor == "JamfUploaderSlacker" || $processor == "JamfUploaderTeamsNotifier" ]]; then
if plutil -replace version -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote version='$1' into $temp_processor_plist"
fi
fi
;;
--replace_icon|--replace-icon)
if [[ $processor == "JamfPolicyUploader" ]]; then
if plutil -replace replace_icon -string "True" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote replace_icon='True' into $temp_processor_plist"
fi
fi
;;
--interval)
shift
if [[ $processor == "JamfPolicyLogFlusher" ]]; then
if plutil -replace logflush_interval -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote logflush_interval='$1' into $temp_processor_plist"
fi
fi
;;
"--script_parameter"*|"--script-parameter"*|"--parameter"*)
param_number="${1: -1}"
if [[ ! $param_number ]]; then
exit 1
fi
shift
if [[ $processor == "JamfScriptUploader" ]]; then
if plutil -replace "script_parameter$param_number" -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote script_parameter$param_number='$1' into $temp_processor_plist"
fi
fi
;;
--process_name|--process-name)
shift
if [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace process_name -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote process_name='$1' into $temp_processor_plist"
fi
fi
;;
--display_message|--display-message)
shift
if [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace display_message -string "$1" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote display_message='$1' into $temp_processor_plist"
fi
fi
;;
--match_exact_process_name|--match-exact-process-name)
if [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace match_exact_process_name -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote match_exact_process_name='true' into $temp_processor_plist"
fi
fi
;;
--kill_process|--kill-process)
if [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace kill_process -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote kill_process='true' into $temp_processor_plist"
fi
fi
;;
--delete_executable|--delete-executable)
if [[ $processor == "JamfSoftwareRestrictionUploader" ]]; then
if plutil -replace delete_executable -string "true" "$temp_processor_plist"; then
echo " [jamf-upload] Wrote delete_executable='true' into $temp_processor_plist"
fi
fi
;;
--pkg-category)