How can I flag a script as been executed already? #2282
-
Hello. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is tricky, but possible. First, the correct fix is to make all of your scripts, including your If that is not possible, then you need to create an entry for the script in chezmoi's state. You will need to calculate the SHA256 sum of the script's contents (after template execution) and add it to chezmoi's state. Say your script is called $ sha256sum script.sh
91ee34a755e613fc83be1e399b024d1dcbd8ce22800fdb004071518e85f66945 script.sh
$ chezmoi state set --bucket=scriptState --key=91ee34a755e613fc83be1e399b024d1dcbd8ce22800fdb004071518e85f66945 --value={} |
Beta Was this translation helpful? Give feedback.
This is tricky, but possible.
First, the correct fix is to make all of your scripts, including your
run_once_
scripts, idempotent, so it doesn't matter if they run one more than once.If that is not possible, then you need to create an entry for the script in chezmoi's state. You will need to calculate the SHA256 sum of the script's contents (after template execution) and add it to chezmoi's state.
Say your script is called
script.sh
, you would do something like: