diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf0cf9d..9890d26 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,20 @@
# CHANGELOG
+## 1.11.0
+### 24-May-2023
+[Release-specific Blog Post](https://snelson.us/2023/05/setup-your-mac-1-11-0-via-swiftdialog-2-2/)
+- Updates for `swiftDialog` `2.2`
+ - Required `selectitems`
+ - New `activate` command to bring swiftDialog to the front
+ - Display Configurations as radio buttons
+- Report on RSR version (if applicable) [Pull Request No. 50](https://github.com/dan-snelson/Setup-Your-Mac/pull/50) thanks @drtaru!)
+- Specify a Configuration as Parameter `11` ([Pull Request No. 59](https://github.com/dan-snelson/Setup-Your-Mac/pull/59); thanks big bunches, @drtaru!. Addresses [Issue No. 58](https://github.com/dan-snelson/Setup-Your-Mac/issues/58); thanks for the idea, @nunoidev!)
+- Configuration Names and Descriptions as variables ([Pull Request No. 60](https://github.com/dan-snelson/Setup-Your-Mac/pull/60); great idea! thanks, @theadamcraig!)
+- Consolidated Jamf Pro-related webHookMessage variables; Set "Additional Comments" to "None" when there aren't any failures
+
## 1.10.1
### 22-May-2023
+[Release-specific Blog Post](https://snelson.us/2023/05/setup-your-mac-1-10-0-via-swiftdialog)
- Removed "(beta)" from Dynamic Download Estimates
- Added `promptForBuilding` and `promptForDepartment` to match other prompts for Welcome Screen ([Pull Request No. 55](https://github.com/dan-snelson/Setup-Your-Mac/pull/55); thanks @robjschroeder!)
- Rearranged "Pre-flight Check: Validate Logged-in System Accounts"
diff --git a/README.md b/README.md
index 8e92638..1f493b5 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,14 @@
-# Setup Your Mac (1.10.1) via swiftDialog
+# Setup Your Mac (1.11.0) via swiftDialog (2.2)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/dan-snelson/Setup-Your-Mac?display_name=tag) ![GitHub issues](https://img.shields.io/github/issues-raw/dan-snelson/Setup-Your-Mac) ![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/dan-snelson/Setup-Your-Mac) ![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/dan-snelson/Setup-Your-Mac) ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed-raw/dan-snelson/Setup-Your-Mac)
-> New in Setup Your Mac (1.10.0), **Dynamic Download Estimates** leverage the built-in macOS `networkQuality` binary to provide end-users with approximate Configuration durations, based on the _actual speed_ of _their_ specific Internet connection, which can aid end-users in selecting their preferred Configuration.
->
-> Additionally, Mac Admins will appreciate the newly added **Slack** and **Microsoft Teams** integration, **Streamlined Customization** and more, making SYM (1.10.0) one of the most significant upgrades yet.
-> > Setup Your Mac (1.10.1) addresses a few bugs discovered after the release of `1.10.0`; see [CHANGELOG](CHANGELOG.md).
+> Setup Your Mac (1.11.0) leverages several new features of `swiftDialog` `2.2` and includes bug fixes (see [CHANGELOG](CHANGELOG.md)).
+>
+> > New in Setup Your Mac (1.10.0), **Dynamic Download Estimates** leverage the built-in macOS `networkQuality` binary to provide end-users with approximate Configuration durations, based on the _actual speed_ of _their_ specific Internet connection, which can aid end-users in selecting their preferred Configuration.
+> >
+> > Additionally, Mac Admins will appreciate the newly added **Slack** and **Microsoft Teams** integration, **Streamlined Customization** and more, making SYM (1.10.0) one of the most significant upgrades yet.
-[](https://snelson.us/sym)
+[](https://snelson.us/sym)
## Introduction
diff --git a/Setup-Your-Mac-via-Dialog.bash b/Setup-Your-Mac-via-Dialog.bash
index 1ae0120..8bed1b9 100644
--- a/Setup-Your-Mac-via-Dialog.bash
+++ b/Setup-Your-Mac-via-Dialog.bash
@@ -10,55 +10,16 @@
#
# HISTORY
#
-# Version 1.10.0, 08-May-2023, Dan K. Snelson (@dan-snelson)
-# - 🆕 **Dynamic Download Estimates** (Addresses [Issue No. 7](https://github.com/dan-snelson/Setup-Your-Mac/issues/7); thanks for the idea, @DevliegereM; heavy-lifting provided by @bartreardon!)
-# - Manually set `configurationDownloadEstimation` within the SYM script to `true` to enable
-# - New `calculateFreeDiskSpace` function will record free space to `scriptLog` before and after SYM execution
-# - Compare before and after free space values via: `grep "free" $scriptLog`
-# - Populate the following variables, in Gibibits (i.e., Total File Size in Gigabytes * 7.451), for each Configuration:
-# - `configurationCatchAllSize`
-# - `configurationOneSize`
-# - `configurationTwoSize`
-# - `configurationThreeSize`
-# - Specify an arbitrary value for `correctionCoefficient` (i.e., a "fudge factor" to help estimates match reality)
-# - Validate actual elapsed time with: `grep "Elapsed" $scriptLog`
-# - 🔥 **Breaking Change** for users of Setup Your Mac prior to `1.10.0` 🔥
-# - Added `recon` validation, which **must** be used when specifying the `recon` trigger (Addresses [Issue No. 19](https://github.com/dan-snelson/Setup-Your-Mac/issues/19))
-# - Standardized formatting of `toggleJamfLaunchDaemon` function
-# - Added logging while waiting for installation of `${jamflaunchDaemon}`
-# - Limit the `loggedInUserFirstname` variable to `25` characters and capitalize its first letter (Addresses [Issue No. 20](https://github.com/dan-snelson/Setup-Your-Mac/issues/20); thanks @mani2care!)
-# - Added line break to `welcomeTitle` and `welcomeBannerText`
-# - Replaced some generic "Mac" instances with hardware-specific model name (thanks, @pico!)
-# - Replaced `verbose` Debug Mode code with `outputLineNumberInVerboseDebugMode` function (thanks, @bartreardon!)
-# - Removed dependency on `dialogApp`
-# - Check `bannerImage` and `welcomeBannerImage` ([Pull Request No. 22](https://github.com/dan-snelson/Setup-Your-Mac/pull/22) AND [Pull Request No. 24](https://github.com/dan-snelson/Setup-Your-Mac/pull/24) thanks @amadotejada!)
-# - A "raw" unsorted listing of departments — with possible duplicates — is converted to a sorted, unique, JSON-compatible `departmentList` variable (Addresses [Issue No. 23](https://github.com/dan-snelson/Setup-Your-Mac/issues/23); thanks @rougegoat!)
-# - The selected Configuration now displays in `helpmessage` (Addresses [Issue No. 17](https://github.com/dan-snelson/Setup-Your-Mac/issues/17); thanks for the idea, @master-vodawagner!)
-# - Disable the so-called "Failure" dialog by setting the new `failureDialog` variable to `false` (Addresses [Issue No. 25](https://github.com/dan-snelson/Setup-Your-Mac/issues/25); thanks for the idea, @DevliegereM!)
-# - Added function to send a message to Microsoft Teams [Pull Request No. 29](https://github.com/dan-snelson/Setup-Your-Mac/pull/29); thanks @robjschroeder!)
-# - Added Building & Room User Input, Centralize User Input settings in one area [Pull Request No. 26](https://github.com/dan-snelson/Setup-Your-Mac/pull/26) thanks @rougegoat!)
-# - Replaced Parameter 10 with webhookURL for Microsoft Teams messaging ([Pull Request No. 31](https://github.com/dan-snelson/Setup-Your-Mac/pull/31) @robjschroeder, thanks for the idea @colorenz!!)
-# - Added an action card to the Microsoft Teams webhook message to view the computer's inventory record in Jamf Pro ([Pull Request No. 32](https://github.com/dan-snelson/Setup-Your-Mac/pull/32); thanks @robjschroeder!)
-# - Additional User Input Flags ([Pull Request No. 34](https://github.com/dan-snelson/Setup-Your-Mac/pull/34); thanks @rougegoat!)
-# - Corrected Dan's copy-pasta bug: Changed `--webHook` to `--data` ([Pull Request No. 36](https://github.com/dan-snelson/Setup-Your-Mac/pull/36); thanks @colorenz!)
-# - Enable or disable any combination of the fields on the Welcome dialog ([Pull Request No. 37](https://github.com/dan-snelson/Setup-Your-Mac/pull/37); thanks big bunches, @rougegoat!!)
-# - Moved various `shellcheck disable` codes sprinkled throughout script front-and-center to Line No. `2`
-# - Add Remote Validation results of "Success" or "Installed" to update the List Item with "Installed" instead of "Running" ([Pull Request No. 41](https://github.com/dan-snelson/Setup-Your-Mac/pull/41); thanks @drtaru!)
-# - Option to disable Banner Text ([Pull Request No. 42](https://github.com/dan-snelson/Setup-Your-Mac/pull/42); thanks, @rougegoat!)
-# - Switch `policy -trigger` to `policy -event` (Addresses [Issue No. 38](https://github.com/dan-snelson/Setup-Your-Mac/issues/38); thanks for looking out for us, @delize!)
-# - Resolves an issue when `promptForConfiguration` is NOT set to `true`, the `checkNetworkQualityConfigurations` function would display in the "Welcome" dialog (Addresses [Issue No. 46](https://github.com/dan-snelson/Setup-Your-Mac/issues/46); thanks, @jonlonergan!)
-# - Corrected capitalization of `networkQuality`
-# - Added `trigger` `validation` to "Elapsed Time" output
-# - Updated `webhookMessage` to include Slack functionality ([Pull Request No. 48](https://github.com/dan-snelson/Setup-Your-Mac/pull/48); thanks @iDrewbs!)
-# - Add button to computer record for Slack webhook ([Pull Request No. 49](https://github.com/dan-snelson/Setup-Your-Mac/pull/49); thanks @drtaru!)
-#
-# Version 1.10.1, 22-May-2023, Dan K. Snelson (@dan-snelson)
-# - Removed "(beta)" from Dynamic Download Estimates
-# - Added `promptForBuilding` and `promptForDepartment` to match other prompts for Welcome Screen ([Pull Request No. 55](https://github.com/dan-snelson/Setup-Your-Mac/pull/55); thanks @robjschroeder!)
-# - Rearranged "Pre-flight Check: Validate Logged-in System Accounts"
-# - Eliminated a visual "glitch" when `promptForConfiguration` is `false` and `configurationDownloadEstimation` is `true` (_Sort of_ addresses [Issue No. 56](https://github.com/dan-snelson/Setup-Your-Mac/issues/56); thanks for the heads-up, @rougegoat!)
-# - Eliminated the visual "glitch" when `welcomeDialog` is `false`
-#
+# Version 1.11.0, 24-May-2023, Dan K. Snelson (@dan-snelson)
+# - Updates for `swiftDialog` `2.2`
+# - Required `selectitems`
+# - New `activate` command to bring swiftDialog to the front
+# - Display Configurations as radio buttons
+# - Report on RSR version (if applicable) [Pull Request No. 50](https://github.com/dan-snelson/Setup-Your-Mac/pull/50) thanks @drtaru!)
+# - Specify a Configuration as Parameter `11` ([Pull Request No. 59](https://github.com/dan-snelson/Setup-Your-Mac/pull/59); thanks big bunches, @drtaru!. Addresses [Issue No. 58](https://github.com/dan-snelson/Setup-Your-Mac/issues/58); thanks for the idea, @nunoidev!)
+# - Configuration Names and Descriptions as variables ([Pull Request No. 60](https://github.com/dan-snelson/Setup-Your-Mac/pull/60); great idea! thanks, @theadamcraig!)
+# - Consolidated Jamf Pro-related webHookMessage variables; Set "Additional Comments" to "None" when there aren't any failures
+#
####################################################################################################
@@ -73,7 +34,7 @@
# Script Version and Jamf Pro Script Parameters
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-scriptVersion="1.10.1"
+scriptVersion="1.11.0"
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
scriptLog="${4:-"/var/log/org.churchofjesuschrist.log"}" # Parameter 4: Script Log Location [ /var/log/org.churchofjesuschrist.log ] (i.e., Your organization's default location for client-side logs)
debugMode="${5:-"verbose"}" # Parameter 5: Debug Mode [ verbose (default) | true | false ]
@@ -82,7 +43,7 @@ completionActionOption="${7:-"Restart Attended"}"
requiredMinimumBuild="${8:-"disabled"}" # Parameter 8: Required Minimum Build [ disabled (default) | 22E ] (i.e., Your organization's required minimum build of macOS to allow users to proceed; use "22E" for macOS 13.3)
outdatedOsAction="${9:-"/System/Library/CoreServices/Software Update.app"}" # Parameter 9: Outdated OS Action [ /System/Library/CoreServices/Software Update.app (default) | jamfselfservice://content?entity=policy&id=117&action=view ] (i.e., Jamf Pro Self Service policy ID for operating system ugprades)
webhookURL="${10:-""}" # Parameter 10: Microsoft Teams or Slack Webhook URL [ Leave blank to disable (default) | https://microsoftTeams.webhook.com/URL | https://hooks.slack.com/services/URL ] Can be used to send a success or failure message to Microsoft Teams or Slack via Webhook. (Function will automatically detect if Webhook URL is for Slack or Teams; can be modified to include other communication tools that support functionality.)
-
+presetConfiguration="${11:-""}" # Parameter 11: Specify a Configuration (i.e., `policyJSON`; NOTE: Only used when `welcomeDialog` is set to `video` or `false`)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -124,7 +85,7 @@ departmentListRaw="Asset Management,Sales,Australia Area Office,Purchasing / Sou
departmentList=$( echo "${departmentListRaw}" | tr ',' '\n' | sort -f | uniq | sed -e 's/^/\"/' -e 's/$/\",/' -e '$ s/.$//' )
# Branding overrides
-brandingBanner="https://img.freepik.com/free-photo/abstract-grunge-decorative-relief-navy-blue-stucco-wall-texture-wide-angle-rough-colored-background_1258-28311.jpg"
+brandingBanner="https://img.freepik.com/free-photo/heavy-red-cloud-haze_23-2148102335.jpg"
brandingBannerDisplayText="true"
brandingIconLight="https://cdn-icons-png.flaticon.com/512/979/979585.png"
brandingIconDark="https://cdn-icons-png.flaticon.com/512/740/740878.png"
@@ -144,8 +105,10 @@ supportTeamHelpKB="\n- **Knowledge Base Article:** ${supportKB}"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
osVersion=$( sw_vers -productVersion )
+osVersionExtra=$( sw_vers -productVersionExtra )
osBuild=$( sw_vers -buildVersion )
osMajorVersion=$( echo "${osVersion}" | awk -F '.' '{print $1}' )
+if [[ -n $osVersionExtra ]] && [[ "${osMajorVersion}" -ge 13 ]]; then osVersion="${osVersion} ${osVersionExtra}"; fi # Report RSR sub version if applicable
modelName=$( /usr/libexec/PlistBuddy -c 'Print :0:_items:0:machine_name' /dev/stdin <<< "$(system_profiler -xml SPHardwareDataType)" )
reconOptions=""
exitCode="0"
@@ -153,14 +116,23 @@ exitCode="0"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Configuration Download Estimation
+# Configuration Variables
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
configurationDownloadEstimation="true" # [ true (default) | false ]
correctionCoefficient="1.01" # "Fudge factor" (to help estimate match reality)
configurationCatchAllSize="34" # Catch-all Configuration in Gibibits (i.e., Total File Size in Gigabytes * 7.451)
+
+configurationOneName="Required"
+configurtaionOneDescription="Minimum organization apps"
configurationOneSize="34" # Configuration One in Gibibits (i.e., Total File Size in Gigabytes * 7.451)
+
+configurationTwoName="Recommended"
+configurationTwoDescription="Required apps and Microsoft Office"
configurationTwoSize="62" # Configuration Two in Gibibits (i.e., Total File Size in Gigabytes * 7.451)
+
+configurationThreeName="Complete"
+configurationThreeDescription="Recommended apps, Adobe Acrobat Reader and Google Chrome"
configurationThreeSize="106" # Configuration Three in Gibibits (i.e., Total File Size in Gigabytes * 7.451)
@@ -518,7 +490,7 @@ welcomeTitle="Happy $( date +'%A' ), ${loggedInUserFirstname}! \nWelcome to you
welcomeMessage="Please enter the **required** information for your ${modelName}, select your preferred **Configuration** then click **Continue** to start applying settings to your new Mac. \n\nOnce completed, the **Wait** button will be enabled and you‘ll be able to review the results before restarting your ${modelName}. \n\nIf you need assistance, please contact the ${supportTeamName}: ${supportTeamPhone} and mention ${supportKB}. \n\n---"
if [[ "${promptForConfiguration}" == "true" ]]; then
- welcomeMessage+=" \n\n#### Configurations \n- **Required:** Minimum organization apps \n- **Recommended:** Required apps and Microsoft Office \n- **Complete:** Recommended apps, Adobe Acrobat Reader and Google Chrome"
+ welcomeMessage+=" \n\n#### Configurations \n- **${configurationOneName}:** ${configurtaionOneDescription} \n- **${configurationTwoName}:** ${configurationTwoDescription} \n- **${configurationThreeName}:** ${configurationThreeDescription}"
else
welcomeMessage=${welcomeMessage//", select your preferred **Configuration**"/}
fi
@@ -596,11 +568,11 @@ textFieldJSON=$( echo ${textFieldJSON} | sed 's/,$//' )
# Dropdowns
if [ "$promptForBuilding" == "true" ]; then
if [ -n "$buildingsListRaw" ]; then
- buildingJSON='{
+ buildingJSON='{
"title" : "Building",
- "default" : "Please select your building",
+ "default" : "",
+ "required" : true,
"values" : [
- "Please select your building",
'${buildingsList}'
]
},'
@@ -609,10 +581,11 @@ fi
if [ "$promptForDepartment" == "true" ]; then
if [ -n "$departmentListRaw" ]; then
- departmentJSON='{ "title" : "Department",
- "default" : "Please select your department",
+ departmentJSON='{
+ "title" : "Department",
+ "default" : "",
+ "required" : true,
"values" : [
- "Please select your department",
'${departmentList}'
]
},'
@@ -620,12 +593,14 @@ if [ "$promptForDepartment" == "true" ]; then
fi
if [ "$promptForConfiguration" == "true" ]; then
- configurationJSON='{ "title" : "Configuration",
- "default" : "Required",
+ configurationJSON='{
+ "title" : "Configuration",
+ "style" : "radio",
+ "default" : "'"${configurationOneName}"'",
"values" : [
- "Required",
- "Recommended",
- "Complete"
+ "'"${configurationOneName}"'",
+ "'"${configurationTwoName}"'",
+ "'"${configurationThreeName}"'"
]
}'
fi
@@ -662,7 +637,7 @@ welcomeJSON='
"selectitems" : [
'${selectItemsJSON}'
],
- "height" : "750"
+ "height" : "860"
}
'
@@ -798,7 +773,7 @@ function policyJSONConfiguration() {
case ${symConfiguration} in
- "Required" )
+ "${configurationOneName}" )
policyJSON='
{
@@ -904,7 +879,7 @@ function policyJSONConfiguration() {
'
;;
- "Recommended" )
+ "${configurationTwoName}" )
policyJSON='
{
@@ -1036,7 +1011,7 @@ function policyJSONConfiguration() {
'
;;
- "Complete" )
+ "${configurationThreeName}" )
policyJSON='
{
@@ -1527,7 +1502,6 @@ function finalise(){
dialogUpdateSetupYourMac "button1: enable"
dialogUpdateSetupYourMac "progress: reset"
-
# Wait for user-acknowledgment due to detected failure
wait
@@ -2225,7 +2199,7 @@ function checkNetworkQualityConfigurations() {
updateScriptLog "WELCOME DIALOG: Configuration Three Estimate: $(printf '%dh:%dm:%ds\n' $((configurationThreeEstimatedSeconds/3600)) $((configurationThreeEstimatedSeconds%3600/60)) $((configurationThreeEstimatedSeconds%60)))"
updateScriptLog "WELCOME DIALOG: Network Quality Test: Started: $dlStartDate, Ended: $dlEndDate; Download: $mbps Mbps, Responsiveness: $dlResponsiveness"
- dialogUpdateWelcome "infobox: **Connection:** \n- Download: \n$mbps Mbps \n\n**Estimates:** \n- Required: \n$(printf '%dh:%dm:%ds\n' $((configurationOneEstimatedSeconds/3600)) $((configurationOneEstimatedSeconds%3600/60)) $((configurationOneEstimatedSeconds%60))) \n\n- Recommended: \n$(printf '%dh:%dm:%ds\n' $((configurationTwoEstimatedSeconds/3600)) $((configurationTwoEstimatedSeconds%3600/60)) $((configurationTwoEstimatedSeconds%60))) \n\n- Complete: \n$(printf '%dh:%dm:%ds\n' $((configurationThreeEstimatedSeconds/3600)) $((configurationThreeEstimatedSeconds%3600/60)) $((configurationThreeEstimatedSeconds%60)))"
+ dialogUpdateWelcome "infobox: **Connection:** \n- Download: \n$mbps Mbps \n\n**Estimates:** \n- ${configurationOneName}: \n$(printf '%dh:%dm:%ds\n' $((configurationOneEstimatedSeconds/3600)) $((configurationOneEstimatedSeconds%3600/60)) $((configurationOneEstimatedSeconds%60))) \n\n- ${configurationTwoName}: \n$(printf '%dh:%dm:%ds\n' $((configurationTwoEstimatedSeconds/3600)) $((configurationTwoEstimatedSeconds%3600/60)) $((configurationTwoEstimatedSeconds%60))) \n\n- ${configurationThreeName}: \n$(printf '%dh:%dm:%ds\n' $((configurationThreeEstimatedSeconds/3600)) $((configurationThreeEstimatedSeconds%3600/60)) $((configurationThreeEstimatedSeconds%60)))"
}
@@ -2290,12 +2264,24 @@ function webHookMessage() {
outputLineNumberInVerboseDebugMode
+ jamfProURL=$(/usr/bin/defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url)
+
+ # # Jamf Pro URL for on-prem, multi-node, clustered environments
+ # case ${jamfProURL} in
+ # *"beta"* ) jamfProURL="https://jamfpro-beta.internal.company.com/" ;;
+ # * ) jamfProURL="https://jamfpro-prod.internal.company.com/" ;;
+ # esac
+
+ jamfProComputerURL="${jamfProURL}computers.html?id=${computerID}&o=r"
+
+ # If there aren't any failures, use "None" for the value of `jamfProPolicyNameFailures`
+ if [[ -z "${jamfProPolicyNameFailures}" ]]; then
+ jamfProPolicyNameFailures="None"
+ fi
+
if [[ $webhookURL == *"slack"* ]]; then
updateScriptLog "Generating Slack Message …"
-
- jamfProURL=$(/usr/bin/defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url)
- jamfProComputerURL="${jamfProURL}computers.html?id=${computerID}&o=r"
webHookdata=$(cat <