Last active
January 24, 2019 19:37
-
-
Save chemxboy/29c75ab0313bb4b5055b to your computer and use it in GitHub Desktop.
This is how we use CocoaDialog (http://mstratman.github.io/cocoadialog/) in DeployStudio (http://deploystudio.com) workflows. CocoaDialog should be added to the scripts directory. This particular example will popup a choice and set the response in a variable. A later workflow item uses that variable in its logic to install the chosen package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This script uses cocoaDialog to bring up a GUI dialog requesting which package to install. It will set a variable to be used later in the workflow. | |
# Set the 891 variable | |
P_891="" | |
# Path to the cocoaDialog tool | |
POPUP=`dirname "$0"`/cocoaDialog.app/Contents/MacOS/cocoaDialog | |
# Options for cocoaDialog | |
RUNMODE="standard-dropdown" | |
TITLE="Select your option:" | |
TEXT="Please select your required extra package from the list" | |
OTHEROPTS="--no-cancel --float --string-output" | |
ITEMS=( "None" "One" "Two" "Three" "Four" "Five" ) | |
ICON="group" | |
ICONSIZE="128" | |
#Do the dialog, get the result and strip the Okay button code | |
RESPONSE=`$POPUP $RUNMODE $OTHEROPTS --icon $ICON --icon-size $ICONSIZE --title "${TITLE}" --text "${TEXT}" --items "${ITEMS[@]}"` | |
RESPONSE=`echo $RESPONSE | sed 's/Okay //g'` | |
#echo $RESPONSE | |
# Assign the variable to reflect the choice | |
case $RESPONSE in | |
"None") # None | |
P_891="" | |
;; | |
"One") | |
P_891="PackageOne.pkg" | |
;; | |
"Two") | |
P_891="PackageTwo.pkg" | |
;; | |
"Three") | |
P_891="PackageThree.pkg" | |
;; | |
"Four") | |
P_891="PackageFour.pkg" | |
;; | |
"Five") | |
P_891="PackageFive.pkg" | |
;; | |
*) | |
echo "RuntimeAbortWorkflow: Unknown return value from popup: $retval" | |
exit 1 | |
;; | |
esac | |
# Write the 891 package info to the drive for later use | |
echo "RuntimeSetCustomProperty: P_891=${P_891}" | |
echo "${P_891}" > /tmp/P_891 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment