Skip to content

Fix Swift Dialog (PKG) onboarding to be idempotent (#245)#254

Open
theneiljohnson wants to merge 1 commit intomicrosoft:masterfrom
theneiljohnson:fix-swiftdialog-pkg-idempotency
Open

Fix Swift Dialog (PKG) onboarding to be idempotent (#245)#254
theneiljohnson wants to merge 1 commit intomicrosoft:masterfrom
theneiljohnson:fix-swiftdialog-pkg-idempotency

Conversation

@theneiljohnson
Copy link
Copy Markdown
Collaborator

Resolves #245.

Thanks to @threeonparfive for the very detailed bug report — they were correct on every count.

Problem

The Swift Dialog (PKG) onboarding wrapper was supposed to run only once per device, but in practice it re-ran whenever Intune re-evaluated the PKG:

  • intunePost.sh had a marker check, but it was commented out.
  • intunePre.sh had no marker check at all, so its destructive cleanup (rm -rf of the existing swiftDialog install, log dir wipe, etc.) always ran.
  • Pre-creating the marker file was therefore a no-op, even though the README implied it should opt a device out.

Fix

  • intunePre.sh: added a marker check at the top, before any cleanup. If onboardingComplete exists the script exit 1s, which (per Microsoft Learn) aborts the entire PKG install and skips post — making the marker a genuine opt-out switch.
  • intunePost.sh: uncommented the equivalent guard as belt-and-braces (changed its exit 1 to exit 0 since by post-install stage there's nothing to abort). Marker is still written at the end of a successful run.
  • readme.md: new "Run-once / opt-out marker" section documenting the marker path, how to pre-create it to opt a device out, and how to delete it to force re-onboarding.

Marker path

/Library/Application Support/Microsoft/IntuneScripts/Swift Dialog/onboardingComplete

Resolves microsoft#245.

The 'have we run before?' guard in intunePost.sh was commented out and
intunePre.sh had no equivalent check at all, so the destructive cleanup
in pre always ran (rm -rf the existing swiftDialog install) and the
onboarding scripts always re-ran whenever the PKG was re-evaluated.

Changes:
- intunePre.sh: check for the onboardingComplete marker before doing
  any cleanup; exit 1 to abort the PKG install entirely if present
  (per Microsoft Learn, a non-zero pre-install script aborts the
  install and skips post). This makes the marker an effective opt-out
  switch.
- intunePost.sh: uncomment the matching marker check as a belt-and-
  braces guard. Marker is still written at the end of a successful
  onboarding run.
- readme: document the marker path, how to pre-create it to opt a
  device out, and how to delete it to force a re-onboarding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swift Dialog (PKG): How to make sure it only runs once, during onboarding?

1 participant