Skip to content

Comments

bin/flatcar-update: don't assume $USER is set up, only use $EUID#58

Merged
pothos merged 2 commits intoflatcar-masterfrom
kai/flatcar-update-improvements
Jan 26, 2022
Merged

bin/flatcar-update: don't assume $USER is set up, only use $EUID#58
pothos merged 2 commits intoflatcar-masterfrom
kai/flatcar-update-improvements

Conversation

@pothos
Copy link
Member

@pothos pothos commented Jan 26, 2022

  • bin/flatcar-update: don't assume $USER is set up, only use $EUID
    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.
  • bin/flatcar-update: silence output on missing /etc/flatcar/update.conf
    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 entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
    ↑ will do in coreos-overlay under bugfixes:
- flatcar-update: Stopped checking for the `USER` environment variable which may not be set in all environments, causing the script to fail unless a workaround was used like prepending an additional `sudo` invocation ([PR#58](https://github.com/flatcar-linux/init/pull/58))

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.
@pothos pothos requested a review from a team January 26, 2022 15:26
@pothos pothos merged commit d9738cf into flatcar-master Jan 26, 2022
@pothos pothos deleted the kai/flatcar-update-improvements branch January 26, 2022 16:10
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
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.

2 participants