-
Notifications
You must be signed in to change notification settings - Fork 212
/
installGoogleChrome.zsh
executable file
·785 lines (637 loc) · 28.1 KB
/
installGoogleChrome.zsh
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
#!/bin/bash
#set -x
############################################################################################
##
## Script to install the latest [Google Chrome]
##
## VER 3.0.1
##
## Change Log
##
## 2021-11-19 - Added logic to handle both APP and PKG inside DMG file. New function DMGPKG
##
############################################################################################
## Copyright (c) 2020 Microsoft Corp. All rights reserved.
## Scripts are not supported under any Microsoft standard support program or service. The scripts are provided AS IS without warranty of any kind.
## Microsoft disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a
## particular purpose. The entire risk arising out of the use or performance of the scripts and documentation remains with you. In no event shall
## Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever
## (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary
## loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility
## of such damages.
## Feedback: neiljohn@microsoft.com
# User Defined variables
weburl="https://dl.google.com/chrome/mac/stable//googlechrome.dmg" # What is the Azure Blob Storage URL?
appname="Google Chrome" # The name of our App deployment script (also used for Octory monitor)
app="Google Chrome.app" # The actual name of our App once installed
logandmetadir="/Library/Logs/Microsoft/IntuneScripts/GoogleChrome" # The location of our logs and last updated data
processpath="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" # The process name of the App we are installing
terminateprocess="true" # Do we want to terminate the running process? If false we'll wait until its not running
autoUpdate="true" # Application updates itself, if already installed we should exit
# Generated variables
tempdir=$(mktemp -d)
log="$logandmetadir/$appname.log" # The location of the script log file
metafile="$logandmetadir/$appname.meta" # The location of our meta file (for updates)
function installAria2c () {
#####################################
## Aria2c installation
#####################
ARIA2="/usr/local/aria2/bin/aria2c"
aria2Url="https://github.com/aria2/aria2/releases/download/release-1.35.0/aria2-1.35.0-osx-darwin.dmg"
if [[ -f $ARIA2 ]]; then
echo "$(date) | Aria2 already installed, nothing to do"
else
echo "$(date) | Aria2 missing, lets download and install"
filename=$(basename "$aria2Url")
output="$tempdir/$filename"
curl -f -s --connect-timeout 30 --retry 5 --retry-delay 60 -L -o "$output" "$aria2Url"
if [ $? -ne 0 ]; then
echo "$(date) | Aria download failed"
echo "$(date) | Output: [$output]"
echo "$(date) | URL [$aria2Url]"
exit 1
else
echo "$(date) | Downloaded aria2"
fi
# Mount aria2 DMG
mountpoint="$tempdir/aria2"
echo "$(date) | Mounting Aria DMG..."
hdiutil attach -quiet -nobrowse -mountpoint "$mountpoint" "$output"
if [ $? -ne 0 ]; then
echo "$(date) | Aria mount failed"
echo "$(date) | Mount: [$mountpoint]"
echo "$(date) | Temp File [$output]"
exit 1
else
echo "$(date) | Mounted DMG"
fi
# Install aria2 PKG from inside the DMG
sudo installer -pkg "$mountpoint/aria2.pkg" -target /
if [ $? -ne 0 ]; then
echo "$(date) | Install failed"
echo "$(date) | PKG: [$mountpoint/aria2.pkg]"
exit 1
else
echo "$(date) | Aria2 installed"
hdiutil detach -quiet "$mountpoint"
fi
rm -rf "$output"
fi
}
# function to delay script if the specified process is running
waitForProcess () {
#################################################################################################################
#################################################################################################################
##
## Function to pause while a specified process is running
##
## Functions used
##
## None
##
## Variables used
##
## $1 = name of process to check for
## $2 = length of delay (if missing, function to generate random delay between 10 and 60s)
## $3 = true/false if = "true" terminate process, if "false" wait for it to close
##
###############################################################
###############################################################
processName=$1
fixedDelay=$2
terminate=$3
echo "$(date) | Waiting for other [$processName] processes to end"
while ps aux | grep "$processName" | grep -v grep &>/dev/null; do
if [[ $terminate == "true" ]]; then
echo "$(date) | + [$appname] running, terminating [$processpath]..."
pkill -f "$processName"
return
fi
# If we've been passed a delay we should use it, otherwise we'll create a random delay each run
if [[ ! $fixedDelay ]]; then
delay=$(( $RANDOM % 50 + 10 ))
else
delay=$fixedDelay
fi
echo "$(date) | + Another instance of $processName is running, waiting [$delay] seconds"
sleep $delay
done
echo "$(date) | No instances of [$processName] found, safe to proceed"
}
# function to check if we need Rosetta 2
checkForRosetta2 () {
#################################################################################################################
#################################################################################################################
##
## Simple function to install Rosetta 2 if needed.
##
## Functions
##
## waitForProcess (used to pause script if another instance of softwareupdate is running)
##
## Variables
##
## None
##
###############################################################
###############################################################
echo "$(date) | Checking if we need Rosetta 2 or not"
# if Software update is already running, we need to wait...
waitForProcess "/usr/sbin/softwareupdate"
## Note, Rosetta detection code from https://derflounder.wordpress.com/2020/11/17/installing-rosetta-2-on-apple-silicon-macs/
OLDIFS=$IFS
IFS='.' read osvers_major osvers_minor osvers_dot_version <<< "$(/usr/bin/sw_vers -productVersion)"
IFS=$OLDIFS
if [[ ${osvers_major} -ge 11 ]]; then
# Check to see if the Mac needs Rosetta installed by testing the processor
processor=$(/usr/sbin/sysctl -n machdep.cpu.brand_string | grep -o "Intel")
if [[ -n "$processor" ]]; then
echo "$(date) | $processor processor installed. No need to install Rosetta."
else
# Check for Rosetta "oahd" process. If not found,
# perform a non-interactive install of Rosetta.
if /usr/bin/pgrep oahd >/dev/null 2>&1; then
echo "$(date) | Rosetta is already installed and running. Nothing to do."
else
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
if [[ $? -eq 0 ]]; then
echo "$(date) | Rosetta has been successfully installed."
else
echo "$(date) | Rosetta installation failed!"
exitcode=1
fi
fi
fi
else
echo "$(date) | Mac is running macOS $osvers_major.$osvers_minor.$osvers_dot_version."
echo "$(date) | No need to install Rosetta on this version of macOS."
fi
}
# Function to update the last modified date for this app
fetchLastModifiedDate() {
#################################################################################################################
#################################################################################################################
##
## This function takes the following global variables and downloads the URL provided to a temporary location
##
## Functions
##
## none
##
## Variables
##
## $logandmetadir = Directory to read nand write meta data to
## $metafile = Location of meta file (used to store last update time)
## $weburl = URL of download location
## $tempfile = location of temporary DMG file downloaded
## $lastmodified = Generated by the function as the last-modified http header from the curl request
##
## Notes
##
## If called with "fetchLastModifiedDate update" the function will overwrite the current lastmodified date into metafile
##
###############################################################
###############################################################
## Check if the log directory has been created
if [[ ! -d "$logandmetadir" ]]; then
## Creating Metadirectory
echo "$(date) | Creating [$logandmetadir] to store metadata"
mkdir -p "$logandmetadir"
fi
# generate the last modified date of the file we need to download
lastmodified=$(curl -sIL "$weburl" | grep -i "last-modified" | awk '{$1=""; print $0}' | awk '{ sub(/^[ \t]+/, ""); print }' | tr -d '\r')
if [[ $1 == "update" ]]; then
echo "$(date) | Writing last modifieddate [$lastmodified] to [$metafile]"
echo "$lastmodified" > "$metafile"
fi
}
function downloadApp () {
#################################################################################################################
#################################################################################################################
##
## This function takes the following global variables and downloads the URL provided to a temporary location
##
## Functions
##
## waitForCurl (Pauses download until all other instances of Curl have finished)
## downloadSize (Generates human readable size of the download for the logs)
##
## Variables
##
## $appname = Description of the App we are installing
## $weburl = URL of download location
## $tempfile = location of temporary DMG file downloaded
##
###############################################################
###############################################################
echo "$(date) | Starting downlading of [$appname]"
#download the file
updateSplashScreen wait Downloading # Swift Dialog
echo "$(date) | Downloading $appname"
cd "$tempdir"
#curl -f -s --connect-timeout 30 --retry 5 --retry-delay 60 -L -J -o "edge.pkg" "$weburl"
$ARIA2 -q -x16 -s16 -d "$tempdir" "$weburl" --download-result=hide --summary-interval=0
if [ $? == 0 ]; then
# We have downloaded a file, we need to know what the file is called and what type of file it is
tempSearchPath="$tempdir/*"
for f in $tempSearchPath; do
tempfile=$f
done
case $tempfile in
*.pkg|*.PKG)
packageType="PKG"
;;
*.zip|*.ZIP)
packageType="ZIP"
;;
*.dmg|*.DMG)
packageType="DMG"
;;
*)
# We can't tell what this is by the file name, lets look at the metadata
echo "$(date) | Unknown file type [$f], analysing metadata"
metadata=$(file "$tempfile")
if [[ "$metadata" == *"Zip archive data"* ]]; then
packageType="ZIP"
mv "$tempfile" "$tempdir/install.zip"
tempfile="$tempdir/install.zip"
fi
if [[ "$metadata" == *"xar archive"* ]]; then
packageType="PKG"
mv "$tempfile" "$tempdir/install.pkg"
tempfile="$tempdir/install.pkg"
fi
if [[ "$metadata" == *"bzip2 compressed data"* ]] || [[ "$metadata" == *"zlib compressed data"* ]] ; then
packageType="DMG"
mv "$tempfile" "$tempdir/install.dmg"
tempfile="$tempdir/install.dmg"
fi
;;
esac
if [[ ! $packageType ]]; then
echo "Failed to determine temp file type [$metadata]"
rm -rf "$tempdir"
else
echo "$(date) | Downloaded [$app] to [$tempfile]"
echo "$(date) | Detected install type as [$packageType]"
fi
else
echo "$(date) | Failure to download [$weburl] to [$tempfile]"
updateSplashScreen fail Failed # Swift Dialog
exit 1
fi
}
# Function to check if we need to update or not
function updateCheck() {
#################################################################################################################
#################################################################################################################
##
## This function takes the following dependencies and variables and exits if no update is required
##
## Functions
##
## fetchLastModifiedDate
##
## Variables
##
## $appname = Description of the App we are installing
## $tempfile = location of temporary DMG file downloaded
## $volume = name of volume mount point
## $app = name of Application directory under /Applications
##
###############################################################
###############################################################
echo "$(date) | Checking if we need to install or update [$appname]"
## Is the app already installed?
if [ -d "/Applications/$app" ]; then
# App is installed, if it's updates are handled by MAU we should quietly exit
if [[ $autoUpdate == "true" ]]; then
echo "$(date) | [$appname] is already installed and handles updates itself, exiting"
updateSplashScreen success Installed # Swift Dialog
exit 0;
fi
# App is already installed, we need to determine if it requires updating or not
echo "$(date) | [$appname] already installed, let's see if we need to update"
fetchLastModifiedDate
## Did we store the last modified date last time we installed/updated?
if [[ -d "$logandmetadir" ]]; then
if [ -f "$metafile" ]; then
previouslastmodifieddate=$(cat "$metafile")
if [[ "$previouslastmodifieddate" != "$lastmodified" ]]; then
echo "$(date) | Update found, previous [$previouslastmodifieddate] and current [$lastmodified]"
update="update"
else
echo "$(date) | No update between previous [$previouslastmodifieddate] and current [$lastmodified]"
updateSplashScreen success Installed # Swift Dialog
echo "$(date) | Exiting, nothing to do"
exit 0
fi
else
echo "$(date) | Meta file [$metafile] not found"
echo "$(date) | Unable to determine if update required, updating [$appname] anyway"
fi
fi
else
echo "$(date) | [$appname] not installed, need to download and install"
fi
}
## Install PKG Function
function installPKG () {
#################################################################################################################
#################################################################################################################
##
## This function takes the following global variables and installs the PKG file
##
## Functions
##
## isAppRunning (Pauses installation if the process defined in global variable $processpath is running )
## fetchLastModifiedDate (Called with update flag which causes the function to write the new lastmodified date to the metadata file)
##
## Variables
##
## $appname = Description of the App we are installing
## $tempfile = location of temporary DMG file downloaded
## $volume = name of volume mount point
## $app = name of Application directory under /Applications
##
###############################################################
###############################################################
# Check if app is running, if it is we need to wait.
waitForProcess "$processpath" "300" "$terminateprocess"
echo "$(date) | Installing $appname"
updateSplashScreen wait Installing # Swift Dialog
# Remove existing files if present
if [[ -d "/Applications/$app" ]]; then
rm -rf "/Applications/$app"
fi
# Attempting Installation
max_attempts=5
attempt=1
while [ $attempt -le $max_attempts ]; do
echo "$(date) | Attempting installation (Attempt $attempt)..."
# Run the installer command
installer -pkg "$tempfile" -target /
# Checking if the app was installed successfully
if [ "$?" = "0" ]; then
echo "$(date) | $appname Installed"
echo "$(date) | Cleaning Up"
rm -rf "$tempdir"
echo "$(date) | Application [$appname] succesfully installed"
fetchLastModifiedDate update
updateSplashScreen success Installed # Swift Dialog
break
else
echo "$(date) | Failed to install $appname, trying $attempt of $max_attempts"
updateSplashScreen error "Failed, retrying $attempt of $max_attempts"
attempt=$((attempt + 1)) # Increment the attempt counter
sleep 5
fi
done
if [ $attempt -gt $max_attempts ]; then
echo "$(date) | Installation failed after $max_attempts attempts. Exiting the script."
updateSplashScreen fail "Failed, after $max_attempts retries"
rm -rf "$tempdir"
exit 1
fi
}
## Install DMG Function
function installDMG () {
#################################################################################################################
#################################################################################################################
##
## This function takes the following global variables and installs the DMG file into /Applications
##
## Functions
##
## isAppRunning (Pauses installation if the process defined in global variable $processpath is running )
## fetchLastModifiedDate (Called with update flag which causes the function to write the new lastmodified date to the metadata file)
##
## Variables
##
## $appname = Description of the App we are installing
## $tempfile = location of temporary DMG file downloaded
## $volume = name of volume mount point
## $app = name of Application directory under /Applications
##
###############################################################
###############################################################
# Check if app is running, if it is we need to wait.
waitForProcess "$processpath" "300" "$terminateprocess"
echo "$(date) | Installing [$appname]"
updateSplashScreen wait Installing # Swift Dialog
# Mount the dmg file...
volume="$tempdir/$appname"
echo "$(date) | Mounting Image"
hdiutil attach -quiet -nobrowse -mountpoint "$volume" "$tempfile"
# Remove existing files if present
if [[ -d "/Applications/$app" ]]; then
echo "$(date) | Removing existing files"
rm -rf "/Applications/$app"
fi
# Sync the application and unmount once complete
echo "$(date) | Copying app files to /Applications/$app"
rsync -a "$volume"/*.app/ "/Applications/$app"
# Unmount the dmg
echo "$(date) | Un-mounting [$volume]"
hdiutil detach -quiet "$volume"
# Checking if the app was installed successfully
if [[ -a "/Applications/$app" ]]; then
echo "$(date) | [$appname] Installed"
echo "$(date) | Cleaning Up"
rm -rf "$tempfile"
echo "$(date) | Fixing up permissions"
sudo chown -R root:wheel "/Applications/$app"
echo "$(date) | Application [$appname] succesfully installed"
fetchLastModifiedDate update
updateSplashScreen success Installed # Swift Dialog
exit 0
else
echo "$(date) | Failed to install [$appname]"
rm -rf "$tempdir"
updateSplashScreen fail Failed # Swift Dialog
exit 1
fi
}
## Install ZIP Function
function installZIP () {
#################################################################################################################
#################################################################################################################
##
## This function takes the following global variables and installs the DMG file into /Applications
##
## Functions
##
## isAppRunning (Pauses installation if the process defined in global variable $processpath is running )
## fetchLastModifiedDate (Called with update flag which causes the function to write the new lastmodified date to the metadata file)
##
## Variables
##
## $appname = Description of the App we are installing
## $tempfile = location of temporary DMG file downloaded
## $volume = name of volume mount point
## $app = name of Application directory under /Applications
##
###############################################################
###############################################################
# Check if app is running, if it is we need to wait.
waitForProcess "$processpath" "300" "$terminateprocess"
echo "$(date) | Installing $appname"
updateSplashScreen wait Installing # Swift Dialog
# Change into temp dir
cd "$tempdir"
if [ "$?" = "0" ]; then
echo "$(date) | Changed current directory to $tempdir"
else
echo "$(date) | failed to change to $tempfile"
if [ -d "$tempdir" ]; then rm -rf $tempdir; fi
updateSplashScreen fail Failed # Swift Dialog
exit 1
fi
# Unzip files in temp dir
unzip -qq -o "$tempfile"
if [ "$?" = "0" ]; then
echo "$(date) | $tempfile unzipped"
else
echo "$(date) | failed to unzip $tempfile"
if [ -d "$tempdir" ]; then rm -rf $tempdir; fi
updateSplashScreen fail Failed # Swift Dialog
exit 1
fi
# If app is already installed, remove all old files
if [[ -a "/Applications/$app" ]]; then
echo "$(date) | Removing old installation at /Applications/$app"
rm -rf "/Applications/$app"
fi
# Copy over new files
rsync -a "$app/" "/Applications/$app"
if [ "$?" = "0" ]; then
echo "$(date) | $appname moved into /Applications"
else
echo "$(date) | failed to move $appname to /Applications"
if [ -d "$tempdir" ]; then rm -rf $tempdir; fi
updateSplashScreen fail Failed # Swift Dialog
exit 1
fi
# Make sure permissions are correct
echo "$(date) | Fix up permissions"
sudo chown -R root:wheel "/Applications/$app"
if [ "$?" = "0" ]; then
echo "$(date) | correctly applied permissions to $appname"
else
echo "$(date) | failed to apply permissions to $appname"
if [ -d "$tempdir" ]; then rm -rf $tempdir; fi
updateSplashScreen fail Failed # Swift Dialog
exit 1
fi
# Checking if the app was installed successfully
if [ "$?" = "0" ]; then
if [[ -a "/Applications/$app" ]]; then
echo "$(date) | $appname Installed"
updateSplashScreen success Installed # Swift Dialog
echo "$(date) | Cleaning Up"
rm -rf "$tempfile"
# Update metadata
fetchLastModifiedDate update
echo "$(date) | Fixing up permissions"
sudo chown -R root:wheel "/Applications/$app"
echo "$(date) | Application [$appname] succesfully installed"
exit 0
else
echo "$(date) | Failed to install $appname"
exit 1
fi
else
# Something went wrong here, either the download failed or the install Failed
# intune will pick up the exit status and the IT Pro can use that to determine what went wrong.
# Intune can also return the log file if requested by the admin
echo "$(date) | Failed to install $appname"
if [ -d "$tempdir" ]; then rm -rf $tempdir; fi
exit 1
fi
}
function updateSplashScreen () {
#################################################################################################################
#################################################################################################################
##
## This function is designed to update the Splash Screen status (if required)
##
##
## Parameters (updateSplashScreen parameter1 parameter2
##
##
## Param 1 = State
##
## Swift Dialog
##
## Param 1 = Status
## Param 2 = Status Text
##
###############################################################
###############################################################
# Is Swift Dialog present
if [[ -a "/Library/Application Support/Dialog/Dialog.app/Contents/MacOS/Dialog" ]]; then
echo "$(date) | Updating Swift Dialog monitor for [$appname] to [$1]"
echo listitem: title: $appname, status: $1, statustext: $2 >> /var/tmp/dialog.log
# Supported status: wait, success, fail, error, pending or progress:xx
fi
}
function startLog() {
###################################################
###################################################
##
## start logging - Output to log file and STDOUT
##
####################
####################
if [[ ! -d "$logandmetadir" ]]; then
## Creating Metadirectory
echo "$(date) | Creating [$logandmetadir] to store logs"
mkdir -p "$logandmetadir"
fi
exec &> >(tee -a "$log")
}
# function to delay until the user has finished setup assistant.
waitForDesktop () {
until ps aux | grep /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock | grep -v grep &>/dev/null; do
delay=$(( $RANDOM % 50 + 10 ))
echo "$(date) | + Dock not running, waiting [$delay] seconds"
sleep $delay
done
echo "$(date) | Dock is here, lets carry on"
}
###################################################################################
###################################################################################
##
## Begin Script Body
##
#####################################
#####################################
# Initiate logging
startLog
echo ""
echo "##############################################################"
echo "# $(date) | Logging install of [$appname] to [$log]"
echo "############################################################"
echo ""
# Install Aria2c if we don't already have it
installAria2c
# Install Rosetta if we need it
checkForRosetta2
# Test if we need to install or update
updateCheck
# Wait for Desktop
waitForDesktop
# Download app
downloadApp
# Install PKG file
if [[ $packageType == "PKG" ]]; then
installPKG
fi
# Install PKG file
if [[ $packageType == "ZIP" ]]; then
installZIP
fi
# Install PKG file
if [[ $packageType == "DMG" ]]; then
installDMG
fi