PureOS provides convenient pre-built images for use installing on computers, Virtual Machines, and containers. You can find those images here;
- Hybrid ISO image files suitable for VM and installation on hardware
- Container images along with additional reproducible container documentation.
It is also possible to build a PureOS image from scratch from the PureOS repos. Purism does this when we want to test the reproducibility of a PureOS image.
Reproducible ISOs Use this document to read more detail about how we check byte-for-byte reproducible images.
Build a PureOS image
- Prepare an appropriate environment.
If you're already running PureOS on your build machine, then you're all set. If you're running another GNU/Linux distribution it is likely best to set up a chroot or to use a tool like debspawn (discussed below.)
- Install live-build and other tools
$ apt install live-build git ca-certificates
- Clone via git our configuration for PureOS
$ cd /srv && git clone https://source.puri.sm/pureos/infra/make-live.git $ cd /srv/make-live
Currently we build a number of images; gnome-live, gnome-oem, plasma-live. Exporting the type of image you want into your environment is needed if you want to override the default;
$ export FLAVOR="gnome-oem"
If no FLAVOR variable is set, the GNOME Live Flavor will be built by default.
- Run lb config
- Run lb build
- Have fun with a fresh new PureOS image!
Building images with Debspawn
The above steps can be sped up a lot and be automated by using debspawn, which is used to create the official PureOS images in a controlled environment.
In order to use debspawn, just follow these steps:
- Run sudo apt install debspawn
- Then run debspawn create amber
- Create a new "build-pureos.sh" file with the following contents:
#!/bin/sh set -e set -x export FLAVOR="gnome-live" export DEBIAN_FRONTEND=noninteractive apt-get install -y git ca-certificates apt-get install -y live-build git clone --depth=2 https://source.puri.sm/pureos/infra/make-live.git /srv/build/lb cd /srv/build/lb/ lb config lb build b2sum *.iso *.contents *.zsync *.packages > checksums.b2sum sha256sum *.iso *.contents *.zsync *.packages > checksums.sha256sum mv *.iso /srv/artifacts mv -f *.zsync /srv/artifacts mv -f *.contents /srv/artifacts mv -f *.files /srv/artifacts mv -f *.packages /srv/artifacts mv -f *.b2sum /srv/artifacts mv -f *.sha256sum /srv/artifacts
- Make the .sh file executable and set the FLAVOR you want.
- Tell debspawn to run the build and where to place the build result:
debspawn run --external-command --artifacts-out=/where/to/put/the/built/image amber /path/to/build-pureos.sh
This should give you a replica of what our autobuilders did. You can also take a look at the actual code in Spark:
Should you get an error regarding the PureOS Keyring when building with debspawn;
I: Keyring file not available at /usr/share/keyrings/pureos-archive-keyring.gpg; switching to https mirror https://deb.debian.org/debian I: Retrieving InRelease I: Retrieving Release E: Failed getting release file https://deb.debian.org/debian/dists/green/Release
This is easily fixed if you're on a PureOS system. Simply install via apt the keyring;
$ apt install pureos-archive-keyring
Otherwise you can download and install the deb from here: https://repo.pureos.net/pureos/pool/main/p/pureos-archive-keyring/
Errors with debootstrap
If you receive this error;
E: No such script: /usr/share/debootstrap/scripts/green
it simply means that the 'green' script (for building PureOS Green) is not in your version of deboostrap. You can get it from here; https://source.puri.sm/snippets/73