servnest-mkosi/README.md

36 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2023-01-29 21:14:36 +01:00
# ServNest system images generator
2022-05-16 00:32:28 +02:00
2024-04-09 17:31:14 +02:00
This is the sources to build system images of ServNest using mkosi 22. You can then use them with systemd-nspawn.
2022-05-16 00:32:28 +02:00
2024-01-25 10:53:45 +01:00
This repository also contains configuration files and installation scripts inside `install` that may also be useful for the manual installation process, without mkosi.
2023-04-20 11:33:07 +02:00
2022-08-29 21:01:16 +02:00
## Usage
2024-04-09 17:31:14 +02:00
This generator allows to build images for both Arch Linux and Debian, you can replace `<sysid>` by either `sn-arch` or `sn-debian` in the following examples. Note that mkosi may require tools that are not available on your distribution.
2022-05-16 00:32:28 +02:00
2023-05-03 00:54:00 +02:00
First:
2024-01-30 20:24:22 +01:00
- Put the ServNest source code inside `mkosi.extra/srv/servnest/core/`
- Put a SFTPGo binary compiled as bundle in `mkosi.extra/usr/local/bin/sftpgo` (`mkosi.extra/root/sftpgo.sh` is provided for this purpose)
2024-01-25 10:53:45 +01:00
- Put your SSH public key in `mkosi.extra/root/.ssh/authorized_keys`
2023-05-03 00:54:00 +02:00
2024-01-25 10:53:45 +01:00
You can generate a new image in `/var/lib/machines/<sysid>` by running `mkosi --force --image <sysid> build` from this repository (`--force` erases an already existing image).
2022-05-16 00:32:28 +02:00
2024-01-25 10:53:45 +01:00
You need to copy `mkosi.nspawn` into `/etc/systemd/nspawn/<sysid>.nspawn` to allow the container to use network without restrictions.
2022-05-16 00:32:28 +02:00
You can then boot the container:
2023-05-03 00:54:00 +02:00
```shell
2024-01-25 10:53:45 +01:00
machinectl start <sysid>
machinectl shell <sysid>
2022-05-16 00:32:28 +02:00
```
The full explanation of the structure in this repository can be found on the mkosi manpage. Here is a summary of what mkosi will do in this repository:
1. Load configuration from `mkosi.default` and `mkosi.default.d/<sysid>/mkosi.default`
2023-04-20 11:33:07 +02:00
2. Install packages according to configuration
3. Copy this repository to the container root
4. Run `mkosi.postinst`, which runs specific scripts inside `install`, which do configuration (depending on the distribution)
2022-08-29 21:01:16 +02:00
## License
2023-01-29 21:14:36 +01:00
ServNest system images generator is ethical libre software: you can use, redistribute or modify it under the terms of the CNPL-NAv7+ as found in LICENSE.md or at <https://git.pixie.town/thufie/npl-builder>.