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

Local repository. #3813

Closed
eriad25 opened this issue Jun 15, 2024 · 7 comments
Closed

Local repository. #3813

eriad25 opened this issue Jun 15, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@eriad25
Copy link

eriad25 commented Jun 15, 2024

My idea is about adding feature to chezmoi that would allow us to create repository that contains dotfiles we can actually add to image builder when we want to make custom iso. Idea is to add 2 or 3 commands that would be needed for chezmoi to do it's job in [[post]] which is equivalent to kickstart's %post but rather than relly on internet pulling dot files from github i'd like to have an option to have it already stored on my iso image if i am installing on single machine so chezmoi can apply dotfiles from local repo because fedora asks for wifi info during inital setup after you run it for the first time after install. I can predefine wifi settings in image builder but i'd like to share my custom iso of fedora with everyone so i don't have to predefine anything. If i make it work i am planning on making video on how to make custom iso of fedora.

@eriad25 eriad25 added the enhancement New feature or request label Jun 15, 2024
@twpayne
Copy link
Owner

twpayne commented Jun 15, 2024

Could you state exactly what feature is missing from chezmoi?

Are you aware of chezmoi archive and #1410?

@halostatue
Copy link
Collaborator

I think that this is likely to be supported already with --source or --working-tree (or both). Outside of assuming that there's an already existing --source and --working-tree, if chezmoi init can be initialized from a local repo instead of a remote repo (chezmoi init /mount/custom-iso/common/bare-repo), this could probably be run without anything extra.

@eriad25
Copy link
Author

eriad25 commented Jun 16, 2024

So it can be done. Ok. Anyway feature that could be usefull is if bare-repo could be installed like other repositories where you get rpms from iso to system so chezmoi can apply it during post right before i login into system. Is it possible to set commands this way: cp /mount/custom-iso/common/bare-repo to my destination, then i have to apply those
chezmoi init path to where i copied dot files
How would i add repo with dotfiles to iso by the way? If you know how please do tell.

@halostatue
Copy link
Collaborator

So it can be done. Ok. Anyway feature that could be usefull is if bare-repo could be installed like other repositories where you get rpms from iso to system so chezmoi can apply it during post right before i login into system. Is it possible to set commands this way: cp /mount/custom-iso/common/bare-repo to my destination, then i have to apply those chezmoi init path to where i copied dot files How would i add repo with dotfiles to iso by the way? If you know how please do tell.

What you’re talking about is way outside of chezmoi's happy path — which isn't necessarily a bad thing, see Install Doctor for a really interesting approach. That means that you’re doing some trailblazing and I was raising some ways that it could possibly be made to work.

I'm not sure if my suggestions will work, because I don't know whether chezmoi init will work with a local bare repository (or even a non-bare repository). This is something that you could pretty easily experiment with in a VM, and that pretty much applies to everything you’ve asked for here, because I don't really understand what you’re trying to do, much less why — so I can't really address the feasibility.

@eriad25
Copy link
Author

eriad25 commented Jun 16, 2024

What i am really trying to do is create iso of fedora that will install fedora and apply dot file configurations during post so when you input needed info it boots up in fully configired desktop environment. Basicaly what i am trying to do is make custom iso based on everything i have installed but in fedora way because you can't do it in same way cubic does it for ubuntu.

@halostatue
Copy link
Collaborator

That makes sense. Unfortunately, I don't use Fedora or Ubuntu, and I don't know that I would be trying to achieve what you’re doing if I did so I am out of my depth on how this would work for you. I do have a couple of suggestions based on a few assumptions. You will need to figure out how to make this work on your own, but I believe that chezmoi will just work if you do this.

Assumptions

  • Your ISO will be refreshed periodically.
  • You do NOT have secrets to be templated into your environment.
  • Your ISO can have arbitrary tarballs.
  • Your ISO always creates the same user.
  • Your golden system has chezmoi installed and its repo is cloned from something on the network.

Suggestions

  • From your "golden" system, create a tarball ('chezmoi-base.tar') that contains .config/chezmoi, .local/share/chezmoi, and .cache/chezmoi from your home directory. This will be put into your ISO.
  • After creating the user and installing chezmoi, take the base tarball and untar it into that user's $HOME.
  • Run chezmoi apply.

Cons

  • You are bypassing chezmoi init here, so that's one thing that could be problematic if there are options you set in .config/chezmoi/chezmoi.toml based on the machine.
  • Your configs will be out of date as of the last time you created your ISO.

Pros

  • Once you reboot after install, you should be able to run chezmoi update or whatever your wish and the connection will just work (modulo, of course, the fact that your SSH keys should differ between machines).

If you have further questions on how to make this work, I would suggest you open a discussion so that other users who might be doing something similar to you can find it more readily, as I don't believe that there are any features that need to be added to chezmoi to enable this.

@halostatue halostatue closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
@eriad25
Copy link
Author

eriad25 commented Jun 17, 2024

Thanks for info.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants