Skip to content

Commit

Permalink
1.10.0-rc8: A 'raw' unsorted listing of departments — with possible d…
Browse files Browse the repository at this point in the history
…uplicates — is converted to a sorted, unique, JSON-compatible 'departmentList' variable (Addresses Issue No. 23; thanks @rougegoat)

Signed-off-by: Dan K. Snelson <dan@snelson.us>
  • Loading branch information
dan-snelson committed Apr 13, 2023
1 parent 544b1c7 commit ef56922
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- 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); 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!)

## 1.9.0
### 01-Apr-2023
Expand Down
52 changes: 21 additions & 31 deletions Setup-Your-Mac-via-Dialog.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# - 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); 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!)
#
####################################################################################################

Expand All @@ -45,7 +46,7 @@
# Script Version and Jamf Pro Script Parameters
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

scriptVersion="1.10.0-rc7"
scriptVersion="1.10.0-rc8"
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 ]
Expand All @@ -57,13 +58,14 @@ outdatedOsAction="${9:-"/System/Library/CoreServices/Software Update.app"}"


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Operating System, currently logged-in user and default Exit Code
# Operating System, Computer Model Name, etc.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

osVersion=$( sw_vers -productVersion )
osBuild=$( sw_vers -buildVersion )
osMajorVersion=$( echo "${osVersion}" | awk -F '.' '{print $1}' )
modelName=$( /usr/libexec/PlistBuddy -c 'Print :0:_items:0:machine_name' /dev/stdin <<< "$(system_profiler -xml SPHardwareDataType)" )
debugModeSleepAmount="3"
reconOptions=""
exitCode="0"

Expand Down Expand Up @@ -475,6 +477,18 @@ welcomeVideo="--title \"$welcomeTitle\" \



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# "Welcome" Departments (thanks, @rougegoat!)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# An unsorted, comma-separated list of departments (with possible duplication)
departmentListRaw="Asset Management,Sales,Australia Area Office,Purchasing / Sourcing,Board of Directors,Strategic Initiatives & Programs,Operations,Business Development,Marketing,Creative Services,Customer Service / Customer Experience,Risk Management,Engineering,Finance / Accounting,Sales,General Management,Human Resources,Marketing,Investor Relations,Legal,Marketing,Sales,Product Management,Production,Corporate Communications,Information Technology / Technology,Quality Assurance,Project Management Office,Sales,Technology"

# A sorted, unique, JSON-compatible list of departments
departmentList=$( echo "${departmentListRaw}" | tr ',' '\n' | sort -f | uniq | sed -e 's/^/\"/' -e 's/$/\",/' -e '$ s/.$//' )



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# "Welcome" JSON for Capturing User Input (thanks, @bartreardon!)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Expand Down Expand Up @@ -525,31 +539,7 @@ welcomeJSON='
"default" : "Please select your department",
"values" : [
"Please select your department",
"Asset Management",
"Australia Area Office",
"Board of Directors",
"Business Development",
"Corporate Communications",
"Creative Services",
"Customer Service / Customer Experience",
"Engineering",
"Finance / Accounting",
"General Management",
"Human Resources",
"Information Technology / Technology",
"Investor Relations",
"Legal",
"Marketing",
"Operations",
"Product Management",
"Production",
"Project Management Office",
"Purchasing / Sourcing",
"Quality Assurance",
"Risk Management",
"Sales",
"Strategic Initiatives & Programs",
"Technology"
'${departmentList}'
]
}
],
Expand Down Expand Up @@ -1483,7 +1473,7 @@ function run_jamf_trigger() {
if [[ "${debugMode}" == "true" ]] || [[ "${debugMode}" == "verbose" ]] ; then

updateScriptLog "SETUP YOUR MAC DIALOG: DEBUG MODE: TRIGGER: $jamfBinary policy -trigger $trigger"
sleep 15 #1
sleep "${debugModeSleepAmount}"

else

Expand Down Expand Up @@ -1516,7 +1506,7 @@ function confirmPolicyExecution() {
outputLineNumberInVerboseDebugMode
if [[ "${debugMode}" == "true" ]] || [[ "${debugMode}" == "verbose" ]] ; then
updateScriptLog "SETUP YOUR MAC DIALOG: Confirm Policy Execution: DEBUG MODE: Skipping 'run_jamf_trigger ${trigger}'"
sleep 15 #1
sleep "${debugModeSleepAmount}"
elif [[ -f "${validation}" ]]; then
updateScriptLog "SETUP YOUR MAC DIALOG: Confirm Policy Execution: ${validation} exists; skipping 'run_jamf_trigger ${trigger}'"
previouslyInstalled="true"
Expand All @@ -1532,7 +1522,7 @@ function confirmPolicyExecution() {
outputLineNumberInVerboseDebugMode
updateScriptLog "SETUP YOUR MAC DIALOG: Confirm Policy Execution: ${validation}"
if [[ "${debugMode}" == "true" ]] || [[ "${debugMode}" == "verbose" ]] ; then
sleep 15 #1
sleep "${debugModeSleepAmount}"
else
run_jamf_trigger "${trigger}"
fi
Expand All @@ -1556,7 +1546,7 @@ function confirmPolicyExecution() {
outputLineNumberInVerboseDebugMode
updateScriptLog "SETUP YOUR MAC DIALOG: Confirm Policy Execution Catch-all: ${validation}"
if [[ "${debugMode}" == "true" ]] || [[ "${debugMode}" == "verbose" ]] ; then
sleep 15 #1
sleep "${debugModeSleepAmount}"
else
run_jamf_trigger "${trigger}"
fi
Expand Down

1 comment on commit ef56922

@dan-snelson
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.