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

Offline install bundle external #4090

Open
Nova38 opened this issue Nov 16, 2024 · 6 comments
Open

Offline install bundle external #4090

Nova38 opened this issue Nov 16, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@Nova38
Copy link

Nova38 commented Nov 16, 2024

Is your feature request related to a problem? Please describe.

When installing dot files in a offline or airgaped environment getting external content is difficult and requires either using the archive command and then manually installing the dot files or not using the chezmoiexternal feature.

Describe the solution you'd like

I would like to propose a option to download the externals to an archive that could then be transferred along with the local copy of the dotfiles git repo to the offline/airgaped machine. Then when specifying the location of got repo in the unit command add a flag to also tell it where to find the externals archive. It would then copy the files out of the archive to the locations specified in the
chezmoiexternal files. Optionally allow specifying the machine specs/data so as to anwser templated files.

Describe alternatives you've considered

  • The closest solution in the archive command. However this loses the ability to template files.
  • Just not use the externals and manually add the files to the dotfiles repo, which would make update it more challenging.
  • alternatively add the files to a ignore file and use a custom bootstrap script to pre download them.

Additional context

An offline environment could include use cases such as a vm, or during presseeding/autoinstall where the repo could be stored on local media, a git server, or network storage.

An example of something similar would be how terraform provideds a way to mirror the providers to a local folder that can be copied down.

https://support.hashicorp.com/hc/en-us/articles/23562100651923-How-to-use-Terraform-CLI-with-Local-Mirror-for-Provider-Plugins-for-system-without-internet-access

@Nova38 Nova38 added the enhancement New feature or request label Nov 16, 2024
@KapJI
Copy link
Contributor

KapJI commented Nov 16, 2024

This can be solved by adding support for file:// schema proposed in #4072.

@Nova38
Copy link
Author

Nova38 commented Nov 16, 2024

Ah I didn't see that proposal. The proposed file:// would potentially resolve the issue. From my reading of that issue it would still require a decent about of manual labor to initially cache the needed files and then update the URL to include the file saved location. It would also require changing every external to have multiple urls and require that the end user comes up with a structure for the archive.

I think that there definitely is some overlap between the two proposals though. If I read that issue correctly the file:// proposals seeks to allow the end user to provide a copy instead of letting chezmoi download and cache it. This proposal seeks to have chezmoi preload the cache and then transfer it over and transparently load them. Though the implementation of the two proposals would probably have a bit of an overlap.

@halostatue
Copy link
Collaborator

If you’re dealing with multiple files, you can probably copy ~/.cache/chezmoi between machines.

@twpayne
Copy link
Owner

twpayne commented Nov 16, 2024

You can run chezmoi archive to generate an archive of your dotfiles on another machine with network access and then unpack this on the machine without external access.

@twpayne twpayne closed this as completed Nov 16, 2024
@twpayne twpayne reopened this Nov 16, 2024
@twpayne
Copy link
Owner

twpayne commented Nov 16, 2024

Note you can still use templating: use a different config file when generating the archive with the appropriate variables set.

@Nova38
Copy link
Author

Nova38 commented Nov 16, 2024

You can run chezmoi archive to generate an archive of your dotfiles on another machine with network access and then unpack this on the machine without external access.

That is how I am currently managing it, however it complicates trying to sync changes made on the remote machine back to the original repo and loses some of the other features like it's ability to run scripts on changing a specific file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants