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

Anyway to install/reinstall without any user interaction? #110

Open
melink14 opened this issue Jul 2, 2022 · 2 comments
Open

Anyway to install/reinstall without any user interaction? #110

melink14 opened this issue Jul 2, 2022 · 2 comments

Comments

@melink14
Copy link

melink14 commented Jul 2, 2022

I'm thinking about using this with Github Codespaces to counter the fact that there is no persistent bash history there.

Codespaces allows us to run a environment setup script but that won't work welll if in the middle of the installation there is a installation prompt for user input.

It'd be great if I could invoke the install script with the inputs already provided (or perhaps provided in a known file)

@rcaloras
Copy link
Owner

Hey @melink14 - One quick way you could implement this would be to create/copy over an existing bashhub config file into a mock bashhub directory. The installer should run without any input then so long as the config is valid and it'll just treat it as if it's an update of the installation, rather than a new install.

I think it'd be fairly easy actually. Not sure the setup script exactly, but you could add something like:

# create your mock installation and config
mkdir ~/.bashhub
echo "[bashhub]\n access_token =$ACCESS_TOKEN\n system_name = $HOST" > ~/.bashhub/config
# standard install
curl -OL https://bashhub.com/setup && bash setup

Two caveats with this approach:

  1. you'll have to simply embed or pass the access token info somehow. I'm assuming you'd get the token as well from registering on another system first.
  2. All the instances of code spaces would be associated with the same system you registered the access token on. If you don't care about differentiating between the instances, it shouldn't be a problem.

If you want a more robust/full solution, it should also be pretty straight forward to extend the install script to take a username, password, and system_name passed with the environment to skip user input during setup. I think this is a pretty interesting use case so I'd be happy to help if there's more/broader interest in this. Otherwise would encourage a PR if you do it!

@melink14
Copy link
Author

Thanks for the reply. It seems that would work pretty well given you can save secrets for use in codespaces quite easily (https://docs.github.com/en/codespaces/managing-your-codespaces/managing-encrypted-secrets-for-your-codespaces)

I'm also not worried about differentiating instances so this ends up working quite well for me. (I'll try it out next time I do a code spritn!)

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

No branches or pull requests

2 participants