Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

policies spelt wrong (twice) and "# Remove custom welcomeBannerImageFileName" has a bug if welcomeDialog is false. #134

Closed
Honestpuck opened this issue Jan 23, 2024 · 6 comments
Assignees
Labels
bug Something isn't working waiting feedback Waiting on feedback from requestor

Comments

@Honestpuck
Copy link
Contributor

Before submitting a Setup Your Mac bug report, please review the open swiftDialog issues to help determine the source of the issue.

Describe the bug
policies is spelt 'polcies' in two strings. Do a search and replace :)

If you are running with welcomeDialog set to false the script attempts to remove a non-existent welcomeBannerImageFileName and fails

    # Remove custom welcomeBannerImageFileName
    if [[ -e "/var/tmp/${welcomeBannerImageFileName}" ]]; then
        updateScriptLog "COMPLETION ACTION: Removing /var/tmp/${welcomeBannerImageFileName} …"
        rm "/var/tmp/${welcomeBannerImageFileName}"

This has output of:

2024-01-23 16:53:56 - COMPLETION ACTION: Removing /var/tmp/ …
rm: /var/tmp/: is a directory

The problem is that when the variable is empty the -e test is testing for the existence of var/tmp/ which is true but then the rm command attempts to remove /var/tmp and fails, giving the error seen.

To Reproduce
Set "welcomeDialog" to false

Expected behavior
The routine to remove the file would not run.

Environment (please complete the following information):

  • OS version (i.e., 13.1) 14.2.1
  • Script version (i.e., 1.6.0) - Version 1.14.0, 21-Jan-2024

Additional context
This code works:

    # Remove custom welcomeBannerImageFileName
    if [[ "${welcomeBannerImageFileName}" != "" ]]; then
        updateScriptLog "COMPLETION ACTION: Removing /var/tmp/${welcomeBannerImageFileName} …"
        rm "/var/tmp/${welcomeBannerImageFileName}"
    fi

It would also work if you changed the -e (does it exist) to -f (is it a file) but I prefer the more explicit check.

@Honestpuck Honestpuck added the bug Something isn't working label Jan 23, 2024
@dan-snelson
Copy link
Collaborator

Thanks for the heads-up, @Honestpuck; I'll take a look.

@dan-snelson
Copy link
Collaborator

@Honestpuck:

While I did find two misspellings, I was unable to replicate the removal error with SYM 1.14.0:

2024-01-23 07:29:31 - # # # SETUP YOUR MAC VERBOSE DEBUG MODE: Line No. 2686 # # #
2024-01-23 07:29:31 - QUIT SCRIPT: Exiting …
2024-01-23 07:29:31 - QUIT SCRIPT: De-caffeinate …
2024-01-23 07:29:31 - The 'caffeinate' process isn't running.
2024-01-23 07:29:31 - QUIT SCRIPT: Removing /var/tmp/dialogCommandFileWelcome.3k5 …
2024-01-23 07:29:31 - QUIT SCRIPT: Removing /var/tmp/dialogCommandFileSetupYourMac.Loh …
2024-01-23 07:29:31 - QUIT SCRIPT: Removing /var/tmp/dialogCommandFileFailure.lP3 …
2024-01-23 07:29:31 - QUIT SCRIPT: Removing default dialog file …
2024-01-23 07:29:31 - QUIT SCRIPT: Executing Completion Action Option: 'Restart Attended' …
2024-01-23 07:29:31 - # # # SETUP YOUR MAC VERBOSE DEBUG MODE: Line No. 2218 # # #
2024-01-23 07:29:31 - Run "osascript -e display dialog "Setup Your Mac is operat" with title "Setup Your Mac: Debug Mode" buttons {"Close"} with icon note" as "501" … 
button returned:Close
2024-01-23 07:29:33 - COMPLETION ACTION: Removing /var/tmp/green-abstract-geometric-wallpaper_52683-29623.jpg …
2024-01-23 07:29:33 - COMPLETION ACTION: Removing /var/tmp/overlayicon.icns …
Dans-143-SYM:tmp root# 

@dan-snelson dan-snelson added the waiting feedback Waiting on feedback from requestor label Jan 23, 2024
@Honestpuck
Copy link
Contributor Author

Honestpuck commented Jan 23, 2024

Did you set $welcomeDialog to false and not set welcomeBannerImageFileName ? It looks like you had welcomeBannerImageFileName set to green-abstract-geometric-wallpaper_52683-29623.jpg which would not trigger the bug. It has to be empty.

@dan-snelson
Copy link
Collaborator

dan-snelson commented Jan 23, 2024

@Honestpuck:

The only change I made was:
welcomeDialog="${6:-"false"}"

(I want the banner image in the main SYM dialog.)

@Honestpuck
Copy link
Contributor Author

Honestpuck commented Jan 25, 2024 via email

@dan-snelson
Copy link
Collaborator

Addressed in SYM 1.14.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting feedback Waiting on feedback from requestor
Projects
None yet
Development

No branches or pull requests

2 participants