25 lines
523 B
Markdown
25 lines
523 B
Markdown
|
---
|
||
|
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
|
||
|
```
|