Is it possible to put 'util/library' shell scripts in .chezmoiscripts
dir?
#3506
-
I have a series of scripts that should run before chezmoi begins to render templates (think "install the Here's what things look like: # From inside source root:
❯ tree .chezmoiscripts
.chezmoiscripts
├── run_after_dot_zshrc.sh
├── run_before_00-install-pre-requisites.sh
├── run_once_before_install-fonts.sh
├── run_once_before_install-zsh-starter-kit.sh
├── run_onchange_install-packages.sh.tmpl
└── scripts
├── install-1password-cli.sh
└── utils.sh Where When I run ❯ cz apply
chezmoi: $mySourceDirPath/home/.chezmoiscripts/scripts/utils.sh: not a script
(this repeats for `install-1password-cli.sh` as well...) Which i've tracked down to here and the error is happening because the script does not have a My question Is there an incantation I can add to The reason i'd like to avoid re-locating things: relative paths won't really work given the /tmp/3963292091.00-install-pre-requisites.sh: line 12: ../../scripts/utils.sh: No such file or directory |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
chezmoi has |
Beta Was this translation helpful? Give feedback.
-
If these scripts are intended to never be copied to your home directory, you can use
|
Beta Was this translation helpful? Give feedback.
Thanks for the reply!
I am already using the chezmoiroot trick :) and your proposed layout is exactly what I tried before opening this thread. Unfortunately, it doesn't work since each
run_*.sh
has something to the effect ofsource ../../scripts/utils.sh
at the top but this relative file include path breaks when chezmoi copies therun_*
scripts:❯ cz apply /tmp/3963292091.00-install-pre-requisites.sh: line 12: ../../scripts/utils.sh: No such file or directory chezmoi: exit status 1
Versus when the
scripts/utils.sh
lives inside of .chezmoiscripts`:❯ cz apply chezmoi: $mySourceDirPath/home/.chezmoiscripts/scripts/utils.sh: not a script
I was able to work around the issue by changing the
s…