setup-your-mac / Setup-Your-Mac

Setup Your Mac aims to simplify initial device configuration by leveraging swiftDialog and Jamf Pro Policy Custom Events to allow end-users to self-complete Mac setup post-enrollment.
https://snelson.us/sym
MIT License
246 stars 54 forks source link

check bannerImage & welcomeBannerImage - resubmit #22

Closed amadotejada closed 1 year ago

amadotejada commented 1 year ago

The Dialog fails to open if the banner/welcome images are not available. We use this to test the image URLs and set an alternative image if the default fails. Folks can add a second custom image as a backup.

Resubmit of: #21

dan-snelson commented 1 year ago

Thanks big bunches, @amadotejada!

benphilware commented 1 year ago

with drtaru's help, found that $welcomeBannerImage check will fail if the image is local to the file system rather than hosted somewhere else. This will fail when the image is local. if curl --output /dev/null --silent --head --fail "$welcomeBannerImage"; then updateScriptLog "WELCOME DIALOG: welcomeBannerImage is available, using it" else updateScriptLog "WELCOME DIALOG: welcomeBannerImage is not available, using a default image" welcomeBannerImage="https://img.freepik.com/free-photo/yellow-watercolor-paper_95678-448.jpg" fi

This will succeed if the image is local. # Check if the custom welcomeBannerImage is available, and if not, use a alternative image if [ -f "$welcomeBannerImage" ]; then updateScriptLog "WELCOME DIALOG: welcomeBannerImage is available, using it" else updateScriptLog "WELCOME DIALOG: welcomeBannerImage is not available, using a default image" welcomeBannerImage="https://img.freepik.com/free-photo/yellow-watercolor-paper_95678-448.jpg" fi

dan-snelson commented 1 year ago

Thanks, @benphilware; I'll counsel with @amadotejada on how best to proceed.

fitzwater-rowan commented 1 year ago

I changed line 446 to if [ curl --output /dev/null --silent --head --fail "$welcomeBannerImage" ] || [ -f "$welcomeBannerImage" ]; then to resolve this issue. This statement covers both remote and local images.