create git hooks that dynamically update the sha512sums of local files #9

Open
opened 2024-09-01 03:45:01 +00:00 by fack · 1 comment
Owner

For example, given a local file in an butane template such as any .bu file in ./butane/

Excerpt from asuka.bu:

    - path: /etc/NetworkManager/system-connections/ad-hoc.nmconnection
      mode: 0600
      contents:
        local: ./butane/files/etc/NetworkManager/system-connections/ad-hoc-wifi.nmconnection
        verification:
          hash: sha512-80743cef2cb3203e3635ca363046cbc3a0cbc35ac96c17bbd9db0b7d01af4bde11b98236a8a491ac0bd6e3bb7bfe0a3c10b2a19fb9937a76a0a36b906ad57849

Write a script (using yqand sha512sum) that can be invoked prior to commiting that will update the relevant storage.files.path.contents.verification.hash to whatever sha512sum for the file which currently exists in the corresponding storage.files.path.contents.local dir.

Good issue for someone wanting to dip their toes into githooks, yq, or butane.

ref:

For example, given a local file in an butane template such as any `.bu` file in [./butane/](https://git.cyberia.club/fack/rls/src/branch/main/butane) > Excerpt from [asuka.bu](https://git.cyberia.club/fack/rls/src/branch/main/butane/asuka.bu): ```yaml - path: /etc/NetworkManager/system-connections/ad-hoc.nmconnection mode: 0600 contents: local: ./butane/files/etc/NetworkManager/system-connections/ad-hoc-wifi.nmconnection verification: hash: sha512-80743cef2cb3203e3635ca363046cbc3a0cbc35ac96c17bbd9db0b7d01af4bde11b98236a8a491ac0bd6e3bb7bfe0a3c10b2a19fb9937a76a0a36b906ad57849 ``` Write a script (using `yq`and `sha512sum`) that can be invoked prior to commiting that will update the relevant `storage.files.path.contents.verification.hash` to whatever sha512sum for the file which currently exists in the corresponding `storage.files.path.contents.local` dir. Good issue for someone wanting to dip their toes into githooks, yq, or butane. ref: * https://coreos.github.io/butane/examples/#files * https://mikefarah.gitbook.io/yq * https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
Author
Owner

hell, even a normal script would be chill, there's a script do to this (sortof) on here: https://awasu.com/weblog/k3s-coreos/install-coreos/

hell, even a normal script would be chill, there's a script do to this (sortof) on here: https://awasu.com/weblog/k3s-coreos/install-coreos/
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: fack/rls#9
No description provided.