ptrcnull.me/content/posts/alpine-commit-hooks.md

523 B

title date draft
How to use Alpine Linux commit hooks 2021-04-18T13:56:06+02:00 false
  • Create directory "/etc/apk/commit_hooks.d"
  • Put your executable files in there
  • First argument passed to your script is the stage (pre-commit/post-commit)

Example hook:

#!/bin/bash

if ! mount | grep -q '/boot/efi'; then
	mount /boot/efi
fi

if [[ "$1" == "post-commit" ]]; then
	cp /boot/initramfs-renoir /boot/efi/alpine/initramfs-renoir
	cp /boot/vmlinuz-renoir /boot/efi/alpine/vmlinuz-renoir	
fi