-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
fix: interactive postinst script breaks install for non-interactive environments #227837
Conversation
# Determine whether to write the Microsoft repository source list | ||
# 0 means do not write | ||
# 1 means ask and then write if Yes | ||
# 2 means write without asking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this would make the default behavior 0 where we no longer write? I think this would break our update story we've had forever and users would get stuck on older versions without realizing it. Perhaps the default should be determined on whether the terminal is interactive?
- Is CODE_INSTALL_WITH_REPO set? Use that
- Is interactive? CODE_INSTALL_WITH_REPO = ask
- Is not interactive? CODE_INSTALL_WITH_REPO = write (old behavior)
The environment variable would give users control when it's important, we keep the old behavior when not interactive (automatically install repo for updates) and for interactive we ask users explicitly.
Then we can add to docs how CODE_INSTALL_WITH_REPO
works and that you can run it like this:
CODE_INSTALL_WITH_REPO=0 ...
Maybe better to use strings instead of numbers so it's more obvious and you don't need to consult docs?
CODE_INSTALL_WITH_REPO="no" ...
CODE_INSTALL_WITH_REPO="ask" ...
CODE_INSTALL_WITH_REPO="write" ...
Also if CODE_INSTALL_WITH_REPO
has an unexpected value we should probably warn and proceed with the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two variables. I have changed WRITE_SOURCE, the internal variable, to use 'yes', 'ask', or 'no'.
Meanwhile, the if conditions still only check if CODE_INSTALL_WITH_REPO = true or if CODE_INSTALL_WITH_REPO = false.
I also added a new condition for non-interactive terminals later in the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the environment variable to match with the docs, which currently only mention debconf.
8a9fc71
to
74e6923
Compare
0022b5e
to
2877a96
Compare
I realized I forgot to verify the build. |
2877a96
to
b1b71c3
Compare
Verification build LGTM. |
With the latest Stable release, first-time Debian package users have to confirm whether they want to add the Microsoft repository or not.
This PR adds more checks so that users in non-interactive or CI environments could opt in or opt out of installing the repository by explicitly setting the debconf value before starting the install. Machines without debconf are automatically opted in to installing the repository to match with the previous behaviour.
Closes #22145