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

@@ -2,13 +2,22 @@
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# MARK: Arguments/Parameters
# Parameter 4: path to the swiftDialog command file
dialog_command_file=${4:-"/var/tmp/dialog.log"}
# Parameter 5: message displayed over the progress bar
message=${5:-"Self Service Progress"}
# Parameter 6: path or URL to an icon
icon=${6:-"/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"}
# see Dan Snelson's advice on how to get a URL to an icon in Self Service
# https://rumble.com/v119x6y-harvesting-self-service-icons.html
# MARK: Constants
dialog="/usr/local/bin/dialog"
dialog_command_file=${4:-"/var/tmp/dialog.log"}
message=${5:-"Self Service Progress"}
icon=${6:-"/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"}
dialogApp="/Library/Application Support/Dialog/Dialog.app"
# MARK: Functions
@@ -37,16 +46,16 @@ 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
# MARK: Setup
# MARK: Configure and display swiftDialog
# display first screen
open -a /Library/Application\ Support/Dialog/Dialog.app --args \
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
@@ -57,4 +66,5 @@ open -a /Library/Application\ Support/Dialog/Dialog.app --args \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1

View File

@@ -21,13 +21,17 @@ The different scripts require a set of parameters. We will use the `googlechrome
`00_Prepare_SwiftDialog.sh`
Parameter 4: `/var/tmp/dialog` (Path to the swiftDialog command file)
Parameter 5: `Installing Google Chrome...` (text shown in the swiftDialog window above the progress bar)
Parameter 6: Path to or URL for an icon in swiftDialog. This can be a path on the client or a URL. See Dan Snelson's advice on how to get icon URLs for Self Service icons: https://rumble.com/v119x6y-harvesting-self-service-icons.html
`Installomator.sh`
Parameter 4: `googlechromepkg` (the label to install)
Parameter 5: `DIALOG_CMD_FILE=\var\log\dialog.log` (the swiftDialog command file, this has to be the same value as parameter 4 in the previous script)
Parameter 6: `NOTIFY=silent` (disable Installomator notifications, optional)
You can add more configurations to the Installomator script when needed.

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