Support for file paths, fixed wait logic

Script now supports any file path, including apps. Helpful for printer driver installs, etc. Also fixed logic issue with waiting for appCheck to finish.
This commit is contained in:
Adam Codega
2022-02-26 08:00:01 -05:00
parent 7dfe7135f2
commit 682f1334e6

View File

@@ -9,12 +9,13 @@
# #
# List of apps to process # List of apps to process
# Provide the app exactly how their application name is spelt, ie /Applications/Google Chrome.app # Provide the display name as you prefer and the path to the app/file. ex: "Google Chrome,/Applications/Google Chrome.app"
# Tip: Check for something like print drivers using the pkg receipt, ex: "Konica-Minolta drivers,/var/db/receipts/jp.konicaminolta.print.package.C759.plist"
apps=( apps=(
"Google Chrome" "Google Chrome,/Applications/Google Chrome.app"
"Google Drive" "Google Drive,/Applications/Google Drive.app"
"VLC" "VLC,/Applications/VLC.app"
"zoom.us" "zoom.us,/Applications/zoom.us.app"
) )
# Dialog display settings, change as desired # Dialog display settings, change as desired
@@ -48,14 +49,14 @@ function finalise(){
} }
function appCheck(){ function appCheck(){
dialog_command "listitem: "$(echo "$app" | cut -d ',' -f1)": wait" dialog_command "listitem: $(echo "$app" | cut -d ',' -f1): wait"
while [ ! -e "$(echo "$app" | cut -d ',' -f2)" ] while [ ! -e "$(echo "$app" | cut -d ',' -f2)" ]
do do
sleep 2 sleep 2
done done
dialog_command "progresstext: Install of \"$(echo "$app" | cut -d ',' -f1)\" complete" dialog_command "progresstext: Install of \"$(echo "$app" | cut -d ',' -f1)\" complete"
dialog_command "listitem: $(echo "$app" | cut -d ',' -f1): ✅" dialog_command "listitem: $(echo "$app" | cut -d ',' -f1): ✅"
progress_index=$(( $progress_index + 1 )) progress_index=$(( progress_index + 1 ))
echo "at item number $progress_index" echo "at item number $progress_index"
} }
@@ -82,8 +83,7 @@ dialogCMD="$dialogApp -p --title \"$title\" \
# create the list of apps # create the list of apps
listitems="" listitems=""
for app in "${apps[@]}"; do for app in "${apps[@]}"; do
#echo "apps label is $label" listitems="$listitems --listitem \"$(echo "$app" | cut -d ',' -f1)\""
listitems="$listitems --listitem \"$app\""
done done
# final command to execute # final command to execute
@@ -97,13 +97,13 @@ sleep 2
progress_index=0 progress_index=0
for app in "${apps[@]}"; do (for app in "${apps[@]}"; do
step_progress=$(( 1 + $progress_index )) step_progress=$(( 1 + progress_index ))
dialog_command "progress: $step_progress" dialog_command "progress: $step_progress"
appCheck & appCheck &
done done
wait wait)
# all done. close off processing and enable the "Done" button # all done. close off processing and enable the "Done" button
finalise finalise