65 lines
3.0 KiB
Markdown

# mkinitcpio-dropbear-pacman-hook
Two pacman hooks that patch Arch Linux package `mkinitcpio-dropbear` for use in ZFSBootMenu
# Setup
> Not explicitly listed here as a step but still relevant: These `pacman` hooks only make sense if you're using ZFSBootMenu images and have `mkinitcpio-dropbear` package installed.
Get started like so:
1. Clone repo into arbitrary path `<repo>`
1. Make shell scripts executable
```
chmod +x <repo>/*.sh
```
1. Symlink to hook files, for example
```
sudo ln -s <repo>/pacman-mkinitcpio-dropbear-hook.sh /usr/local/bin/pacman-mkinitcpio-dropbear-hook
sudo ln -s <repo>/pacman-mkinitcpio-dropbear-install.sh /usr/local/bin/pacman-mkinitcpio-dropbear-install
sudo ln -s <repo>/pacman-mkinitcpio-dropbear-hook.hook /usr/share/libalpm/hooks/pacman-mkinitcpio-dropbear-hook.hook
sudo ln -s <repo>/pacman-mkinitcpio-dropbear-install.hook /usr/share/libalpm/hooks/pacman-mkinitcpio-dropbear-install.hook
```
Note that while you may choose arbitrary locations for symlinks the hook files reference `/usr/local/bin/pacman-mkinitcpio-dropbear-hook` and `.../pacman-mkinitcpio-dropbear-install`, respectively. Change that accordingly if you need to.
1. Optionally update shell scripts with the repo path you chose. It defaults to:
```
/opt/git/quico.space/quico-os-setup/mkinitcpio-dropbear-pacman-hook/branches/main
```
# What's it do?
When either the hook or installation script of Arch Linux package `mkinitcpio-dropbear` changes these hooks apply patches to them.
The installation script `/usr/lib/initcpio/install/dropbear` gets two additional commands to create a `root` username and group in initrd; the hook script `/usr/lib/initcpio/hooks/dropbear` has its Dropbear settings changed to send SSH keepalive messages and to define a custom listening port.
Both actions happen as a `PostTransaction` in `pacman`.
# Assumptions
Per [headline](#mkinitcpio-dropbear-pacman-hook) these hooks is intended to work with [quico.space/quico-os-setup/arch-zbm](https://quico.space/quico-os-setup/arch-zbm). Before using them for any purpose other than an `arch-zbm` Arch Linux installation please closely review what they do and adapt to your use case as needed.
These hooks manipulate how SSH is done inside a ZFSBootMenu boot loader.
# Development
## Conventional commits
This project uses [Conventional Commits](https://www.conventionalcommits.org/) for its commit messages.
### Commit types
Commit _types_ besides `fix` and `feat` are:
- `build`: Project structure, directory layout, build instructions for roll-out
- `refactor`: Keeping functionality while streamlining or otherwise improving function flow
- `test`: Working on test coverage
- `docs`: Documentation for project or components
### Commit scopes
The following _scopes_ are known for this project. A Conventional Commits commit message may optionally use one of the following scopes or none:
- `patch`: Work related to patch files
- `hook`: Configuring the hook(s)
- `meta`: Affects the project's repo layout, readme content, file names etc.