bin/flatcar-update: don't assume $USER is set up, only use $EUID#58
Merged
pothos merged 2 commits intoflatcar-masterfrom Jan 26, 2022
Merged
bin/flatcar-update: don't assume $USER is set up, only use $EUID#58pothos merged 2 commits intoflatcar-masterfrom
pothos merged 2 commits intoflatcar-masterfrom
Conversation
In some shells the USER variable does not get set up in the environment, causing the script to fail unless it is wrapped in a sudo call again to set the USER variable. Rely only on bash's EUID variable instead for the permission check.
The update.conf under /etc/flatcar does not really need to exist but grep's error message found its way into the script output. Silence the grep error message since it's ok when the file is missing.
krnowak
approved these changes
Jan 26, 2022
pothos
added a commit
to flatcar-archive/coreos-overlay
that referenced
this pull request
Jan 26, 2022
This pulls in flatcar/init#58 (bin/flatcar-update: don't assume $USER is set up, only use $EUID) and flatcar/init#51 network: Enable the RAs to fix IPv6 address assignment
Merged
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some shells the USER variable does not get set up in the
environment, causing the script to fail unless it is wrapped in
a sudo call again to set the USER variable.
Rely only on bash's EUID variable instead for the permission check.
The update.conf under /etc/flatcar does not really need to exist but
grep's error message found its way into the script output.
Silence the grep error message since it's ok when the file is missing.
How to use
When merging, bump coreos-overlay commit ID
Testing done
Ran the script and checked that it detects running as root or not, and doesn't print the warning anymore
changelog/directory (user-facing change, bug fix, security fix, update)↑ will do in coreos-overlay under bugfixes: