-
Couldn't load subscription status.
- Fork 515
[common-utils] If group userGid exists, use its name #1430
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -411,12 +411,16 @@ elif [ "${USERNAME}" = "none" ]; then | |
| USER_UID=0 | ||
| USER_GID=0 | ||
| fi | ||
|
|
||
| # Create or update a non-root user to match UID/GID. | ||
| group_name="${USERNAME}" | ||
| group_name=$(getent group "$USER_GID" | cut -d: -f3) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @sleiner I am not sure if this would really solve the problem you had encountered as you have mentioned. It would probably fail while trying to create a new group for user |
||
| if [ -z "$group_name" ]; then | ||
| # Group does not yet exist and will be created. Use the user name as group name. | ||
| group_name="${USERNAME}" | ||
| fi | ||
| if id -u ${USERNAME} > /dev/null 2>&1; then | ||
| # User exists, update if needed | ||
| if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -g $USERNAME)" ]; then | ||
| group_name="$(id -gn $USERNAME)" | ||
| groupmod --gid $USER_GID ${group_name} | ||
| usermod --gid $USER_GID $USERNAME | ||
| fi | ||
|
|
||
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.
Hello @sleiner ,
Thank you for the contribution. Please describe the fix in a detailed manner. Also add test here & to test you can use
devcontainer features testcommand locally in the vscode terminal. Also please do a version bump