[PureOS] Building my own PureOS ISO image?

Matthias Klumpp matthias.klumpp at puri.sm
Wed Mar 6 13:04:37 PST 2019


Am Mi., 6. März 2019 um 19:56 Uhr schrieb Chris Lamb <chris.lamb at puri.sm>:
>
> Hi pureos-project,
>
> I'm trying to build a PureOS ISO image on my own system but can't seem
> to locate a script/repo/documentation, etc. I'm probably just missing
> something obvious. To clarify, I'm trying to build an ISO like:
>
>   https://www.pureos.net/download/
>
> ... rather than the OEM image. I'm guess Matthias is the person to
> specifically ask here? (Ping?)
>
> Just to underline it really doesn't matter how ugly/manual the process
> is or that it could potentially be improved — everything always can be
> and I won't "judge" anyone on the status quo, especially for non-daily
> processes; I'd just like to build one myself.

That should be pretty easy. The basic process is the following (see
below for replicating almost 100% of what our builders do):

1) Create a PureOS green chroot (just debootstrap green and chroot into PureOS)
1.1) /!\ All following steps happen inside of the PureOS chroot
2) Run `apt install live-build git ca-certificates`
3) cd /srv && git clone https://source.puri.sm/pureos/infra/make-live.git
4) cd /srv/make-live
5) Set the FLAVOR environment variable to what flavor of PureOS you
want to build. Possible values are:
    * gnome-live
    * gnome-oem
    * plasma-live
   E.g. `export FLAVOR="gnome-oem"`.
   If no FLAVOR variable is set, the GNOME Live Flavor will be built by default
6) Run `lb config`
7) Run `lb build`
8) Have fun with a fresh new PureOS image!

These 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:
1) Run `sudo apt install debspawn`
2) Then run `debspawn create green`
3) 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
```
4) Make the .sh file executable and set the FLAVOR you want.
5) 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 green
/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:
https://github.com/lkorigin/laniakea-spark/blob/master/spark/runners/image_build.py#L30

I hope this helps :-)
I was also really sure that I had written this down somewhere already
(although not in this much detail), but when looking at our Wiki I
couldn't find it.

Cheers,
    Matthias


More information about the Pureos-project mailing list