From ac8b32880b6f85d847dbcecedaacd6bfcdf6fb23 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 22 Aug 2024 13:30:43 -0400 Subject: [PATCH] README: update with install / build instructions --- README.md | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 144 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9aef87e..13bc7fe 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,154 @@ Thus the following use cases are still not supported / tested: * `qubes-vm-kernel-support` Not adapted for use on Alpine yet, due to it providing a Dracut module. In most cases, it is not necessary as Qubes provides the kernel. This package is only neccessary when VM uses its own kernel, thus a hook is added to Dracut to generate the initrd for use within qubes. -#### Issues, recommendations and proposals +## How to install + +First, we need to transfer to dom0 the template key. + +**Within VM, download template key:** + +``` +curl -JO https://ayakael.net/api/packages/forge/rpm/repository.key +``` + +**On dom0, transfer and copy key to key store:** + +``` +qvm-run -p 'cat repository.key +sudo mv repository.key /etc/qubes/repo-templates/keys/RPM-GPG-KEY-ayakael-forge +``` + +For installation, you have two options. + +### Using qvm-template + +**1) Create repository definition** + +On dom0, create and edit `/etc/qubes/repo-templates/ayakael-forge-r42.repo` to match the following + +``` +[ayakael-forge-qubes-r42] +name=forge - Ayakael - qubes - r42 +baseurl=https://ayakael.net/api/packages/forge/rpm/qubes/r42 +enabled=1 +gpgcheck=1 +gpgkey = file:////etc/qubes/repo-templates/keys/RPM-GPG-KEY-ayakael-forge +``` + +**2) Install template** + +``` +qvm-template install alpine320 +``` + +### Manually + +**1) Download and transfer template RPM** + + +On VM, download desired template RPM available in `Packages` section +``` +curl -JO https: +``` + +On dom0, transfer RPM + +``` +qvm-run -p 'cat qubes-template-alpine.rpm +``` + +**2) Install template** + +``` +qvm-template --keyring /etc/qubes/repo-templates/keys/RPM-GPG-KEY-forge-ayakael install $(pwd)/qubes-template-alpine.rpm +``` + +## How to build + +Since this template builder uses pre-built Alpine Linux packages for QubesOS template support, it by defaults does not build everything locally. If you want to build them locally, you can follow these steps. If not, you can skip to the next section. + +### Build packages + +**1) Set-up build environment on Alpine Linux** +``` +apk add alpine-sdk lua-aports +addgroup abuild +mkdir -p /var/cache/distfiles +chmod a+w /var/cache/distfiles +abuild-keygen -a -i +cp /home/user/.abuild/*.pub /etc/apk/keys +``` +(see [Creating an Alpine package](https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package) on Alpine Linux Wiki for more details) + +**2) Create work directory and clone `qports` with appropriate branch** + +``` +mkdir work +cd work +git clone https://ayakael.net/forge/qports -b +``` + +**3) Build all packages using `buildrepo`** + +`buildrepo -a -d /packages qports` + +**4) Make these packages available on an HTTP server and export the following variables that will be picked up by template build** + +``` +export QUBESALPINE_MIRROR= +export QUBESALPINE_KEYFILE= +``` + +### Build template + +**1) Create work directory and clone `qubes-builder-alpine` with appropriate branch** + +``` +mkdir work +cd work +git clone https://ayakael.net/forge/qubes-builder-alpine -b +``` + +**2) Set-up build environment for QubesOS template build** + +``` +git clone https://github.com/QubesOS/qubes-builder +mkdir qubes-builder/qubes-src +ln -s $(pwd) qubes-builder/qubes-src/builder-alpine +cp builder.conf qubes-builder/. +git clone https://github.com/QubesOS/qubes-linux-template-builder qubes-builder/qubes-src/linux-template-builder +``` + +**3) Setup build information** + +``` +echo "%define _arch x86_64" >> qubes-builder/qubes-src/linux-template-builder/templates.spec +echo "4.2.0" > qubes-builder/qubes-src/linux-template-builder/version +``` +If you want to build a different Alpine version than default, you can modify `qubes-builder/builder.conf` on line `DIST_VM` to alpine (i.e alpine320). + +**4) Build template** + +``` +cd qubes-builder +make linux-template-builder +``` + +**5) Install produced RPM on dom0** + +``` +qvm-run --pass-io 'cat /qubes-builder/qubes-src/linux-template-builder/rpm/noarch/qubes-template-*.rpm' > qubes-template-alpine.rpm +qvm-template install --nogpgcheck $(pwd)/qubes-template-alpine.rpm +``` + +## Issues, recommendations and proposals **To report an issue or share a recommendation** -Go [here](https://gitlab.alpinelinux.org/ayakael/qubes-builder-alpine/-/issues) +This repo is also mirrored on Codeberg. This facilitates receiving pull requests, and managing issues. You can open an issue [here](https://codeberg.org/ayakael/qubes-builder-alpine/issues) **To make a merge request** - * Fork the repo from Alpine's GitLab [here](https://gitlab.alpinelinux.org/ayakael/qubes-builder-alpine) + * Fork the repo from Codeberg's mirror [here](https://codeberg.org/ayakael/qubes-builder-alpine) * Clone your fork locally. (`git clone $repo`) * Make a branch with a descriptive name (`git checkout -b $descriptivename`) * Make the changes you want to see in the world, commit, and push to the GitLab's remote repo - * Request a merge [here](https://gitlab.alpinelinux.org/ayakael/qubes-builder-alpine/-/merge_requests) + * Request a merge [here](https://codeberg.org/ayakael/qubes-builder-alpine/pulls)