├── Change Log ├── .github └── FUNDING.yml ├── README.md └── Assemble-Template /Change Log: -------------------------------------------------------------------------------- 1 | Change log of feature updates and improvments 2 | 3 | # Assemble - v2.1 4 | 5 | ## Progress bar updated 6 | The logic behind updateing the progress bar has been updated to manage it more accurately. 7 | ## Icon Hash finder updated 8 | There is an added step to find the Icon using the hash now. It now looks at an additional JAMF server to find the icon if it fails on the default server. 9 | ## Log output updated 10 | Log output now uses "tee" instead of a redirect so that the logs alos appear in JAMF. 11 | ## Installation Validation updated 12 | Installation validation has been updated to read the JAMF policy logs for more accurately identifying if the app or script has run successfully. 13 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: ["https://www.buymeacoffee.com/pezza", "https://www.paypal.com/paypalme/pezzaD84"] 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Latest-Version](https://img.shields.io/badge/Latest_Version-2.1-green)](https://github.com/PezzaD84/macOSLAPS/releases) ![macOS-Versions](https://img.shields.io/badge/macOS-11+-blue) ![Script-Language](https://img.shields.io/badge/Coding_Language-Bash-blue) [![Powered-by](https://img.shields.io/badge/Powered_by-SwiftDialog-red)](https://github.com/bartreardon/swiftDialog) 2 | 3 | # Assemble 4 | 5 | --- 6 | Version 2.1 now available. 7 | Change Log can be viewed here [Change log](https://github.com/PezzaD84/Assemble/blob/main/Change%20Log) 8 | 9 | --- 10 | Assemble is a script I've created to help provision devices using [swiftDialog](https://github.com/bartreardon/swiftDialog) 11 | 12 | --- 13 | The script was inspired by the [DEPNotify starter script](https://github.com/jamf/DEPNotify-Starter) and Dan Snelsons [Setup-Your-Mac script](https://github.com/dan-snelson/dialog-scripts/tree/main/Setup%20Your%20Mac). 14 | 15 | I wanted to help give end users a nice gui view of what is going on and also try to keep things as simple as possible. In the world of zero touch it's nice to limit end user interaction and this script requires nothing from the end user. 16 | 17 | The only part that needs customising is the policy array. This area needs to be customised to match your custom triggers in JAMF and also set to what you want to install. 18 | 19 | It can be further customised with your company logo and a banner image to give your script a nice polished professional appearance. 20 | 21 | - Branded 22 | ![BrandedDemoV2](https://user-images.githubusercontent.com/89595349/233336145-589b9bb8-b818-47d1-a546-51a81a6a83e1.png) 23 | 24 | - Unbranded 25 | ![UnbrandedDemoV2](https://user-images.githubusercontent.com/89595349/233336164-7d7e0faa-d07c-4b78-accd-8a03e9d7849c.png) 26 | 27 |
28 |
29 |
30 | There is an additional switch to prompt the user for additional information. 31 | 32 | 33 | - Branded 34 | Screenshot 2023-03-30 at 13 36 30 35 | 36 | - Unbranded 37 | Screenshot 2023-03-30 at 13 53 02 38 | 39 | 40 | There is an additional setting which can be editing with your companies helpdesk info or other IT support details. 41 | Screenshot 2023-03-30 at 13 36 20 42 | -------------------------------------------------------------------------------- /Assemble-Template: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Author : Perry Driscoll - https://github.com/PezzaD84 4 | # Created : 28/9/2022 5 | # Updated : 4/9/2024 6 | # Version : v2.2 7 | # 8 | ######################################################################################### 9 | # Description: 10 | # Script to provision devices using swiftdialog 11 | # 12 | ######################################################################################### 13 | # Copyright © 2023 Perry Driscoll 14 | # 15 | # This file is free software and is shared "as is" without any warranty of 16 | # any kind. The author gives unlimited permission to copy and/or distribute 17 | # it, with or without modifications, as long as this notice is preserved. 18 | # All usage is at your own risk and in no event shall the authors or 19 | # copyright holders be liable for any claim, damages or other liability. 20 | ######################################################################################### 21 | 22 | ######################################################################################### 23 | # Grab currently logged in user 24 | ######################################################################################### 25 | 26 | CURRENT_USER=$(ls -l /dev/console | awk '{ print $3 }') 27 | 28 | ######################################################################################### 29 | # Add your custom settings here. 30 | # orgLogo is recommended to be a png or jpeg 31 | # banner is recommended to be a png or jpeg at 850x150 32 | ######################################################################################### 33 | 34 | # Organisation logo 35 | orgLogo="" 36 | # Banner image e.g. company name 37 | banner="" 38 | # Welcome message to display to users to inform them of what is happening 39 | welcomeMessage="Welcome to your new mac $CURRENT_USER! \n\n We will now run through some basic configuration and install some common apps to help get you up and running. \n\n Sit back and have a break while we get things ready." 40 | # Small text box which can include extra info 41 | infoText="TEST INFO MESSAGE \n\n This is a place holder to test the extra info box" 42 | # Text to display in the help menu 43 | helpText="TEST HELP MESSAGE \n\n This is a place holder to test the help message." 44 | 45 | ######################################################################################### 46 | # Policy array 47 | # Format must be as follows: 48 | # "Application Name,JAMF Trigger,Icon Hash" - how to find the hash can be found here https://vimeo.com/772998915 (thanks to Dan Snelson) 49 | ######################################################################################### 50 | 51 | array=( 52 | "Google Chrome,installChrome2,fb48e96c34d449ef5ff0d56e983a034927320195be69a02c076b6270a4e19d54" 53 | "Slack,installSlack,4c854db5ebeed437a6c7bf34cfb01fc4631ace8a339183f78d94adef74bbab1f" 54 | "Atom,installAtom,e4bcac54cc087b73724bc958df90682b5b68064d4760713e3135da722f9d8845" 55 | "zoom,installZoom,89c52ab16cabcc11aa955521b7589955e8ea2995f250f4b65356a46653bd734b" 56 | "Spotify,installSpotify2,7be69c3635be12e83e7e69c2c648e3ace478dea8d21b9db851a65e70e84acc5f" 57 | "Final Config,finalConfig,3b0765f097a797e05d960186b475375ce5953b7d09f9bd98584c3bb14cae2065" 58 | ) 59 | 60 | ######################################################################################### 61 | # Test mode 62 | # If set to true no policies will run, only the application list will be populated 63 | # Set to true by default 64 | ######################################################################################### 65 | 66 | TESTING="true" 67 | 68 | ######################################################################################### 69 | # Extra info 70 | # If set to true the user will be prompted to enter an Asset Tag, Email address and User name. 71 | # Set to false by default 72 | ######################################################################################### 73 | 74 | EXTRAINFO="true" 75 | 76 | # If extra info is turned on you can set the device name to be the same as the Asset Tag. False by default. 77 | AssetToName="false" 78 | 79 | ######################################################################################### 80 | ######################################################################################### 81 | ###### !!TRY NOT TO EDIT BELOW HERE OR THE WHOLE THING MIGHT EXPLODE!! ###### 82 | ######################################################################################### 83 | ######################################################################################### 84 | 85 | ######################################################################################### 86 | # Variables 87 | ######################################################################################### 88 | 89 | jamfBinary="/usr/local/bin/jamf" 90 | commandLog="/Users/Shared/.ASMBL/Logs/DialogCommand.log" 91 | AssembleLog="/Users/Shared/.ASMBL/Logs/Assemble.log" 92 | PolicyLog="/Users/Shared/.ASMBL/Logs/policy.log" 93 | 94 | ######################################################################################### 95 | # Functions 96 | ######################################################################################### 97 | 98 | DialogInstall(){ 99 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 100 | echo "TEST MODE ENABLED. Will not install Dialog." | tee -a $AssembleLog 101 | else 102 | pkgfile="SwiftDialog.pkg" 103 | logfile="/Library/Logs/SwiftDialogInstallScript.log" 104 | URL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/bartreardon/swiftDialog/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.pkg" | head -1)" 105 | 106 | # Start Log entries 107 | echo "--" >> ${logfile} 108 | echo "`date`: Downloading latest version." >> ${logfile} 109 | 110 | # Download installer 111 | curl -s -L -J -o /tmp/${pkgfile} ${URL} 112 | echo "`date`: Installing..." >> ${logfile} 113 | 114 | # Change to installer directory 115 | cd /tmp 116 | 117 | # Install application 118 | sudo installer -pkg ${pkgfile} -target / 119 | sleep 5 120 | echo "`date`: Deleting package installer." >> ${logfile} 121 | 122 | # Remove downloaded installer 123 | rm /tmp/"${pkgfile}" 124 | fi 125 | } 126 | 127 | pauseJamfFramework(){ 128 | ## Update Jamf frameworks 129 | /usr/local/bin/jamf manage 130 | 131 | ## Disable Jamf Check-Ins 132 | jamftasks=($( find /Library/LaunchDaemons -iname "*task*" -type f -maxdepth 1 )) 133 | for ((i=0;i<${#jamftasks[@]};i++)) 134 | do 135 | /bin/launchctl unload -w "${jamftasks[$i]}" 136 | done 137 | 138 | ## Kill any check-in in progress 139 | jamfpid=$( ps -ax | grep "jamf policy -randomDelaySeconds" | grep -v "grep" | awk '{ print $1 }' ) 140 | if [ "$jamfpid" != "" ]; 141 | then 142 | kill -9 "$jamfpid" 143 | fi 144 | } 145 | 146 | restartJamfFramework(){ 147 | ## Re-enable Jamf management 148 | for ((i=0;i<${#jamftasks[@]};i++)) 149 | do 150 | /bin/launchctl load -w "${jamftasks[$i]}" 151 | done 152 | } 153 | 154 | ######################################################################################### 155 | # Create Master Assemble Log 156 | ######################################################################################### 157 | 158 | if [ -f $AssembleLog ]; then 159 | echo "______________________________________________________________________" | tee -a $AssembleLog 160 | echo "######## ASSEMBLE RUN ON: `date +%d.%m.%Y:%T` ########" | tee -a $AssembleLog 161 | echo "Assemble master log already exists. Continuing to assemble...." | tee -a $AssembleLog 162 | sleep 3 163 | else 164 | echo "______________________________________________________________________" | tee -a $AssembleLog 165 | echo "######## ASSEMBLE RUN ON: `date +%d.%m.%Y:%T` ########" | tee -a $AssembleLog 166 | echo "Assemble has not run before. Creating master log now...." | tee -a $AssembleLog 167 | mkdir -p /Users/Shared/.ASMBL/Logs/ 168 | sleep 3 169 | fi 170 | 171 | ######################################################################################### 172 | # Check Dock is running before starting 173 | ######################################################################################### 174 | 175 | DOCK_STATUS=$(pgrep -x Dock) 176 | while [[ "$DOCK_STATUS" == "" ]]; do 177 | echo "Dock not running yet... please wait..." | tee -a $AssembleLog 178 | sleep 3 179 | DOCK_STATUS=$(pgrep -x Dock) 180 | done 181 | 182 | echo "Dock is running as process $DOCK_STATUS. Starting assemble....." | tee -a $AssembleLog 183 | sleep 3 184 | 185 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 186 | echo "TEST MODE ENABLED. Will not Pause JAMF Agent" | tee -a $AssembleLog 187 | else 188 | echo "Pausing JAMF Agent while build proceeds....." | tee -a $AssembleLog 189 | pauseJamfFramework 190 | fi 191 | 192 | ######################################################################################### 193 | # Install Rosetta if device is running Apple Silicon 194 | ######################################################################################### 195 | 196 | processor=$(uname -m) 197 | 198 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 199 | echo "TEST MODE ENABLED. Will not install Rosetta." | tee -a $AssembleLog 200 | else 201 | if [[ $processor == arm64 ]]; then 202 | 203 | echo "Mac is arm64. Installing Rosetta....." | tee -a $AssembleLog 204 | echo A | sudo softwareupdate --install-rosetta 205 | Sleep 5 206 | echo "Rosetta Installed. Continuing Build....." | tee -a $AssembleLog 207 | else 208 | echo "Mac is Intel. Continuing Build....." | tee -a $AssembleLog 209 | fi 210 | fi 211 | 212 | ############################################################## 213 | # Check if SwiftDialog is installed (SwiftDialog created by Bart Reardon https://github.com/bartreardon/swiftDialog) 214 | ############################################################## 215 | 216 | if ! command -v dialog &> /dev/null 217 | then 218 | echo "SwiftDialog is not installed. App will be installed now....." | tee -a $AssembleLog 219 | sleep 2 220 | 221 | DialogInstall 222 | 223 | else 224 | echo "SwiftDialog is installed. Checking installed version....." | tee -a $AssembleLog 225 | 226 | installedVersion=$(dialog -v | sed 's/./ /6' | awk '{print $1}') 227 | 228 | latestVersion=$(curl -sfL "https://github.com/bartreardon/swiftDialog/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1 | tr '/' ' ' | awk '{print $7}' | tr -d 'v' | awk -F '-' '{print $1}') 229 | 230 | if [[ $installedVersion != $latestVersion ]]; then 231 | echo "Dialog needs updating" | tee -a $AssembleLog 232 | DialogInstall 233 | else 234 | echo "Dialog is up to date. Continuing to assemble...." | tee -a $AssembleLog 235 | fi 236 | sleep 3 237 | fi 238 | 239 | ######################################################################################### 240 | # Check if assemble command file exists 241 | ######################################################################################### 242 | 243 | if [ -f $commandLog ]; then 244 | echo "Assemble command file found. Continuing to assemble...." | tee -a $AssembleLog 245 | sleep 3 246 | else 247 | echo "Assemble has not run before. Creating command file now...." | tee -a $AssembleLog 248 | mkdir -p /Users/Shared/.ASMBL/Logs/ 249 | sleep 3 250 | fi 251 | 252 | ######################################################################################### 253 | # Dialog window for Start message 254 | ######################################################################################### 255 | 256 | progressTotal=${#array[@]} 257 | 258 | if [[ "$banner" == "" ]]; then 259 | dialog \ 260 | --presentation \ 261 | --button1disabled \ 262 | --title Assemble \ 263 | --position centre \ 264 | --icon "$orgLogo" \ 265 | --message "$welcomeMessage" \ 266 | --height 500 \ 267 | --alignment centre \ 268 | --messagefont 'name=Arial,size=16' \ 269 | --blurscreen \ 270 | --progress \ 271 | --commandfile $commandLog \ 272 | --infobox "$infoText" \ 273 | --helpmessage "$helpText" & 274 | sleep 10 275 | 276 | if [[ $EXTRAINFO =~ ^[tT]rue$ ]]; then 277 | 278 | echo "EXTRA INFO SWITCHED ON. Continuing to gather Email, Username and Asset Tag...." | tee -a $AssembleLog 279 | 280 | asset=$(dialog \ 281 | --title Assemble \ 282 | --position centre \ 283 | --icon "$orgLogo" \ 284 | --message "$welcomeMessage\n\nPlease enter the extra information required below." \ 285 | --height 500 \ 286 | --alignment center \ 287 | --blurscreen \ 288 | --messagefont 'name=Arial,size=16' \ 289 | --infobox "$infoText" \ 290 | --helpmessage "$helpText" \ 291 | --textfield "Email Address:",required,prompt="username@company.com" \ 292 | --textfield "User Name:",required,prompt="User Name" \ 293 | --textfield "Asset Tag:",required,prompt="#######" \ 294 | --json) 295 | 296 | email=$(echo $asset | awk -F '"Email Address:" : "' '{print$2}' | awk -F '"' '{print$1}') 297 | user=$(echo $asset | awk -F '"User Name:" : "' '{print$2}' | awk -F '"' '{print$1}') 298 | assetTag=$(echo $asset | awk -F '"Asset Tag:" : "' '{print$2}' | awk -F '"' '{print$1}') 299 | 300 | echo "Email is: $email" | tee -a $AssembleLog 301 | echo "User name is: $user" | tee -a $AssembleLog 302 | echo "Asset Tag is: $assetTag" | tee -a $AssembleLog 303 | 304 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 305 | echo "TEST MODE ENABLED. Inventory will not be updated." | tee -a $AssembleLog 306 | else 307 | echo "Updating device inventory." | tee -a $AssembleLog 308 | $jamfBinary recon -email $email 309 | $jamfBinary recon -endUsername $user 310 | $jamfBinary recon -assetTag "$assetTag" 311 | fi 312 | # Name Device the same as the asset tag 313 | if [[ $AssetToName =~ ^[tT]rue$ ]]; then 314 | echo "ASSET TO NAME IS SWITCHED ON. Setting device name to asset tag...." | tee -a $AssembleLog 315 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 316 | echo "TEST MODE ENABLED. Device name will not be updated." | tee -a $AssembleLog 317 | else 318 | /usr/sbin/scutil --set ComputerName "$assetTag" 319 | /usr/sbin/scutil --set LocalHostName "$assetTag" 320 | /usr/sbin/scutil --set HostName "$assetTag" 321 | 322 | dscacheutil -flushcache 323 | 324 | echo "Computer name has been set..." | tee -a $AssembleLog 325 | echo "`scutil --get ComputerName`" | tee -a $AssembleLog 326 | fi 327 | fi 328 | else 329 | echo "EXTRA INFO IS SWITCHED OFF." | tee -a $AssembleLog 330 | fi 331 | 332 | else 333 | dialog \ 334 | --presentation \ 335 | --button1disabled \ 336 | --title none \ 337 | --position centre \ 338 | --bannerimage "$banner" \ 339 | --icon "$orgLogo" \ 340 | --message "$welcomeMessage" \ 341 | --height 500 \ 342 | --alignment centre \ 343 | --messagefont 'name=Arial,size=16' \ 344 | --blurscreen \ 345 | --progress \ 346 | --commandfile $commandLog \ 347 | --infobox "$infoText" \ 348 | --helpmessage "$helpText" & 349 | sleep 10 350 | 351 | if [[ $EXTRAINFO =~ ^[tT]rue$ ]]; then 352 | 353 | echo "EXTRA INFO SWITCHED ON. Continuing to gather Email, Username and Asset Tag...." | tee -a $AssembleLog 354 | 355 | asset=$(dialog \ 356 | --title none \ 357 | --position centre \ 358 | --bannerimage "$banner" \ 359 | --icon "$orgLogo" \ 360 | --message "$welcomeMessage\n\nPlease enter the extra information required below." \ 361 | --height 500 \ 362 | --alignment center \ 363 | --blurscreen \ 364 | --messagefont 'name=Arial,size=16' \ 365 | --infobox "$infoText" \ 366 | --helpmessage "$helpText" \ 367 | --textfield "Email Address:",required,prompt="username@company.com" \ 368 | --textfield "User Name:",required,prompt="User Name" \ 369 | --textfield "Asset Tag:",required,prompt="#######" \ 370 | --json) 371 | 372 | email=$(echo $asset | awk -F '"Email Address:" : "' '{print$2}' | awk -F '"' '{print$1}') 373 | user=$(echo $asset | awk -F '"User Name:" : "' '{print$2}' | awk -F '"' '{print$1}') 374 | assetTag=$(echo $asset | awk -F '"Asset Tag: FT-MW" : "' '{print$2}' | awk -F '"' '{print$1}') 375 | 376 | echo "Email is: $email" | tee -a $AssembleLog 377 | echo "User name is: $user" | tee -a $AssembleLog 378 | echo "Asset Tag is: FT-MW$assetTag" | tee -a $AssembleLog 379 | 380 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 381 | echo "TEST MODE ENABLED. Inventory will not be updated." | tee -a $AssembleLog 382 | else 383 | echo "Updating device inventory." | tee -a $AssembleLog 384 | $jamfBinary recon -email $email 385 | $jamfBinary recon -endUsername $user 386 | $jamfBinary recon -assetTag "$assetTag" 387 | 388 | # Name Device the same as the asset tag 389 | if [[ $AssetToName =~ ^[tT]rue$ ]]; then 390 | /usr/sbin/scutil --set ComputerName "$assetTag" 391 | /usr/sbin/scutil --set LocalHostName "$assetTag" 392 | /usr/sbin/scutil --set HostName "$assetTag" 393 | 394 | dscacheutil -flushcache 395 | 396 | echo "Computer name has been set..." | tee -a $AssembleLog 397 | echo "`scutil --get ComputerName`" | tee -a $AssembleLog 398 | fi 399 | 400 | fi 401 | else 402 | echo "EXTRA INFO IS SWITCHED OFF." | tee -a $AssembleLog 403 | fi 404 | 405 | fi 406 | 407 | ######################################################################################### 408 | # Caffinate Dialog process 409 | ######################################################################################### 410 | 411 | dialogPID=$(pgrep -x Dialog) 412 | caffeinate -disu -w $dialogPID & 413 | 414 | ######################################################################################### 415 | # Dialog window update with list of apps 416 | ######################################################################################### 417 | 418 | echo "message: Your mac is now being provisioned with the following settings and applications." >> $commandLog 419 | echo "progresstext: Starting Installation...." >> $commandLog 420 | echo "list: " >> $commandLog 421 | echo "listitem: delete, index: 0" >> $commandLog 422 | echo "height: 600" >> $commandLog 423 | 424 | progressTotal=${#array[@]} 425 | sleep 2 426 | 427 | for appStatus in "${array[@]}"; do 428 | 429 | hash=$(echo $appStatus | cut -d ',' -f3) 430 | 431 | hashCheck=$(curl -s https://ics.services.jamfcloud.com/icon/hash_$hash | grep "AccessDenied") 432 | 433 | if [[ $hashCheck == "" ]]; then 434 | hashURL="https://ics.services.jamfcloud.com/icon/hash_" 435 | else 436 | hashURL="https://euw2.ics.services.jamfcloud.com/icon/hash_" 437 | fi 438 | 439 | echo "listitem: add, title: $(echo $appStatus | cut -d ',' -f1), icon: $hashURL$(echo $appStatus | cut -d ',' -f3), status: pending, statustext: pending" >> $commandLog 440 | 441 | done 442 | 443 | sleep 5 444 | 445 | step=$(echo 100/$progressTotal | bc -l) 446 | 447 | echo "Installation process started at `date +%T`" | tee -a $AssembleLog 448 | echo "Initial ProgressTotal: $progressTotal" 449 | echo "Incremental Step: $step" 450 | 451 | ######################################################################################### 452 | # Application installation 453 | ######################################################################################### 454 | 455 | progressStep=1 456 | 457 | until [ $progressStep -gt $progressTotal ]; do 458 | 459 | for appName in "${array[@]}"; do 460 | 461 | echo "listitem: title: $(echo $appName | cut -d ',' -f1), status: wait, statustext: installing" >> $commandLog 462 | echo "progress: increment $step" >> $commandLog 463 | echo "progresstext: Installing $(echo $appName | cut -d ',' -f1)...." >> $commandLog 464 | 465 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 466 | echo "TEST MODE ENABLED. $(echo $appName | cut -d ',' -f1) will not be installed." | tee -a $AssembleLog 467 | else 468 | echo "Applications........ ASSEMBLE!" | tee -a $AssembleLog 469 | echo "Installing $(echo $appName | cut -d ',' -f1)" | tee -a $AssembleLog 470 | $jamfBinary policy -event $(echo $appName | cut -d ',' -f2) -forceNoRecon > $PolicyLog 471 | fi 472 | 473 | sleep 1 474 | 475 | appFailed=$(cat $PolicyLog | grep "Installation failed") 476 | appInstalled=$(cat $PolicyLog | grep "Successfully installed") 477 | scriptInstalled=$(cat $PolicyLog | grep "code: 0") 478 | scriptFailed=$(cat $PolicyLog | grep "code: 1") 479 | dmgInstalled=$(cat $PolicyLog | grep "verbose: Installing") 480 | commandRan=$(cat $PolicyLog | grep "Result of command:") 481 | sleep 1 482 | 483 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 484 | echo "TEST MODE ENABLED. No App validation" | tee -a $AssembleLog 485 | echo "listitem: title: $(echo $appName | cut -d ',' -f1), status: error, statustext: installed" >> $commandLog 486 | echo "progresstext: TESTING $(echo $appName | cut -d ',' -f1)" >> $commandLog 487 | else 488 | if [[ $appInstalled =~ . ]] || [[ $scriptInstalled =~ . ]] || [[ $commandRan =~ . ]] || [[ $dmgInstalled =~ . ]]; then 489 | echo "$(echo $appName | cut -d ',' -f1) Installed" | tee -a $AssembleLog 490 | echo "listitem: title: $(echo $appName | cut -d ',' -f1), status: success, statustext: installed" >> $commandLog 491 | echo "progresstext: Installed $(echo $appName | cut -d ',' -f1)" >> $commandLog 492 | sleep 4 493 | fi 494 | if [[ $appFailed =~ . ]] || [[ $scriptFailed =~ . ]]; then 495 | echo "$(echo $appName | cut -d ',' -f1) failed to install" | tee -a $AssembleLog 496 | echo "listitem: title: $(echo $appName | cut -d ',' -f1), status: fail, statustext: Failed" >> $commandLog 497 | echo "progresstext: Failed to install $(echo $appName | cut -d ',' -f1)" >> $commandLog 498 | sleep 4 499 | fi 500 | if [[ $appInstalled == "" ]] && [[ $scriptInstalled == "" ]] && [[ $appFailed == "" ]] && [[ $scriptFailed == "" ]] && [[ $commandRan == "" ]] && [[ $dmgInstalled == "" ]]; then 501 | echo "$(echo $appName | cut -d ',' -f1) failed to install" | tee -a $AssembleLog 502 | echo "listitem: title: $(echo $appName | cut -d ',' -f1), status: error, statustext: Error" >> $commandLog 503 | echo "progresstext: Error with install $(echo $appName | cut -d ',' -f1)" >> $commandLog 504 | echo "There was an error with the installation. Please refer to the logs." | tee -a $AssembleLog 505 | sleep 4 506 | fi 507 | fi 508 | let "progressStep+=1" 509 | sleep 2 510 | echo "ProgressStep: $progressStep" 511 | echo "ProgressTotal: $progressTotal" 512 | done 513 | done 514 | sleep 2 515 | 516 | echo "progresstext: Setup Complete!" >> $commandLog 517 | 518 | sleep 2 519 | 520 | echo "Installation Finished at `date +%T`" | tee -a $AssembleLog 521 | 522 | ######################################################################################### 523 | # Dialog message to show completion 524 | ######################################################################################### 525 | 526 | # Check to see if FileVault Deferred enablement is active - do not edit below 527 | FV_DEFERRED_STATUS=$(fdesetup status | grep "Deferred" | cut -d ' ' -f6) 528 | 529 | # Logic to log user out if FileVault is detected. Otherwise, app will close. 530 | if [[ "$FV_DEFERRED_STATUS" = "active" ]]; then 531 | 532 | echo "Filevault is in deferred mode. User must log out and log in." | tee -a $AssembleLog 533 | 534 | if [[ "$banner" == "" ]]; then 535 | dialog \ 536 | --title Assemble \ 537 | --position centre \ 538 | --icon "$orgLogo" \ 539 | --height 500 \ 540 | --alignment centre \ 541 | --message "Setup Complete! \n\n $CURRENT_USER you are now all set and ready to go. Please click Logout to finish encrypting your device." \ 542 | --messagefont 'name=Arial,size=16' \ 543 | --blurscreen \ 544 | --button1text Logout \ 545 | --button1shellaction "launchctl bootout user/$(id -u $CURRENT_USER)" & 546 | else 547 | dialog \ 548 | --title none \ 549 | --bannerimage "$banner" \ 550 | --position centre \ 551 | --icon "$orgLogo" \ 552 | --height 500 \ 553 | --alignment centre \ 554 | --message "Setup Complete! \n\n $CURRENT_USER you are now all set and ready to go. Please click Logout to finish encrypting your device." \ 555 | --messagefont 'name=Arial,size=16' \ 556 | --blurscreen \ 557 | --button1text Logout \ 558 | --button1shellaction "launchctl bootout user/$(id -u $CURRENT_USER)" & 559 | fi 560 | sleep 2 561 | 562 | echo "quit:" >> $commandLog 563 | 564 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 565 | echo "TEST MODE ENABLED. Final Inventory update will not happen." | tee -a $AssembleLog 566 | else 567 | echo "Final device inventory update." | tee -a $AssembleLog 568 | $jamfBinary recon 569 | echo "Restarting JAMF Agent....." | tee -a $AssembleLog 570 | restartJamfFramework 571 | fi 572 | sleep 60 573 | exit 0 574 | 575 | else 576 | 577 | echo "height: 500" >> $commandLog 578 | echo "list: clear" >> $commandLog 579 | echo "message: Setup Complete! \n\n $CURRENT_USER you are now all set and ready to go. Please click finish." >> $commandLog 580 | echo "button1: enable" >> $commandLog 581 | echo "button1text: Finish" >> $commandLog 582 | 583 | if [[ $TESTING =~ ^[tT]rue$ ]]; then 584 | echo "TEST MODE ENABLED. Final Inventory will not be updated." | tee -a $AssembleLog 585 | else 586 | echo "Final device inventory update." | tee -a $AssembleLog 587 | $jamfBinary recon 588 | echo "Restarting JAMF Agent....." | tee -a $AssembleLog 589 | restartJamfFramework 590 | fi 591 | sleep 60 592 | exit 0 593 | fi 594 | --------------------------------------------------------------------------------