Skip to content

init_userconf.sh: only add line to /etc/sudoers once#996

Merged
eitsupi merged 1 commit intorocker-org:masterfrom
zhoualbert:zhoualbert-add-once-sudoers
Mar 20, 2026
Merged

init_userconf.sh: only add line to /etc/sudoers once#996
eitsupi merged 1 commit intorocker-org:masterfrom
zhoualbert:zhoualbert-add-once-sudoers

Conversation

@zhoualbert
Copy link
Copy Markdown
Contributor

The script init_userconf.sh is installed into /etc/cont-init.d/02_userconf and will be run every time the container is started.

Currently, if the container is restarted multiple times, the line %sudo ALL=(ALL) NOPASSWD:ALL will be added each time the container is started.

This change checks if the line already exists and does not add it if it does.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the container init script to avoid repeatedly appending the same sudoers rule on every container start, making the startup behavior idempotent.

Changes:

  • Introduces variables for the sudoers rule line and target file.
  • Adds a grep check intended to only append %sudo ALL=(ALL) NOPASSWD:ALL when it is not already present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/init_userconf.sh Outdated
Comment thread scripts/init_userconf.sh Outdated
The script `init_userconf.sh` is installed into `/etc/cont-init.d/02_userconf` and will be run every time the container is started.

Currently, if the container is restarted multiple times, the line `%sudo ALL=(ALL) NOPASSWD:ALL` will be added each time the container is started.

This change checks if the line already exists and does not add it if it does.
@zhoualbert zhoualbert force-pushed the zhoualbert-add-once-sudoers branch from 2c69a97 to ba37575 Compare March 20, 2026 05:56
@zhoualbert
Copy link
Copy Markdown
Contributor Author

I implemented Copilot's suggestion. Thanks AI!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zhoualbert
Copy link
Copy Markdown
Contributor Author

Weird errors. The lint error is

 Failed to call GitHub Status API: curl: (22) The requested URL returned error: 403

The build error seems to be related to a 500 URL error

12.66 --2026-03-20 06:45:05--  https://rstudio.org/download/latest/daily/server/jammy/rstudio-server-latest-amd64.deb
connected.
12.94 HTTP request sent, awaiting response... 500 Internal Server Error
13.05 2026-03-20 06:45:05 ERROR 500: Internal Server Error.
13.05 
------
Dockerfile:10
--------------------
   8 |     ARG script_name=install_rstudio.sh
   9 |     ARG script_arg=skip
  10 | >>> RUN /test.sh ${script_name} ${script_arg}
  11 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c /test.sh ${script_name} ${script_arg}" did not complete successfully: exit code: 8
Error: Process completed with exit code 1.

@eitsupi
Copy link
Copy Markdown
Member

eitsupi commented Mar 20, 2026

Thank you for your contribution!
Don't worry about the linter, the CI is just broken...

I'll check it later and merge it.

Copy link
Copy Markdown
Member

@eitsupi eitsupi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eitsupi eitsupi merged commit b2adcaa into rocker-org:master Mar 20, 2026
29 of 31 checks passed
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.

3 participants