feat: Add Alpine hooks blog post

This commit is contained in:
ptrcnull 2021-07-13 12:31:02 +02:00
parent f28dd4bbb0
commit e75153f319
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
---
title: "How to use Alpine Linux commit hooks"
date: 2021-04-18T13:56:06+02:00
draft: 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:
```bash
#!/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
```