Bootstrap configuration - a temporary configuration for controlled pre-initialization #4415
Lockszmith-GH
started this conversation in
Show and tell
Replies: 1 comment
-
Change log:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Ever found yourself needing to setup, your system BEFORE setting up chezmoi?
Like installing Homebrew or pulling, via .chezmoiexternals your secret/password vault binaries your envrionment needs to properly intialize.
Or, maybe you work on some systems that don't share enough to be managed in the same chezmoi source, but you still want them on the same repo, and have chezmoi just use one directory for system A and another for system B?
That's what I was looking to solve. I call my solution 'bootstrap chezmoi' - think of the Linux boot process: the bootloader loads initrd, a temporary "throwaway" OS, with the necessary drivers to initialize the hardware, so the OS can properly load.
Repo structure
The root dir of the repo is for documentation/orientation, as little content as possible.
It contains:
A 'throwaway' chezmoi bootstrap environment:
This
README.md
and adocs
directory for additional documentation.chezmoi.roots
containing environment specific chezmoi roots.Bootstrap
The key to the bootstrap process are the scripts in
.chezmoiscripts/
and.chezmoiignore
..chezmoiignore (link to source)
It ensures that chezmoi process ONLY
.chezmoiscripts/
and it's content, allowing for bootstrap scripts to run and prepare the grounds for any requirements the actual chezmoi source-state will require to intiialize properly..chezmoiroot
, which points to the actual root source-state, will be generated by these initialization scripts.IMPORTANT: This file is NEVER part of the repo.
After the actual root has been setup, the bootstrap configuration needs to be discarded, and
chezmoi init --apply
will need to run again, this time intializing the user's envrionment.To reiterreiterate, the initialization scripts will bootstrap the envrionment by taking the following steps:
.chezmoiroot
.chezmoiroot
exists.).gitignore
ensures.chezmoiroot
is never added to git, as it is different on every machine.The key to the process, is the initialization script, below are the bare-bone mandatory code in
bash
:Check out my implementation for a fully working solution (including initialization on Windows).
Beta Was this translation helpful? Give feedback.
All reactions