more cleanup and comments

This commit is contained in:
Armin Briegel
2022-08-11 14:15:50 +02:00
parent 0656aa67e3
commit cc5326ce24
3 changed files with 34 additions and 12 deletions

View File

@@ -1,8 +1,13 @@
#!/bin/zsh
dialog="/usr/local/bin/dialog"
# MARK: Arguments/Parameters
# Parameter 4: path to the swiftDialog command file
dialog_command_file=${4:-"/var/tmp/dialog.log"}
# MARK: Constants
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
@@ -26,8 +31,8 @@ if [[ $DEBUG -eq 0 && $(id -u) -ne 0 ]]; then
fi
# check for Swift Dialog
if [[ ! -x $dialog ]]; then
echo "Cannot find dialog at $dialog"
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
exit 95
fi
@@ -36,6 +41,7 @@ fi
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
@@ -43,4 +49,6 @@ dialogUpdate "quit:"
# just to be safe
killall "Dialog"
# the killall command above will return error when Dialog is already quit
# but we don't want that to register as a failure in Jamf, so always exit 0
exit 0