Skip to content

Commit

Permalink
Add Live ISO sources to Git (#1160)
Browse files Browse the repository at this point in the history
## Problem

The Live ISO sources are not maintained at GitHub, that makes the
development complicated:

- Cannot track the changes easily, working with history in OBS is
limited and more complicated than with Git
- Changing files in tarballs is difficult, you have to unpack it, modify
a file and then manually compress back with correct parameters
- Building the Live ISO locally is not trivial

## Solution

- Move the sources into the `/live` subdirectory
- Add GitHub action for automatic submission from `master` to the
[systemsmanagement:Agama:Staging](https://build.opensuse.org/project/show/systemsmanagement:Agama:Staging)
OBS project
- Allow running the ISO build locally via `make build`

## Changes

The individual files were not touched, I just copied them from the
current OBS project. I only moved the `fw_cleanup.rb` script to the
`/tmp` directory as the script is temporary and it is deleted at the end
of the ISO build.

- All Kiwi tarballs were unpacked to Git
- Simple `make` builds the sources to the `dist` subdirectory and builds
the tarballs
- The ISO can be built locally using `make build`
- Updated/extended the documentation in README.md (There are two
README.md files, the main in `/live` which documents the details and the
`/live/src/README.md` which is copied to OBS. Mostl importantly it says
"do not touch this in OBS, use GitHub".)

## Testing

- Tested manually
- The autosubmission works (see the [GitHub action
log](https://github.com/lslezak/agama/actions/runs/8780447151/job/24090382501))
- The built ISO works (tested in my [agama-live
branch](https://build.opensuse.org/package/show/home:lslezak:branches:systemsmanagement:Agama:Staging/agama-live)
project)
- Local build works as well

---------

Co-authored-by: Imobach González Sosa <igonzalezsosa@suse.com>
  • Loading branch information
lslezak and imobachgs authored Apr 23, 2024
1 parent d6445ca commit d4f44b8
Show file tree
Hide file tree
Showing 39 changed files with 1,719 additions and 38 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/obs-staging-live.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Submit agama-live

on:
# runs on pushes targeting the default branch
push:
branches:
- master
paths:
# run only when a live ISO source is changed
- live/**

jobs:
update_staging_package:
# do not run in forks
if: github.repository_owner == 'openSUSE'

runs-on: ubuntu-latest

container:
image: registry.opensuse.org/opensuse/tumbleweed:latest

steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Configure and refresh repositories
# disable unused repositories to have a faster refresh
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref

- name: Install tools
run: zypper --non-interactive install --no-recommends
make osc

- name: Configure osc
run: .github/workflows/configure_osc.sh
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }}

- name: Checkout agama-live
run: osc co -o dist systemsmanagement:Agama:Staging agama-live
working-directory: ./live

- name: Build sources
run: make clean && make
working-directory: ./live

- name: Update OBS files
run: osc addremove
working-directory: ./live/dist

- name: Check status
run: osc diff && osc status
working-directory: ./live/dist

- name: Commit agama-live
run: osc commit -m "Updated to Agama $GITHUB_SHA"
working-directory: ./live/dist
35 changes: 0 additions & 35 deletions IMAGE.md

This file was deleted.

7 changes: 4 additions & 3 deletions PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ respect such a tag. (e.g. `2.1+42`).

### The Live ISO

The ISO is built and developed in [systemsmanagement:Agama:Staging/agama-live](
https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama-live).
See [IMAGE.md](./IMAGE.md) for more details.
The ISO is built in the [systemsmanagement:Agama:Staging/agama-live](
https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama-live)
OBS project. The sources are maintained in the [live](live) subdirectory. See
[live/README.md](live/README.md) for more details.
5 changes: 5 additions & 0 deletions doc/live_iso.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Agama installer is deployed as a regular application which can be installed and run on a local system. However, the most expected way of using Agama is by running it on a live ISO image.

## Sources

The Live ISO sources are maintained in the [live](../live/) subdirectory,
See more details in a [live/README.md](../live/README.md) documentation.

## Live ISO Requirements

A live ISO for running Agama should provide the following software:
Expand Down
1 change: 1 addition & 0 deletions live/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
43 changes: 43 additions & 0 deletions live/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Makefile for building the Live ISO sources for OBS, see README.md for more
# details.

# directory with the sources
SRCDIR = ./src

# the target directory
DESTDIR = ./dist

# the default build flavor, see the src/_multibuild file,
# to build a different flavor run "make build FLAVOR=<flavor>"
FLAVOR = openSUSE

# files to copy from src/
COPY_FILES = $(patsubst $(SRCDIR)/%,$(DESTDIR)/%,$(wildcard $(SRCDIR)/*))

all: $(DESTDIR) $(COPY_FILES) $(DESTDIR)/config-cdroot.tar.xz $(DESTDIR)/root.tar.xz $(DESTDIR)/root-ALP-PXE.tar.xz

# clean the destination directory (but keep the .osc directory if it is present)
clean:
rm -rf $(DESTDIR)/*

$(DESTDIR):
mkdir -p $@

# copy the files from src/ to dist/
$(DESTDIR)/%: $(SRCDIR)/%
cp -f $< $@

# make a tarball from a directory
# the tarball is reproducible, i.e. the same sources should result in the very
# same tarball (bitwise) for the file time stamps use the date of the last
# commit in the respective directory, use the UTC date to avoid possible time
# zone and DST differences
$(DESTDIR)/%.tar.xz: %
MTIME=$$(date --date="$$(git log -n 1 --pretty=format:%ci $<)" --utc +"%Y-%m-%d %H:%M:%S"); \
(cd $< && find . -xtype f -not -name README.md | LC_ALL=C sort | tar -c -v -f - --format=gnu --owner=0 --group=0 --files-from - --mtime="$$MTIME") | xz -c -9 -e > $@

# build the ISO locally
build: $(DESTDIR)
if [ ! -e $(DESTDIR)/.osc ]; then make clean; osc co -o $(DESTDIR) systemsmanagement:Agama:Staging agama-live; fi
$(MAKE) all
(cd $(DESTDIR) && osc build -M $(FLAVOR) images)
46 changes: 46 additions & 0 deletions live/PXE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Agama Network Installation (PXE)

## Prerequisites

The PXE boot infrastructure should already exist:

- TFTP/DHCP running (usually dnsmasq)
- FTP server running (usually vsftp)

## Setup

Extract the Linux kernel and the initrd from the archive:

```shell
osc getbinaries images x86_64 -M ALP-PXE
tar -C /srv/ftp/image -xf \
binaries/agama-live.x86_64-5.0.0-ALP-PXE-Build4.1.install.tar

cp /srv/ftp/image/pxeboot.agama-live.x86_64-5.0.0.initrd /srv/tftpboot/boot
cp /srv/ftp/image/pxeboot.agama-live.x86_64-5.0.0.kernel /srv/tftpboot/boot
```

Update the PXE boot configuration in the `/srv/tftpboot/pxelinux.cfg/default`
file:

```
default menu.c32
prompt 0
timeout 120
menu title PXE Menu
label live
menu label ^Agama
kernel /boot/pxeboot.agama-live.x86_64-5.0.0.kernel
append initrd=/boot/pxeboot.agama-live.x86_64-5.0.0.initrd rd.kiwi.install.pxe rd.kiwi.install.image=ftp://X.X.X.X/image/agama-live.x86_64-5.0.0.xz console=ttyS0,115200 rd.kiwi.ramdisk ramdisk_size=2097152
```

## Testing

To test booting Agama in QEMU run these commands:

```shell
qemu-img create mydisk 20g
qemu -boot n -m 4096 -hda mydisk
```
Loading

0 comments on commit d4f44b8

Please sign in to comment.