Dotinit (dotinit.sh) is a simple shell script to initialize your dotfiles. It makes deploying your dotfiles as easy as sh -c "$(curl -fsSL https://github.com/$user/dotinit/raw/master/dotinit.sh)". Once dotinit is set up, you can mirror your setup anywhere with this simple command.
To use dotinit.sh to bootstrap your dotfiles:
-
Fork this repository.
-
Copy
initrc.csvto your dotfiles repository.NOTE: You can also use
initrc.csvfrom your forked dotinit repository itself, though it is recommended to use it from your dotfiles repository, so that you can fetch new commits from this repository more easily without getting merge conflicts. -
Edit the following variables in your forked
dotinit.sh:$BACKUP_DIR: Path to directory where existing files (if any) will be backed up.$DOTFILES_DIR: Path to your local dotfiles directory, from where symlinking will be done.$DOTFILES_RC: Path to your localinitrc.csvfile, which will be read to know what files to deploy. Recommended value is$DOTFILES_DIR/initrc.csv$REMOTE_BRANCH: Branch of your dotfiles repository.$REMOTE_REPO: URL of your dotfiles repository, used when the$DOTFILES_DIRdoes not exists, e.g., in a fresh install.$REMOTE_RC: URL to your rawinitrc.csvfile, used when the$DOTFILES_RCdoes not exists for any reasons.
You can also use dotinit in a traditional way, i.e, calling ./dotinit.sh from your terminal (or simply dotinit.sh if it is in your $PATH).
initrc.csv is a "config" file for dotinit. It contains comma seperated list of two values:
- first value corresponds to
$link, the path where the link will be created. - second value corresponds to
$target, which is the path of same file as from root of your dotfiles repository.
NOTE:
- The first line of
initrc.csvis disregarded and will not be used while symlinking. - Shell variables are not expanded in
initrc.csv. Only~is replaced with$HOMEand no other variables like$XDG_CONFIG_HOMEwill work.
Sample initrc.csv:
DEPLOY PATH, PATH FROM DOTFILES REPO
~/.vimrc,vimrc
~/.tmux.conf,tmux.conf
~/.config/nvim,config/nvim
dotinit.sh has the following flags:
-h: print help and exit.-v: print version and exit.-b: path to$BACKUP_DIR.-c: URL or path toinitrc.csvfile; sets either$REMOTE_RCor$DOTFILES_RC.-d: URL or path to dotfiles repository; sets either$REMOTE_REPOor$DOTFILES_DIR.
- In a fresh system install (
$DOTFILES_DIRneed not exist,$REMOTE_REPOwill be cloned and deployed):
sh -c "$(curl -fsSL https://github.com/pixxel8/dotinit/raw/master/dotinit.sh)"- When you add new file in dotfiles repository (uses all the variables set in
dotinit.sh):
dotinit.sh- Deploy and backup to specific directory:
dotinit.sh -b ~/.cache/dotfile-backup- Deploy from specific remote repository:
dotinit.sh -d https://github.com/pixxel8/dotfiles -b ~/.cache/dotfile-backupCopyright (c) 2021 Jitesh. Released under the GPLv3 License. See LICENSE for details.