Installomator icon indicating copy to clipboard operation
Installomator copied to clipboard

Swift Dialog window stuck after updating to 10.8

Open PckgrTom opened this issue 8 months ago • 9 comments

Since the release of 10.8 it seems that all SD notifications are getting stuck on our clients after installing an application.

PckgrTom avatar Apr 01 '25 00:04 PckgrTom

Confirmed that reverting the script to 10.7 does resolve it

PckgrTom avatar Apr 01 '25 01:04 PckgrTom

Same Problem here with 10.8

Image

5h4rk1337 avatar Apr 03 '25 10:04 5h4rk1337

This isn't built-in to installomator.. which script are you using? Please provide a link to the specific script you're using.

acodega avatar Apr 03 '25 16:04 acodega

This isn't built-in to installomator.. which script are you using? Please provide a link to the specific script you're using.

apologies, I'm using the following: https://github.com/Installomator/Installomator/blob/main/MDM/MDMs%20with%20local%20installed%20Installomator/App-install%20SS%20with%20swiftDialog%20and%20dockutil/App%20normal%20SS.sh

PckgrTom avatar Apr 03 '25 22:04 PckgrTom

I use also the "App normal SS.sh".

5h4rk1337 avatar Apr 07 '25 07:04 5h4rk1337

There's been a change in Swiftdialog command file permissions, see: https://github.com/swiftDialog/swiftDialog/releases/tag/v2.5.5

jfwdev avatar Apr 07 '25 12:04 jfwdev

There's been a change in Swiftdialog command file permissions, see: https://github.com/swiftDialog/swiftDialog/releases/tag/v2.5.5

This was released back in December though where this issue only started last weekend. Are you able to expand on why this has started impacting us?

PckgrTom avatar Apr 07 '25 23:04 PckgrTom

It's the if statement at the end. I'm not sure if using it is in error or something has changed in Jamf swiftDialog.. but remove the if statement at line 276. You still want the commands inside the statement. So just remove line 276 and line 291, and test.

acodega avatar Apr 10 '25 20:04 acodega

It's the if statement at the end. I'm not sure if using it is in error or something has changed in Jamf swiftDialog.. but remove the if statement at line 276. You still want the commands inside the statement. So just remove line 276 and line 291, and test.

We are using Intune. I can confirm, that commenting out line 276 and line 291 resolves the problem. But this is just a workaround.

The if statement fails, because the Installomator version is not extracted correctly

The main problem ist line 117 installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"

echo $installomatorVersion
2025-04-11 14:50:25 : INFO  : version : Total items in argumentsArray: 0
2025-04-11 14:50:25 : INFO  : version : argumentsArray:
10

Replace line 117 with: installomatorVersion="$(${destFile} version | grep -Eo '[0-9]+\.[0-9]+' | head -1 | cut -d '.' -f1)"

echo $installomatorVersion
10

This will fix the Problem.

PR #2324

5h4rk1337 avatar Apr 11 '25 13:04 5h4rk1337

Any reason why you're cutting the minor version number off the end?

This seems to work fine too

installomatorVersion="$(${destFile} version | grep -Eo '[0-9]+\.[0-9]+' | head -1)"

tully-systima avatar Jun 16 '25 08:06 tully-systima

@tully-systima I guess, because it was cut before as well and the minor version seems not to be needed. Bash does not support floating-point (decimal) arithmetic in [[ ... -lt ... ]] or (( ... )) expressions. These constructs only work with integers, so using a number like 10.8 causes a syntax error. Your Version seems to work, but gives me a syntax error. [[: 10.8: syntax error: invalid arithmetic operator (error token is ".8")

5h4rk1337 avatar Jun 20 '25 14:06 5h4rk1337

Keep in mind Installomator is zsh, not bash.

acodega avatar Jun 23 '25 11:06 acodega

So after investigating this I found a few additional situations that could be causing the Dialog window to not close correctly after the script ends.

Biggest one is that any errors experienced in the installomator.sh script that caused an exit would also exit the App normal SS script, leaving dialog running without calling dialogUpdate "quit:"

So I have a few improvements that can assist: #2455

  • update shebang to #!/bin/zsh --no-rcs

  • Added an early exit if no label has been set, preventing launching the Dialog process for doomed scripts

  • Improved installomatorVersion string parsing (adapted from @5h4rk1337 ):

 installomatorVersion="$(${destFile} version | grep -Eo '[0-9]+\.[0-9]+' | head -1)"
  • Set Installomator.sh script to run in a subshell, and store logs in a unique temp directory for each process. This is to prevent Installomator script exit commands originating from errors inside Installomator.sh from exiting the App normal SS script early, which prevents graceful close of the Dialog process. Output is saved to a temp directory rather than directly into /tmp, to prevent multiple simultaneous scripts from cross contaminating logs:
temp_dir=$(mktemp -d)
(
    exec "${destFile}" "${item}" ${installomatorOptions} ${installomatorNotify}
) > "${temp_dir}/install_${item}_output.log" 2>&1
installomatorExitCode=$?
cmdOutput="$(cat ${temp_dir}/install_${item}_output.log; echo "exit code $installomatorExitCode")"
checkCmdOutput "${cmdOutput}"
  • improved installomatorVersion and macOS Build version checks to accomodate for minor version numbers
if [[ $(echo "$installomatorVersion < 10" | bc -l) -eq 1 ]] || [[ $(sw_vers -buildVersion | cut -c1-2) -lt 20 ]]; then
  • added dialogUpdate "quit:" to caffexit to attempt graceful dialog closure if it has not already been done prior to script exit, followed by a force quit of the dialog PID caffexit in case it is still running after graceful exit command. Only the dialog PID generated by this script is closed, preventing any unrelated, simultaneous dialog processes from being closed:
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
    kill "$caffeinatepid"
    dialogUpdate "quit:"
    # Kill dialog if it's still running
    [[ -n "$dialogPID" ]] && kill -0 "$dialogPID" 2>/dev/null && kill "$dialogPID" 2>/dev/null || true
    exit $1
}
  • modified LOGO argument parsing for the main installation command, to only include the LOGO argument if it is not empty, avoiding errors
[[ -n "$LOGO" ]] && installomatorOptions="LOGO=$LOGO ${installomatorOptions}"

tully-systima avatar Jun 24 '25 05:06 tully-systima