Skip to content
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

Add sudo support for apt package installation in Terminal #1445

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

lolsZz
Copy link
Contributor

@lolsZz lolsZz commented Sep 6, 2024

Describe the changes you have made:

  1. A new sudo_install method in the Terminal class that:
    • First attempts to install a package without sudo
    • If that fails, it prompts the user for their sudo password
    • Then attempts to install the package using sudo with the provided password
  2. Modification of the run method to intercept apt install commands and use the
    new sudo_install method

These changes address the issue where Open Interpreter would crash when trying
to install packages that require sudo privileges. Now, it will handle such
installations more gracefully, improving the user experience and expanding the
capabilities of the interpreter.

Key benefits:

• Allows for seamless installation of packages requiring sudo privileges
• Improves security by using a more secure method of passing the sudo password
• Provides user feedback on the installation process
• Maintains the ability to install packages without sudo when possible

Note:
This implementation assumes the system is using apt as the package
manager. Further modifications may be needed to support other package managers
in the future.

Reference any relevant issues (e.g. "Fixes #000"):

Pre-Submission Checklist (optional but appreciated):

  • [ * ] I have included relevant documentation updates (stored in /docs)
  • [ * ] I have read docs/CONTRIBUTING.md
  • [ * ] I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • Tested on Windows
  • Tested on MacOS
  • [ * ] Tested on Linux

@KillianLucas KillianLucas changed the base branch from main to development October 10, 2024 19:36
@KillianLucas KillianLucas merged commit 6ef8d22 into OpenInterpreter:development Oct 10, 2024
@KillianLucas
Copy link
Collaborator

Thank you so much @lolsZz! This is brilliant, super simple. I'm going to change it to be when the LLM decides to run sudo though, for user interpretability. (Seeing that it tries to run something that doesnt require sudo, then being prompted for password, I think might freak some people out)

Also, the LLM will try to install things with sudo, but because no input is possible, it fails. I love just checking it. We could have this trigger when it just starts with sudo then it would work for everything.

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