From d4f44b8a8eb17e1a67e052a348a99c19f6119ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Tue, 23 Apr 2024 10:03:43 +0200 Subject: [PATCH] Add Live ISO sources to Git (#1160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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 --- .github/workflows/obs-staging-live.yml | 58 +++++ IMAGE.md | 35 --- PACKAGING.md | 7 +- doc/live_iso.md | 5 + live/.gitignore | 1 + live/Makefile | 43 ++++ live/PXE.md | 46 ++++ live/README.md | 240 ++++++++++++++++++ live/config-cdroot/.signature | Bin 0 -> 2048 bytes live/config-cdroot/fix_bootconfig.ppc64le | 122 +++++++++ live/config-cdroot/fix_bootconfig.s390x | 171 +++++++++++++ .../etc/dracut.conf.d/90-brd.conf | 1 + live/root/etc/avahi/services/agama.service | 11 + live/root/etc/cockpit/cockpit.conf | 6 + .../root/etc/modules-load.d/10-multipath.conf | 1 + live/root/etc/multipath.conf | 3 + .../etc/ssh/sshd_config.d/10_root_login.conf | 1 + .../etc/systemd/system/agama-auto.service | 19 ++ .../etc/systemd/system/agama-hostname.service | 17 ++ .../system/cockpit.socket.d/listen.conf | 8 + .../etc/systemd/system/x11-autologin.service | 24 ++ live/root/root/.icewm/startup | 3 + .../root/.mozilla/firefox/profile/user.js | 6 + live/root/root/.xinitrc | 1 + live/root/tmp/README.md | 5 + live/root/tmp/fw_cleanup.rb | 43 ++++ live/root/usr/bin/auto.sh | 42 +++ .../98dracut-menu/dracut-cmdline-menu.service | 32 +++ .../98dracut-menu/dracut-cmdline-menu.sh | 145 +++++++++++ .../modules.d/98dracut-menu/module-setup.sh | 27 ++ .../modules.d/98dracut-menu/save-cmdline.sh | 13 + live/src/README.md | 35 +++ live/src/_constraints | 7 + live/src/_multibuild | 7 + live/src/agama-live.changes | 142 +++++++++++ live/src/agama-live.kiwi | 188 ++++++++++++++ live/src/config.sh | 134 ++++++++++ live/src/fix_bootconfig | 89 +++++++ live/src/images.sh | 19 ++ 39 files changed, 1719 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/obs-staging-live.yml delete mode 100644 IMAGE.md create mode 100644 live/.gitignore create mode 100644 live/Makefile create mode 100644 live/PXE.md create mode 100644 live/README.md create mode 100644 live/config-cdroot/.signature create mode 100755 live/config-cdroot/fix_bootconfig.ppc64le create mode 100755 live/config-cdroot/fix_bootconfig.s390x create mode 100644 live/root-ALP-PXE/etc/dracut.conf.d/90-brd.conf create mode 100644 live/root/etc/avahi/services/agama.service create mode 100644 live/root/etc/cockpit/cockpit.conf create mode 100644 live/root/etc/modules-load.d/10-multipath.conf create mode 100644 live/root/etc/multipath.conf create mode 100644 live/root/etc/ssh/sshd_config.d/10_root_login.conf create mode 100644 live/root/etc/systemd/system/agama-auto.service create mode 100644 live/root/etc/systemd/system/agama-hostname.service create mode 100644 live/root/etc/systemd/system/cockpit.socket.d/listen.conf create mode 100644 live/root/etc/systemd/system/x11-autologin.service create mode 100755 live/root/root/.icewm/startup create mode 100644 live/root/root/.mozilla/firefox/profile/user.js create mode 100644 live/root/root/.xinitrc create mode 100644 live/root/tmp/README.md create mode 100755 live/root/tmp/fw_cleanup.rb create mode 100755 live/root/usr/bin/auto.sh create mode 100644 live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.service create mode 100755 live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.sh create mode 100755 live/root/usr/lib/dracut/modules.d/98dracut-menu/module-setup.sh create mode 100644 live/root/usr/lib/dracut/modules.d/98dracut-menu/save-cmdline.sh create mode 100644 live/src/README.md create mode 100644 live/src/_constraints create mode 100644 live/src/_multibuild create mode 100644 live/src/agama-live.changes create mode 100644 live/src/agama-live.kiwi create mode 100644 live/src/config.sh create mode 100644 live/src/fix_bootconfig create mode 100644 live/src/images.sh diff --git a/.github/workflows/obs-staging-live.yml b/.github/workflows/obs-staging-live.yml new file mode 100644 index 0000000000..1005bf59e3 --- /dev/null +++ b/.github/workflows/obs-staging-live.yml @@ -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 diff --git a/IMAGE.md b/IMAGE.md deleted file mode 100644 index 7a624fa6bf..0000000000 --- a/IMAGE.md +++ /dev/null @@ -1,35 +0,0 @@ -# Live ISO - -## Contents - -This directory contains a set of files that are used to build the Live ISO image. - -* The `_service` file defines the OBS services to fetch the required files from the Git repository. -* The `_constraints` file tells OBS to build the image on the hosts with enough resources. -* `agama-live.kiwi` (and `config.sh`) are used by [kiwi](https://github.com/OSInside/kiwi/) to - build the image. -* The `extrastuff` directory contains a set of configuration files that are placed in the ISO but - not taken from any RPM package. - -## Configuration files - -* SSH connectivity: `/etc/ssh/sshd_config.d/10_root_login.conf` allows root login -* Autologin and gfx startup: - - `/etc/systemd/system/x11-autologin.service` uses startx to start an x11 session. - - startx runs icewm via `/root/.xinitrc`. - - icewm autostarts Firefox via `/root/.icewm/startup`. - - icewm uses usual YaST2 installation config from `/etc/icewm/preferences.yast2`. -* Firefox profile is defined in `/root/.mozilla/firefox/profile`. - -## OBS services - -The idea is to keep OBS sources and the Git repository in sync. So when any change is needed, it is -expected to open a pull request and rely on OBS services to sync them once they are merged. - -``` -osc service manualrun -osc commit -m "Describe the changes..." -``` - -If you need to try your changes in a temporary branch, you can adjust the `_service` file to point -to such a branch. diff --git a/PACKAGING.md b/PACKAGING.md index 08fb248b25..8926321638 100644 --- a/PACKAGING.md +++ b/PACKAGING.md @@ -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. diff --git a/doc/live_iso.md b/doc/live_iso.md index ce155ab111..1866ce8c0d 100644 --- a/doc/live_iso.md +++ b/doc/live_iso.md @@ -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: diff --git a/live/.gitignore b/live/.gitignore new file mode 100644 index 0000000000..849ddff3b7 --- /dev/null +++ b/live/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/live/Makefile b/live/Makefile new file mode 100644 index 0000000000..598cde6388 --- /dev/null +++ b/live/Makefile @@ -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 = 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) diff --git a/live/PXE.md b/live/PXE.md new file mode 100644 index 0000000000..f5e793d3bb --- /dev/null +++ b/live/PXE.md @@ -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 +``` diff --git a/live/README.md b/live/README.md new file mode 100644 index 0000000000..2afe492e50 --- /dev/null +++ b/live/README.md @@ -0,0 +1,240 @@ +# Live ISO + + +## Table of Content + +- [Live ISO](#live-iso) + - [Layout](#layout) + - [Building the Sources](#building-the-sources) + - [Building the ISO Image](#building-the-iso-image) + - [Build Options](#build-options) + - [Image Definition](#image-definition) + - [KIWI Files](#kiwi-files) + - [Image Configuration](#image-configuration) + - [SSH Server](#ssh-server) + - [Autologin](#autologin) + - [Firefox Profile](#firefox-profile) + - [Dracut menu](#dracut-menu) + - [Avahi/mDNS](#avahimdns) + - [The Default Hostname](#the-default-hostname) + - [Service Advertisement](#service-advertisement) + - [The Default Cockpit/Agama TCP Port](#the-default-cockpitagama-tcp-port) + - [Autoinstallation Support](#autoinstallation-support) + - [Firmware Cleanup](#firmware-cleanup) + +--- + +## Layout + +This directory contains a set of files that are used to build the Agama Live ISO +image. + +- [src](src) subdirectory contains all source files which are copied unmodified + to the OBS project +- [root](root) subdirectory contains files which are added to the Live ISO root + system (inside the squashfs image) +- [root-ALP-PXE](root-ALP-PXE) subdirectory contains specific files for the ALP + image used for the PXE boot, see a separate [PXE documentation](PXE.md) for + more details about the PXE boot +- [config-cdroot](config-cdroot) subdirectory contains file which are copied to + the uncompressed root of the ISO image, the files can be accessed just by + mounting the ISO file or the DVD medium + +## Building the Sources + +To build the sources for OBS just run the + +```shell +make +``` + +command. This will save the built source files into the `dist` subdirectory. + +To start from scratch run + +```shell +make clean +``` + +or just simply delete the `dist` subdirectory. + +## Building the ISO Image + +To build the ISO locally run the + +```shell +make build +``` + +command. The built ISO image is saved to the `/var/tmp/build-root` directory, +see the end of the build for output for the exact ISO file name. + +For building an ISO image you need a lot of free space at the `/var` partition. +Make sure there is at least 25GiB free space otherwise the build will +fail. + +### Build Options + +By default this will build the openSUSE image. If you want to build +another image then run + +```shell +make build FLAVOR= +# for building the ALP flavor: +make build FLAVOR=ALP +``` + +See the [_multibuild](src/_multibuild) file for the list of available build +flavors. + +By default it will use the [systemsmanagement:Agama:Staging]( +https://build.opensuse.org/project/show/systemsmanagement:Agama:Staging) OBS +project. If you want to build using another project, like your fork, then delete +the `dist` directory and checkout the OBS project manually and run the build: + +```shell +rm -rf dist +# replace with your OBS account name +osc co -o dist home::branches:systemsmanagement:Agama:Staging agama-live +make build +``` + +## Image Definition + +The [KIWI](https://github.com/OSInside/kiwi) image builder is used by OBS to +build the Live ISO. See the [KIWI documentation]( +https://osinside.github.io/kiwi/index.html) for more details about the build +workflow and the `.kiwi` file format. + +### KIWI Files + +The main Kiwi source files are located in the [src](src) subdirectory: + +- [agama-live.kiwi](src/agama-live.kiwi) is the main KIWI file which drives the + ISO image build. +- [config.sh](src/config.sh) is a KIWI hook script which is called and the end + of the build process, after all packages are installed but before compressing + and building the image. The script runs in the image chroot and is usually + used to adjust the system configuration (enable/disable services, patching + configuration files or deleting not needed files). +- [_constraints](src/_constraints) file tells OBS to build the image on the + hosts with enough resources (enough free disk space). +- [_multibuild](src/_multibuild) defines the image flavors (KIWI profiles) + which are available to build +- [images.sh](src/images.sh) - injects a script which checks whether the machine + has enough RAM when booting the Live ISO +- [fix_bootconfig](src/fix_bootconfig) - a special KIWI hook script which sets + the boot configuration on S390 and PPC64 architectures. + +## Image Configuration + +The Live ISO is configured to allow using some features and allow running Agama +there. + +### SSH Server + +The SSH connection for the root user is enabled in the [10_root_login.conf]( +root/etc/ssh/sshd_config.d/10_root_login.conf) file. + +### Autologin + +Automatic root login and staring the graphical environment is configured in +several files. + +- [x11-autologin.service](src/etc/systemd/system/x11-autologin.service) uses + `startx` to start an x11 session. +- `startx` runs the Icewm window manager via [.xinitrc](root/root/.xinitrc) + file. +- Icewm autostarts Firefox via [startup](root/root/.icewm/startup) file. +- Icewm uses the usual YaST2 installation + [preferences.yast2](root/etc/icewm/preferences.yast2) configuration file + +### Firefox Profile + +The default Firefox configuration is defined in the +[profile](root/root/.mozilla/firefox/profile) file. It disables several features +which do not make sense in Live ISO like remembering the used passwords. + +### Dracut menu + +The [98dracut-menu](live/root/usr/lib/dracut/modules.d/98dracut-menu) directory +implements a simple menu system for dracut. To activate it +during boot add `rd.cmdline=menu` to the boot prompt. This is similar to +`rd.cmdline=ask` which gives you a simple one-line prompt to add boot options. + +The dracut-cmdline-menu can currently set the `root` and `proxy` options. The +settings are copied (using a dracut pre-pivot hook) to the live system in +[cmdline-menu.conf](root/etc/cmdline-menu.conf). + +There is also the complete command line in the +[cmdline-full.conf](root/etc/cmdline-full.conf) file - maybe it can useful at +least for debugging. + +For more details see [dracut.bootup(7)]( +https://man.archlinux.org/man/dracut.bootup.7.en), +[dracut-pre-pivot.service(8)]( +https://man.archlinux.org/man/extra/dracut/dracut-pre-pivot.service.8.en). + +To arrange the dracut config in KIWI you have to adjust the default dracut +config of the live system. This is done in [config.sh](src/config.sh). You can +also fill in a default network location if one is defined for a product +(currently not). + +### Avahi/mDNS + +The mDNS service allows resolving host names in the local network without +a DNS server. That is implemented by the `avahi-daemon` service which enabled +in the [config.sh](src/config.sh) file and installed in the `avahi` RPM package. + +The mDNS protocol resolves the hosts in the `.local` domain. + +#### The Default Hostname + +By default the Agama live ISO sets the `agama` host name which can be used +as `agama.local` full hostname in URL. + +The default hostname is set by the +[agama-hostname](root/etc/systemd/system/agama-hostname.service) service. + +If the hostname is set via the `hostname=` boot parameter then the `agama` +host name is not used, the boot option takes precedence. + +#### Service Advertisement + +The Avahi HTTPS service announcement is configured via the Avahi +[agama.service](root/etc/avahi/services/agama.service) file + +That allows scanning all running Agama instances in the local network with +command: + +```shell +avahi-browse -t -r _agama._sub._https._tcp +``` + +### The Default Cockpit/Agama TCP Port + +The default Cockpit TCP port is 9090. That makes sense for the system management +framework as the default ports might be used by a running Apache or other web +servers. + +But Agama runs from a Live ISO where running a web server does not make much +sense so we can safely use the default HTTP(S) ports. + +The default port is changed in the +[listen.conf](root/etc/systemd/system/cockpit.socket.d/listen.conf) file. + +### Autoinstallation Support + +The autoinstallation is started using the +[agama-auto](root/etc/systemd/system/agama-auto.service) service which starts +the [auto.sh](root/usr/bin/auto.sh) script. This script downloads the +installation profile, applies it to Agama and starts the installation. + +### Firmware Cleanup + +The [fw_cleanup.rb](root/tmp/fw_cleanup.rb) script removes the unused firmware +from the image. Many firmware files are not needed, this makes the final ISO +much smaller. + +This script is started from [config.sh](src/config.sh) the script and after +running it the script deleted. (Not needed anymore in the system.) diff --git a/live/config-cdroot/.signature b/live/config-cdroot/.signature new file mode 100644 index 0000000000000000000000000000000000000000..6c4fa44cc5419e864c174cbaa2bc5f355da16f64 GIT binary patch literal 2048 zcmeIu2@L=s3$dst/boot/grub2/grub.cfg <$dst/ppc/bootinfo.txt < +Agama Live +openSuSE Tumbleweed +boot &device;:1,\boot\grub2\grub.elf + +XXX diff --git a/live/config-cdroot/fix_bootconfig.s390x b/live/config-cdroot/fix_bootconfig.s390x new file mode 100755 index 0000000000..36c0a26e10 --- /dev/null +++ b/live/config-cdroot/fix_bootconfig.s390x @@ -0,0 +1,171 @@ +#! /bin/bash + +# This script takes an unpacked s390x Live iso image in the form KIWI-NG currently creates. +# +# It modifies the tree to match s390x expectations. +# +# Usage: +# +# fix_bootconfig.s390x DST_DIR +# +# iso layout before: +# . +# ├── LiveOS +# │   └── squashfs.img +# └── boot +# └── s390x +# └── loader +# ├── initrd +# ├── isolinux.cfg +# ├── isolinux.msg +# └── linux +# +# +# iso layout adjusted: +# . +# ├── LiveOS +# │   └── squashfs.img +# ├── boot +# │   └── s390x +# │   ├── cd.ikr +# │   ├── initrd +# │   ├── initrd.off +# │   ├── initrd.siz +# │   ├── linux +# │   ├── parmfile +# │   ├── parmfile.hmc +# │   ├── sles.exec +# │   └── suse.ins +# ├── suse.ins +# └── susehmc.ins +# + +dst="$1" + +if [ ! -d "$dst" ] ; then + echo "fix_bootconfig.s390x: image dir \"$dst\" not found" + exit 1 +fi + +# ---------------- + +# Note: +# +# KIWI-NG creates an iso with isolinux boot files in boot/s390x/loader. +# +# These files are not needed except for kernel and initrd (and kernel params from isolinux.cfg). +# +# This script removes the isolinux config and adds s390x related config +# files. It also moves kernel and initrd to the usual location (in boot/s390x). +# + +boot_dir=$dst/boot/s390x + +# if files are in a 'loader' subdir, move them out +if [ -d $boot_dir/loader ] ; then + mv $boot_dir/loader/{initrd,linux} $boot_dir + rm -r $boot_dir/loader +fi + +# Create parmfile. +# +# These parameters are taken from a sampel isolinux.cfg; the required parameters will +# possibly change according to the KIWI config. +# +parmfile_content= +echo "$parmfile_content" >$boot_dir/parmfile + +# Note on parmfile: +# +# Possibly s390 expects parmfile to have a maximal line length of 80 chars - but you can have several lines. +# +# In contrast the parmfile blob embedded in cd.ikr should have no line breaks but can be longer than 80 chars. +# + +# Create suse.ins & cd.ikr. +# +# cd.ikr is an image file combining kernel and initrd; suse.ins describes its layout. +# +# cd.ikr is used as boot image in El-torito style cd booting. +# + +# Offsets used for cd.ikr. +initrd_ofs_ofs=0x0001040c +initrd_siz_ofs=0x00010414 +initrd_ofs=0x01000000 +parmfile_ofs=0x00010480 + +# Create initrd.off (note: 32 bit, stored in big endian). +printf "%08x" $((initrd_ofs)) | xxd -r -p - $boot_dir/initrd.off + +# Create initrd.siz (note: 32 bit, stored in big endian). +read initrd_size x < <(du -b $boot_dir/initrd) +printf "%08x" $((initrd_size)) | xxd -r -p - $boot_dir/initrd.siz + +# Create suse.ins. +cat >$boot_dir/suse.ins <$dst/suse.ins <$dst/susehmc.ins <$boot_dir/parmfile.hmc + +# Some rexx script to ipl something... +cat >$boot_dir/sles.exec < + + + + Agama Installer (https://%h.local) + + _https._tcp + _agama._sub._https._tcp + 433 + + diff --git a/live/root/etc/cockpit/cockpit.conf b/live/root/etc/cockpit/cockpit.conf new file mode 100644 index 0000000000..741cc4b362 --- /dev/null +++ b/live/root/etc/cockpit/cockpit.conf @@ -0,0 +1,6 @@ +[WebService] +LoginTitle = Agama Installer +Shell = /agama/index.html + +[Session] +IdleTimeout = 0 diff --git a/live/root/etc/modules-load.d/10-multipath.conf b/live/root/etc/modules-load.d/10-multipath.conf new file mode 100644 index 0000000000..78b1202ab8 --- /dev/null +++ b/live/root/etc/modules-load.d/10-multipath.conf @@ -0,0 +1 @@ +dm_multipath diff --git a/live/root/etc/multipath.conf b/live/root/etc/multipath.conf new file mode 100644 index 0000000000..34d389ac33 --- /dev/null +++ b/live/root/etc/multipath.conf @@ -0,0 +1,3 @@ +defaults { + find_multipaths smart +} diff --git a/live/root/etc/ssh/sshd_config.d/10_root_login.conf b/live/root/etc/ssh/sshd_config.d/10_root_login.conf new file mode 100644 index 0000000000..1073982f77 --- /dev/null +++ b/live/root/etc/ssh/sshd_config.d/10_root_login.conf @@ -0,0 +1 @@ +PermitRootLogin yes diff --git a/live/root/etc/systemd/system/agama-auto.service b/live/root/etc/systemd/system/agama-auto.service new file mode 100644 index 0000000000..08be3630ee --- /dev/null +++ b/live/root/etc/systemd/system/agama-auto.service @@ -0,0 +1,19 @@ +[Unit] +Description=Agama automatic profile runner +# it needs to D-Bus, so it has access to Agama D-Bus interface +After=dbus.socket +# it needs to NetworkManager, so it has access to it +After=NetworkManager.service +# it needs dinstaller, of course +After=agama.service +Requires=agama.service + +[Service] +ExecStart=/usr/bin/auto.sh +# it has to be simple and not one shot as install can take time and we need to +# display web ui +Type=simple +User=root + +[Install] +WantedBy=default.target diff --git a/live/root/etc/systemd/system/agama-hostname.service b/live/root/etc/systemd/system/agama-hostname.service new file mode 100644 index 0000000000..9f2a549611 --- /dev/null +++ b/live/root/etc/systemd/system/agama-hostname.service @@ -0,0 +1,17 @@ +[Unit] +Description=Set Agama hostname +# after running the default hostname systemd service +After=systemd-hostnamed.target +# but before starting the mDNS server +Before=avahi-daemon.service +# run only if the hostname has the default value, if it has been changed +# by the hernel command line or systemd then keep it +ConditionHost=localhost + +[Service] +ExecStart=hostnamectl hostname agama +Type=oneshot +User=root + +[Install] +WantedBy=default.target diff --git a/live/root/etc/systemd/system/cockpit.socket.d/listen.conf b/live/root/etc/systemd/system/cockpit.socket.d/listen.conf new file mode 100644 index 0000000000..74514d041a --- /dev/null +++ b/live/root/etc/systemd/system/cockpit.socket.d/listen.conf @@ -0,0 +1,8 @@ +# see https://cockpit-project.org/guide/latest/listen +[Socket] +# the empty line disables the default port 9090 from the original unit +ListenStream= +# the standard HTTP port (Cockpit automatically redirects all HTTP traffic to HTTPS) +ListenStream=80 +# the standard HTTPS port +ListenStream=443 diff --git a/live/root/etc/systemd/system/x11-autologin.service b/live/root/etc/systemd/system/x11-autologin.service new file mode 100644 index 0000000000..2927547e6e --- /dev/null +++ b/live/root/etc/systemd/system/x11-autologin.service @@ -0,0 +1,24 @@ +[Unit] +Description=X11 session +After=graphical.target systemd-user-sessions.service + +[Service] +User=root +WorkingDirectory=~ + +PAMName=login +Environment=XDG_SESSION_TYPE=x11 +TTYPath=/dev/tty7 +StandardInput=tty +UnsetEnvironment=TERM + +UtmpIdentifier=tty7 +UtmpMode=user + +StandardOutput=journal +ExecStartPre=/usr/bin/chvt 7 +ExecStart=/usr/bin/startx -- vt7 -keeptty -verbose 3 -logfile /dev/null +Restart=no + +[Install] +WantedBy=graphical.target diff --git a/live/root/root/.icewm/startup b/live/root/root/.icewm/startup new file mode 100755 index 0000000000..209d5242e2 --- /dev/null +++ b/live/root/root/.icewm/startup @@ -0,0 +1,3 @@ +#! /bin/sh + +BROWSER="firefox --kiosk --profile $HOME/.mozilla/firefox/profile" /usr/libexec/cockpit-desktop /cockpit/@localhost/agama/index.html diff --git a/live/root/root/.mozilla/firefox/profile/user.js b/live/root/root/.mozilla/firefox/profile/user.js new file mode 100644 index 0000000000..2548c9d999 --- /dev/null +++ b/live/root/root/.mozilla/firefox/profile/user.js @@ -0,0 +1,6 @@ +// Mozilla User Preferences + +// do not remember or generate passwords +user_pref("signon.management.page.breach-alerts.enabled", false); +user_pref("signon.rememberSignons", false); +user_pref("signon.generation.enabled", false); diff --git a/live/root/root/.xinitrc b/live/root/root/.xinitrc new file mode 100644 index 0000000000..fd0aab570a --- /dev/null +++ b/live/root/root/.xinitrc @@ -0,0 +1 @@ +icewm-session -c /etc/icewm/preferences.yast2 diff --git a/live/root/tmp/README.md b/live/root/tmp/README.md new file mode 100644 index 0000000000..6d77e5169f --- /dev/null +++ b/live/root/tmp/README.md @@ -0,0 +1,5 @@ +# Helper Files + +This directory contains some helper file which are needed when building the ISO +image. The files are deleted at the end of build and are not included in the +final image. diff --git a/live/root/tmp/fw_cleanup.rb b/live/root/tmp/fw_cleanup.rb new file mode 100755 index 0000000000..e00830b80a --- /dev/null +++ b/live/root/tmp/fw_cleanup.rb @@ -0,0 +1,43 @@ +#! /usr/bin/env ruby + +# This script removes unused firmware files (not referenced by any kernel +# driver) from the system. By default the script runs in safe mode and only +# lists the unused firmware file, use the "--delete" argument to delete the +# found files. + +require "find" +require "shellwords" + +fw_dir = "/lib/firmware/" + +dir = Dir["/lib/modules/*"].first +puts "Scanning kernel modules in #{dir}..." + +# list of referenced firmware names from the kernel modules +fw = [] + +Find.find(dir) do |path| + if File.file?(path) && path.end_with?(".ko", ".ko.xz", ".ko.zst") + fw += `/usr/sbin/modinfo -F firmware #{path.shellescape}`.split("\n") + end +end + +unused_size = 0 + +Find.find(fw_dir) do |fw_path| + next unless File.file?(fw_path) + + fw_name = fw_path.delete_prefix(fw_dir).delete_suffix(".xz").delete_suffix(".zstd") + + if !fw.include?(fw_name) + unused_size += File.size(fw_path) + if (ARGV[0] == "--delete") + puts "Deleting firmware file #{fw_path}" + File.delete(fw_path) + else + puts "Found unused firmware #{fw_path}" + end + end +end + +puts "Unused firmware size: #{unused_size} (#{unused_size/1024/1024} MiB)" diff --git a/live/root/usr/bin/auto.sh b/live/root/usr/bin/auto.sh new file mode 100755 index 0000000000..4b3f841e04 --- /dev/null +++ b/live/root/usr/bin/auto.sh @@ -0,0 +1,42 @@ +#!/usr/bin/sh +set -ex + +if [ -z "$1" ] +then + url=$(awk -F 'agama.auto=' '{sub(/ .*$/, "", $2); print $2}' < /proc/cmdline) +else + url="$1" +fi + +if [ -z "$url" ] +then + echo "no autoinstallation profile" + exit 0 +fi + +echo "Using the profile at $url" + +tmpdir=$(mktemp --directory --suffix "-agama") +echo "working on $tmpdir" + +case "$url" in +*.jsonnet ) + /usr/bin/agama profile download "$url" > "${tmpdir}/profile.jsonnet" + /usr/bin/agama profile evaluate "${tmpdir}/profile.jsonnet" > "${tmpdir}/profile.json" + /usr/bin/agama profile validate "${tmpdir}/profile.json" || echo "Validation failed" + /usr/bin/agama config load "${tmpdir}/profile.json" + /usr/bin/agama install;; +*.json ) + /usr/bin/agama profile download "$url" > "${tmpdir}/profile.json" + /usr/bin/agama profile validate "${tmpdir}/profile.json" || echo "Validation failed" + /usr/bin/agama config load "${tmpdir}/profile.json" + /usr/bin/agama install;; +*.sh ) + /usr/bin/agama profile download "$url" > "${tmpdir}/profile.sh" + exec $SHELL "/${tmpdir}/profile.sh";; +*) + echo "Unrecognized suffix ${url}" + exit 1 +esac + +rm -r "$tmpdir" diff --git a/live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.service b/live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.service new file mode 100644 index 0000000000..fcf020f1ac --- /dev/null +++ b/live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.service @@ -0,0 +1,32 @@ +# This file is part of dracut. + +[Unit] +Description=dracut menu for additional cmdline parameters +Documentation=man:dracut.bootup(7) +DefaultDependencies=no +Before=dracut-cmdline-ask.service +Wants=systemd-journald.socket +After=systemd-journald.socket +Wants=systemd-vconsole-setup.service +After=systemd-vconsole-setup.service + +ConditionPathExists=/usr/lib/initrd-release +ConditionKernelCommandLine=|rd.cmdline=menu +ConditionPathExistsGlob=|/etc/cmdline.d/*.conf +Conflicts=shutdown.target emergency.target + +[Service] +Environment=DRACUT_SYSTEMD=1 +Environment=NEWROOT=/sysroot +Type=oneshot +ExecStart=-/bin/dracut-cmdline-menu +StandardInput=tty +StandardOutput=inherit +StandardError=inherit +RemainAfterExit=yes +KillMode=process +IgnoreSIGPIPE=no + +# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash +# terminates cleanly. +KillSignal=SIGHUP diff --git a/live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.sh b/live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.sh new file mode 100755 index 0000000000..8a69118866 --- /dev/null +++ b/live/root/usr/lib/dracut/modules.d/98dracut-menu/dracut-cmdline-menu.sh @@ -0,0 +1,145 @@ +#!/bin/sh + +if [ -d /sysroot ] ; then + type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh + getarg "rd.cmdline=menu" || exit 0 +fi + +# ----------------------------------------------------------------------------- + + +# usage example: +# +# title="Foo menu" +# items=("Foo A" "Foo B" "Foo C") +# +# dia_menu title items selected_item +# +# echo "selected_item=$selected_item" +# +dia_menu () { + local -n x_title=$1 + local -n x_list=$2 + local -n x_item=$3 + + local tmp i ind ok + + until [[ "$ok" ]] ; do + echo -e "\n$x_title\n" + + echo "0) <-- Back <--" + ind=1 + for i in "${x_list[@]}" ; do + echo "$ind) $i" + ind=$((ind + 1)) + done + + echo + + read -e -r -p "> " x_item tmp + + [[ ( -z "$x_item" || "$x_item" = $((x_item)) ) && "$x_item" -lt $ind ]] && ok=1 + done + + x_item=$((x_item)) + + return 0 +} + + +# usage example +# +# title="Foo input" +# value="foo bar" +# dia_input title value +# aborted=$? +# +# if [ $aborted = 1 ] ; then +# echo aborted +# else +# echo -e "input=\"$value\"" +# fi +# +dia_input () { + local -n x_title=$1 + local -n x_value=$2 + + local tmp="$x_value" + + echo -e "\n${x_title}. (Enter '+++' to abort.)\n" + + read -e -r -p "[$tmp]> " -i "$tmp" tmp + + if [[ "$tmp" = "${tmp%+++}+++" ]] ; then + return 1 + else + x_value="$tmp" + fi + + return 0 +} + +# ----------------------------------------------------------------------------- + +echo +echo "== Additional parameters ==" + +live_root=$(getarg "root=") +live_root_disk=$(getarg "root_disk=") +live_root_net=$(getarg "root_net=") +live_proxy=$(getarg "proxy=") + +live_root_disk=${live_root_disk:-$live_root} + +live_root=${live_root#live:} +live_root_disk=${live_root_disk#live:} +live_root_net=${live_root_net#live:} + +aborted=1 + +while [ "$aborted" != 0 ] ; do + echo -n > /etc/cmdline.d/98-cmdline-menu.conf + + title="Live image location" + items=("Disk / DVD" "Network") + dia_menu title items selected_item + + aborted=$? + [[ $aborted != 0 ]] && continue + + case $selected_item in + 1) live_root="$live_root_disk" ;; + 2) live_root="$live_root_net" ;; + esac + + if [[ "$selected_item" = 2 ]] ; then + title="Live image location (e.g. http://example.com/live.iso)" + dia_input title live_root + aborted=$? + [[ $aborted != 0 ]] && continue + + live_root_net="$live_root" + + title="Proxy Settings (e.g. http://proxy.example.com)" + dia_input title live_proxy + + aborted=$? + [[ $aborted != 0 ]] && continue + fi + + echo "root=live:$live_root" >> /etc/cmdline.d/98-cmdline-menu.conf + echo "proxy=$live_proxy" >> /etc/cmdline.d/98-cmdline-menu.conf + + echo + echo "== Updated settings ==" + echo + cat /etc/cmdline.d/98-cmdline-menu.conf + + title="Settings ok?" + items=("Yes" "No") + dia_menu title items selected_item + + [[ $selected_item = 1 ]] && break + + aborted=1 +done diff --git a/live/root/usr/lib/dracut/modules.d/98dracut-menu/module-setup.sh b/live/root/usr/lib/dracut/modules.d/98dracut-menu/module-setup.sh new file mode 100755 index 0000000000..71350e96f6 --- /dev/null +++ b/live/root/usr/lib/dracut/modules.d/98dracut-menu/module-setup.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# called by dracut +check() { + return 0 +} + +# called by dracut +depends() { + echo "dracut-systemd" + + return 0 +} + +installkernel() { + return 0 +} + +# called by dracut +install() { + inst_script "$moddir/dracut-cmdline-menu.sh" /bin/dracut-cmdline-menu + + inst_simple "$moddir/dracut-cmdline-menu.service" "$systemdsystemunitdir/dracut-cmdline-menu.service" + $SYSTEMCTL -q --root "$initdir" add-wants initrd.target dracut-cmdline-menu.service + + inst_hook pre-pivot 98 "$moddir/save-cmdline.sh" +} diff --git a/live/root/usr/lib/dracut/modules.d/98dracut-menu/save-cmdline.sh b/live/root/usr/lib/dracut/modules.d/98dracut-menu/save-cmdline.sh new file mode 100644 index 0000000000..9f3b55465a --- /dev/null +++ b/live/root/usr/lib/dracut/modules.d/98dracut-menu/save-cmdline.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +[ -e /dracut-state.sh ] && . /dracut-state.sh + +rm -f "$NEWROOT/etc/cmdline.d/10-liveroot.conf" + +if [ -e /etc/cmdline.d/98-cmdline-menu.conf ] ; then + cp /etc/cmdline.d/98-cmdline-menu.conf "$NEWROOT/etc/cmdline-menu.conf" +else + echo "root=$root" >"$NEWROOT/etc/cmdline-menu.conf" +fi + +echo "$CMDLINE" >"$NEWROOT/etc/cmdline-full.conf" diff --git a/live/src/README.md b/live/src/README.md new file mode 100644 index 0000000000..4b0ae62c9a --- /dev/null +++ b/live/src/README.md @@ -0,0 +1,35 @@ +# Live ISO + +This directory contains a set of files that are used to build the Agama Live ISO +image. + +## Sources + +The sources are maintained in the [Agama Git +repository](https://github.com/openSUSE/agama/tree/master/live) repository. + +## Building the ISO + +To build the ISO locally run the + +```shell +osc build -M images +``` + +command. See the [_multibuild](_multibuild) file for the list of configured +build flavors. To build for example the openSUSE flavor run this command: + +```shell +osc build -M openSUSE images +``` + +Note: For building an ISO image you need a lot of free space at the `/var` +partition. Make sure there is at least 25GiB free space otherwise the build +might fail. + +## Changes + +Please *do not* change any file in the OBS repository. The files are +automatically uploaded from the [Agama Git +repository](https://github.com/openSUSE/agama/tree/master/live), your manual +changes will be lost at the next update. diff --git a/live/src/_constraints b/live/src/_constraints new file mode 100644 index 0000000000..9b59467812 --- /dev/null +++ b/live/src/_constraints @@ -0,0 +1,7 @@ + + + + 25 + + + diff --git a/live/src/_multibuild b/live/src/_multibuild new file mode 100644 index 0000000000..2384047547 --- /dev/null +++ b/live/src/_multibuild @@ -0,0 +1,7 @@ + + openSUSE + openSUSE-Playwright + ALP + ALP-Playwright + ALP-PXE + diff --git a/live/src/agama-live.changes b/live/src/agama-live.changes new file mode 100644 index 0000000000..21812a86ff --- /dev/null +++ b/live/src/agama-live.changes @@ -0,0 +1,142 @@ +------------------------------------------------------------------- +Fri Feb 9 16:16:29 UTC 2024 - Ladislav Slezák + +- Image size reduced: + - Removed translations and locale definitions for unsupported + languages, removed translations for unused tools + - Removed sound card and TV card drivers (not needed for the installer) + - Removed alsa packages + - Removed unused firmware files +- Require 25GB disk space for build (PXE build might fail with + just 20GB) + +------------------------------------------------------------------- +Thu Feb 1 08:27:29 UTC 2024 - Josef Reidinger + +- Improve multipath experience: preload kernel module and set probing + to smart option (bsc#1215598) + +------------------------------------------------------------------- +Thu Dec 21 15:43:06 UTC 2023 - Imobach Gonzalez Sosa + +- Version 7 + +------------------------------------------------------------------- +Mon Dec 4 16:03:08 UTC 2023 - José Iván López González + +- Remove dependencies included by Agama packages (related to + gh#openSUSE/agama#911). + +------------------------------------------------------------------- +Fri Dec 1 14:23:09 UTC 2023 - Imobach Gonzalez Sosa + +- Version 6 + +------------------------------------------------------------------- +Mon Nov 13 18:02:39 UTC 2023 - Josef Reidinger + +- Use by default zram to allow having 2GiB memory requirements + (jsc#PED-7303) + +------------------------------------------------------------------- +Mon Nov 6 08:30:01 UTC 2023 - Marcus Schäfer + +- Fix s390 PXE build by using 'custom' bootloader for s390 target + There is an error inside grub2-zipl-setup which calls zipl that + then complains with "Unable to create temporary device node: No such device or address". + We don't see this issue with zipl in the kiwi integration test from here: + https://build.opensuse.org/project/show/Virtualization:Appliances:Images:Testing_s390:tumbleweed + Thus I don't think it's an issue with kiwi but most probably a conflict + between the zipl setup and the raw btrfs filesystem usage in this case. + Long story short, the zipl issue needs extra inspection and the fix + here is simple because we actually don't need a bootloader to be installed + into the disk image because it is expected to be deployed via a remote + boot infrastructure. Therefore this change disables the bootloader + install for s390 by setting the attribute: bootloader="custom" + +------------------------------------------------------------------- +Tue Oct 24 08:04:07 UTC 2023 - Marcus Schäfer + +- Add new profile ALP-PXE which builds a variant of the agama + installer that is an oem disk image which can be remote deployed + into a ramdisk to boot into the agama installation. The size constraints + are similar to the live-iso size. For more details please refer + to README.pxe + +---------------------------------------------------------------------------- +Mon Oct 23 12:03:55 UTC 2023 - Imobach González Sosa + +- Add adobe-sourcehansans-jp-fonts +- Version 5 + +---------------------------------------------------------------------------- +Thu Oct 19 20:19:11 UTC 2023 - Imobach González Sosa + +- Add libstorage-ng translations + +---------------------------------------------------------------------------- +Wed Sep 27 08:45:26 UTC 2023 - Imobach González Sosa + +- Version 4 + +---------------------------------------------------------------------------- +Tue Sep 26 07:55:34 UTC 2023 - Imobach González Sosa + +- Clean-up zypper logs + +---------------------------------------------------------------------------- +Tue Sep 26 05:28:35 UTC 2023 - Imobach González Sosa + +- Added nvme-cli requested by https://bugzilla.suse.com/show_bug.cgi?id=1215572 + +---------------------------------------------------------------------------- +Wed Aug 30 09:44:04 UTC 2023 - Imobach González Sosa + +- Add microos-tools package and enable proxy setup services. + +---------------------------------------------------------------------------- +Tue Aug 29 09:19:26 UTC 2023 - Imobach González Sosa + +- Enable ppc64le images + +---------------------------------------------------------------------------- +Thu Aug 03 10:23:49 UTC 2023 - Imobach González Sosa + +- Disable building the ALP image for ppc64le + +---------------------------------------------------------------------------- +Wed Aug 02 10:37:21 UTC 2023 - Imobach González Sosa + +- Version 3 + +---------------------------------------------------------------------------- +Tue Aug 01 09:56:42 UTC 2023 - Imobach González Sosa + +- Replace "default" flavor with a new "openSUSE" flavor that only includes + openSUSE-based products. +- Replace ALP-build-key with suse-build-key. + +---------------------------------------------------------------------------- +Mon Jul 31 11:34:26 UTC 2023 - Imobach González Sosa + +- Replace ALP-build-key with suse-build-key + +---------------------------------------------------------------------------- +Tue Jul 25 14:43:39 UTC 2023 - José Iván López González + +- Update filtering + +---------------------------------------------------------------------------- +Wed Jul 05 08:27:33 UTC 2023 - Imobach González Sosa + +- Bump version to match Agama + +---------------------------------------------------------------------------- +Thu Jun 08 14:12:15 UTC 2023 - Josef Reidinger + +- add to live image also dbus services written in rust + +---------------------------------------------------------------------------- +Thu Jun 01 14:05:13 UTC 2023 - Ladislav Slezák + +- osc copypac from project:YaST:Head:Agama package:agama-live revision:13 diff --git a/live/src/agama-live.kiwi b/live/src/agama-live.kiwi new file mode 100644 index 0000000000..215d61be30 --- /dev/null +++ b/live/src/agama-live.kiwi @@ -0,0 +1,188 @@ + + + + + + + YaST Team + yast2-maintainers@suse.de + Agama Live ISO + + + + + + + + + + 7.0.0 + zypper + en_US + us + Europe/Berlin + true + false + bgrt + openSUSE + + + + + + + + + + + + + + + + + + + + + + true + true + /dev/ram1 + false + false + + 3000 + + + + + + + true + true + /dev/ram1 + false + false + + 1900 + + + + + + + true + true + /dev/ram1 + false + false + + 1900 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/live/src/config.sh b/live/src/config.sh new file mode 100644 index 0000000000..6698ec685f --- /dev/null +++ b/live/src/config.sh @@ -0,0 +1,134 @@ +#! /bin/bash + +set -x + +# KIWI functions +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +# greeting +echo "Configure image: [$kiwi_iname]..." + +# setup baseproduct link +suseSetupProduct + +# activate services +systemctl enable sshd.service +systemctl enable NetworkManager.service +systemctl enable avahi-daemon.service +systemctl enable agama.service +systemctl enable agama-auto.service +systemctl enable agama-hostname.service +systemctl enable agama-proxy-setup.service +systemctl enable setup-systemd-proxy-env.path +systemctl enable x11-autologin.service +systemctl enable spice-vdagent.service +systemctl enable zramswap + +# default target +systemctl set-default graphical.target + +# adjust owner of extracted files +chown -R root:root /root +find /etc -user 1000 | xargs chown root:root + +### setup dracut for live system + +label=${kiwi_install_volid:-$kiwi_iname} +arch=$(uname -m) + +echo "Setting default live root: live:LABEL=$label" +mkdir /etc/cmdline.d +echo "root=live:LABEL=$label" >/etc/cmdline.d/10-liveroot.conf +echo "root_disk=live:LABEL=$label" >>/etc/cmdline.d/10-liveroot.conf +# if there's a default network location, add it here +# echo "root_net=" >> /etc/cmdline.d/10-liveroot.conf +echo 'install_items+=" /etc/cmdline.d/10-liveroot.conf "' >/etc/dracut.conf.d/10-liveroot-file.conf +echo 'add_dracutmodules+=" dracut-menu "' >>/etc/dracut.conf.d/10-liveroot-file.conf + +if [ "${arch}" = "s390x" ];then + # workaround for custom bootloader setting + touch /config.bootoptions +fi + +################################################################################ +# Reducing the used space + +# Clean-up logs +rm /var/log/zypper.log /var/log/zypp/history + +du -h -s /usr/{share,lib}/locale/ +# delete translations and unusupported languages (makes ISO about 22MiB smaller) +# build list of ignore options for "ls" with supported languages like "-I cs* -I de* -I es* ..." +readarray -t IGNORE_OPTS < <(ls /usr/share/cockpit/agama/po.*.js.gz | sed -e "s#/usr/share/cockpit/agama/po\.\(.*\)\.js\.gz#-I\n\\1*#") +# additionally keep the en_US translations +ls -1 "${IGNORE_OPTS[@]}" -I en_US /usr/share/locale/ | xargs -I% sh -c "echo 'Removing translations %...' && rm -rf /usr/share/locale/%" + +# delete locale definitions for unsupported languages (explicitly keep the C and en_US locales) +ls -1 "${IGNORE_OPTS[@]}" -I "en_US*" -I "C.*" /usr/lib/locale/ | xargs -I% sh -c "echo 'Removing locale %...' && rm -rf /usr/lib/locale/%" + +# delete unused translations (MO files) +for t in zypper gettext-runtime p11-kit polkit-1 xkeyboard-config; do + rm /usr/share/locale/*/LC_MESSAGES/$t.mo +done +du -h -s /usr/{share,lib}/locale/ + +# remove documentation +du -h -s /usr/share/doc/packages/ +rm -rf /usr/share/doc/packages/* +# remove man pages +du -h -s /usr/share/man +rm -rf /usr/share/man/* + +## removing drivers and firmware makes the Live ISO about 370MiB smaller +# +# Agama does not use sound, added by icewm dependencies +rpm -e --nodeps alsa alsa-utils alsa-ucm-conf + +# driver and firmware cleanup +# Note: openSUSE Tumbleweed Live completely removes firmware for some server +# network cars, because you very likely won't run TW KDE Live on a server. +# But for Agama installer it makes more sense to run on server. So we keep it +# and remove the drivers for sound cards and TV cards instead. Those do not +# make sense on a server. +du -h -s /lib/modules /lib/firmware +# delete sound drivers +rm -rfv /lib/modules/*/kernel/sound +# delete TV cards and radio cards +rm -rfv /lib/modules/*/kernel/drivers/media/ + +# remove the unused firmware (not referenced by kernel drivers) +/tmp/fw_cleanup.rb --delete +# remove the script, not needed anymore +rm /tmp/fw_cleanup.rb +du -h -s /lib/modules /lib/firmware + +################################################################################ +# The rest of the file was copied from the openSUSE Tumbleweed Live ISO +# https://build.opensuse.org/package/view_file/openSUSE:Factory:Live/livecd-tumbleweed-kde/config.sh?expand=1 +# + +# disable the services included by dependencies +for s in purge-kernels; do + systemctl -f disable $s || true +done + +# Only used for OpenCL and X11 acceleration on vmwgfx (?), saves ~50MiB +rpm -e --nodeps Mesa-gallium +# Too big and will have to be dropped anyway (unmaintained, known security issues) +rm -rf /usr/lib*/libmfxhw*.so.* /usr/lib*/mfx/ + +# the new, optional nvidia gsp firmware blobs are huge - ~ 70MB +du -h -s /lib/firmware/nvidia +find /lib/firmware/nvidia -name gsp | xargs -r rm -rf +du -h -s /lib/firmware/nvidia +# The gems are unpackaged already, no need to store them twice +du -h -s /usr/lib*/ruby/gems/*/cache/ +rm -rf /usr/lib*/ruby/gems/*/cache/ + +# Not needed, boo#1166406 +rm -f /boot/vmlinux*.[gx]z +rm -f /lib/modules/*/vmlinux*.[gx]z + +# Remove generated files (boo#1098535) +rm -rf /var/cache/zypp/* /var/lib/zypp/AnonymousUniqueId /var/lib/systemd/random-seed diff --git a/live/src/fix_bootconfig b/live/src/fix_bootconfig new file mode 100644 index 0000000000..05f2087a4d --- /dev/null +++ b/live/src/fix_bootconfig @@ -0,0 +1,89 @@ +#! /bin/bash + +# This script uses the KIWI 'editbootconfig' hook to modify the Live layout +# and ISO generation. +# +# Note that the 'editbootconfig' hook runs before the initrd is generated - +# this is too early for our purposes. So we have to do some gray area +# trickery: +# +# 1. Inject our modification scripts via config-cdroot.tar.xz into the Live tree. +# 2. Inject a 'xorriso' wrapper script into /usr/local/bin to hook into the ISO +# creation directly. +# This script (a) adjusts the boot config, (b) runs xorriso, and (c) makes +# it zIPL bootable on s390x. +# + +# KIWI config +test -f .profile && . .profile + +dst=${1#iso:} + +arch=`uname -m` + +# removing live root setting from command line - it's in /etc/cmdline.d instead +if [ -f $dst/boot/grub2/grub.cfg ] ; then + sed -i -E -e 's/\s+root=\S+//' -e 's/\s+rd.live\.image//' $dst/boot/grub2/grub.cfg +fi + +bootfix=$dst/fix_bootconfig.$arch +if [ -f $bootfix ] ; then + echo "bootconfig script found: \"$bootfix\"" +fi + +if [ $arch = ppc64le ] ; then + mkdir -p $dst/boot/grub2 + cp -r usr/share/grub2/powerpc-ieee1275 $dst/boot/grub2 + mv $dst/boot/grub2/powerpc-ieee1275/grub.elf $dst/boot/grub2 +fi + +cat </usr/local/bin/xorriso +#! /bin/bash + +set -x + +# get ISO file name and ISO volume id from xorriso parameters +for i in "\$@" ; do + if [ -n "\$iso_opt" ] ; then + iso_opt= + export iso="\$i" + continue + fi + if [ -n "\$volid_opt" ] ; then + volid_opt= + export volid="\$i" + continue + fi + if [ "\$i" = "-outdev" ] ; then + iso_opt=1 + continue + fi + if [ "\$i" = "-volid" ] ; then + volid_opt=1 + continue + fi +done + +volid=${kiwi_install_volid:-$kiwi_iname} + +[ -x $bootfix ] && $bootfix $dst +rm -f $dst/fix_bootconfig.* + +case $arch in + s390x) + /usr/bin/xorriso "\$@" -volid "\$volid" -boot_image any bin_path=boot/s390x/cd.ikr -boot_image any boot_info_table=off -boot_image any load_size=512 + err=\$? + [ -x /usr/bin/isozipl ] && isozipl "\$iso" + ;; + ppc64le) + /usr/bin/xorriso "\$@" -volid "\$volid" -boot_image any chrp_boot_part=on + err=\$? + ;; + *) + /usr/bin/xorriso "\$@" -volid "\$volid" +esac + +exit \$err +XXX + +chmod +x /usr/local/bin/xorriso diff --git a/live/src/images.sh b/live/src/images.sh new file mode 100644 index 0000000000..a225f1470b --- /dev/null +++ b/live/src/images.sh @@ -0,0 +1,19 @@ +#! /bin/bash + +echo 'add memory size check for livenetroot installation' + +[[ -f /usr/lib/dracut/modules.d/90livenet/livenetroot.sh ]] || exit 1 + +echo 'let memsize=$(($(sed -n "s/MemTotal: *\([[:digit:]]*\).*/\1/p" /proc/meminfo) / 1024))' > /tmp/livenetroot-mod +echo 'let imgsize=$(($(curl -sI "$liveurl" | sed -n "s/Content-Length: *\([[:digit:]]*\).*/\1/p") / (1024 * 1024)))' >> /tmp/livenetroot-mod +echo '' >> /tmp/livenetroot-mod +echo 'if [ $((memsize - imgsize)) -lt 1024 ]; then' >> /tmp/livenetroot-mod +echo " sed -i 'N;/echo \"\$RDSOSREPORT\"/s/echo$/echo\\" >> /tmp/livenetroot-mod +echo ' echo Warning!!!\' >> /tmp/livenetroot-mod +echo ' echo The memory size of your system is too small for this live image.\' >> /tmp/livenetroot-mod +echo ' echo Expect killed processes due to out of memory conditions.\' >> /tmp/livenetroot-mod +echo " echo /' usr/bin/dracut-emergency" >> /tmp/livenetroot-mod +echo ' emergency_shell' >> /tmp/livenetroot-mod +echo 'fi' >> /tmp/livenetroot-mod + +sed -i '/info "fetching $liveurl"$/ r /tmp/livenetroot-mod' /usr/lib/dracut/modules.d/90livenet/livenetroot.sh