Skip to content

Commit

Permalink
Merge branch 'master' into profile-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Feb 10, 2025
2 parents 6b4cfb1 + dbd4927 commit 35fa4dd
Show file tree
Hide file tree
Showing 34 changed files with 1,054 additions and 135 deletions.
5 changes: 4 additions & 1 deletion live/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ OBS_PROJECT = "systemsmanagement:Agama:Devel"
OBS_PACKAGE = "agama-installer"
# to use internal OBS add "OBS_API=https://api.suse.de"
OBS_API = "https://api.opensuse.org"
# default OBS build target
OBS_TARGET = "images"
ARCH = $(shell uname -m)

# files to copy from src/
COPY_FILES = $(patsubst $(SRCDIR)/%,$(DESTDIR)/%,$(wildcard $(SRCDIR)/*))
Expand Down Expand Up @@ -58,6 +61,6 @@ build: $(DESTDIR)
if [ ! -e $(DESTDIR)/.osc ]; then make clean; osc -A $(OBS_API) co -o $(DESTDIR) $(OBS_PROJECT) $(OBS_PACKAGE); fi
$(MAKE) all
# allow passing optional parameters to osc like "-p <dir>" or "-k <dir>"
(cd $(DESTDIR) && osc -A $(OBS_API) build -M $(FLAVOR) $(OSC_OPTS) images)
(cd $(DESTDIR) && osc -A $(OBS_API) build -M $(FLAVOR) $(OSC_OPTS) $(OBS_TARGET) $(ARCH) $(KIWI_FILE))

.PHONY: build all clean
92 changes: 55 additions & 37 deletions live/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@
## Table of Content

- [Live ISO](#live-iso)
- [Table of Content](#table-of-content)
- [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)
- [GRUB2 menu](#grub2-menu)
- [SSH Server](#ssh-server)
- [Building the sources](#building-the-sources)
- [Building the ISO image](#building-the-iso-image)
- [Build options](#build-options)
- [Using another project](#using-another-project)
- [Using internal build service](#using-internal-build-service)
- [Using locally built RPM packages](#using-locally-built-rpm-packages)
- [Image definition](#image-definition)
- [KIWI files](#kiwi-files)
- [Image configuration](#image-configuration)
- [GRUB2 menu](#grub2-menu)
- [SSH server](#ssh-server)
- [Autologin](#autologin)
- [Firefox Profile](#firefox-profile)
- [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)
- [Autoinstallation support](#autoinstallation-support)
- [Firmware cleanup](#firmware-cleanup)

---

Expand All @@ -38,7 +41,7 @@ This directory contains a set of files that are used to build the Agama Live ISO
- [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
## Building the sources

To build the sources for OBS just run the

Expand All @@ -56,7 +59,7 @@ make clean

or just simply delete the `dist` subdirectory.

## Building the ISO Image
## Building the ISO image

To build the ISO locally run the

Expand All @@ -70,7 +73,7 @@ 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
### Build options

By default this will build the openSUSE image. If you want to build another image then run

Expand All @@ -82,6 +85,8 @@ make build FLAVOR=openSUSE-PXE

See the [_multibuild](src/_multibuild) file for the list of available build flavors.

#### Using another project

By default it will use the
[systemsmanagement:Agama:Devel](https://build.opensuse.org/project/show/systemsmanagement:Agama:Devel)
OBS project. If you want to build using another project, like your fork, then delete the `dist`
Expand All @@ -90,17 +95,42 @@ directory and checkout the OBS project manually and run the build:
```shell
rm -rf dist
# replace <USER> with your OBS account name
osc co -o dist home:<USER>:branches:systemsmanagement:Agama:Devel agama-installer-openSUSE
make build
make build OBS_PROJECT=home:<USER>:branches:systemsmanagement:Agama:Devel
```

#### Using internal build service

To build a SLE image using the internal OBS instance run

```shell
make build OBS_API=https://api.suse.de OBS_PROJECT=<project> OBS_PACKAGE=agama-installer-SLE FLAVOR=SLE
```

## Image Definition
#### Using locally built RPM packages

If you have a locally built RPM which you want to include in the ISO instead of the RPM from the
build service use the `-p` osc option with directory containing the RPMS. The workflow should look
like this:

```shell
# first create a place for storing the RPM packages, if the directory already
# exists make sure it does not contain any previous results
mkdir ~/rpms

# build the updated RPM package locally and save the result into the created directory
osc build -k ~/rpms

# then build the Live ISO using these packages
make build OSC_OPTS="-p ~/rpms"
```

## 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
### KIWI files

The main Kiwi source files are located in the [src](src) subdirectory:

Expand All @@ -118,20 +148,19 @@ The main Kiwi source files are located in the [src](src) subdirectory:
- [fix_bootconfig](src/fix_bootconfig) - a special KIWI hook script which sets the boot
configuration on S390 and PPC64 architectures.

## Image Configuration
## Image configuration

The Live ISO is configured to allow using some features and allow running Agama there.

## GRUB2 Menu
## GRUB2 menu

grub.cfg, defining boot menu items of the Agama image, is generated by scripts stored in
[config-cdroot](https://github.com/openSUSE/agama/tree/master/live/config-cdroot).

Both x86_64 and aarch64 grub.cfg are basically copies of KIWI autogenerated grub.cfg.
The x86_64 grub.cfg contains UEFI fix for Booting from disk (Issue #1609).


### SSH Server
### 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.
Expand All @@ -147,7 +176,7 @@ Automatic root login and staring the graphical environment is configured in seve
- Icewm uses the usual YaST2 installation [preferences.yast2](root/etc/icewm/preferences.yast2)
configuration file

### Firefox Profile
### 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
Expand Down Expand Up @@ -203,24 +232,13 @@ That allows scanning all running Agama instances in the local network with comma
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
### 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
### 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.
Expand Down
14 changes: 7 additions & 7 deletions live/config-cdroot/fix_bootconfig.s390x
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# │   └── s390x
# │   ├── cd.ikr
# │   ├── initrd
# │   ├── initrd.ofs
# │   ├── initrd.off
# │   ├── initrd.siz
# │   ├── linux
# │   ├── parmfile
Expand Down Expand Up @@ -97,8 +97,8 @@ initrd_siz_ofs=0x00010414
initrd_ofs=0x01000000
parmfile_ofs=0x00010480

# Create initrd.ofs (note: 32 bit, stored in big endian).
printf "%08x" $((initrd_ofs)) | xxd -r -p - $boot_dir/initrd.ofs
# 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)
Expand All @@ -108,7 +108,7 @@ printf "%08x" $((initrd_size)) | xxd -r -p - $boot_dir/initrd.siz
cat >$boot_dir/suse.ins <<XXX
* SUSE Linux for IBM z Systems Installation System
linux 0x00000000
initrd.ofs $initrd_ofs_ofs
initrd.off $initrd_ofs_ofs
initrd.siz $initrd_siz_ofs
initrd $initrd_ofs
parmfile $parmfile_ofs
Expand All @@ -118,7 +118,7 @@ XXX
cat >$dst/suse.ins <<XXX
* SUSE Linux for IBM z Systems Installation System
boot/s390x/linux 0x00000000
boot/s390x/initrd.ofs $initrd_ofs_ofs
boot/s390x/initrd.off $initrd_ofs_ofs
boot/s390x/initrd.siz $initrd_siz_ofs
boot/s390x/initrd $initrd_ofs
boot/s390x/parmfile $parmfile_ofs
Expand All @@ -128,7 +128,7 @@ XXX
cat >$dst/susehmc.ins <<XXX
* SUSE Linux for IBM z Systems Installation System via HMC
boot/s390x/linux 0x00000000
boot/s390x/initrd.ofs $initrd_ofs_ofs
boot/s390x/initrd.off $initrd_ofs_ofs
boot/s390x/initrd.siz $initrd_siz_ofs
boot/s390x/initrd $initrd_ofs
boot/s390x/parmfile.hmc $parmfile_ofs
Expand Down Expand Up @@ -158,7 +158,7 @@ XXX

# Create cd.ikr with all the file blobs mentioned in suse.ins.
dd status=none if=$boot_dir/linux of=$boot_dir/cd.ikr
dd status=none conv=notrunc obs=1 seek=$((initrd_ofs_ofs)) if=$boot_dir/initrd.ofs of=$boot_dir/cd.ikr
dd status=none conv=notrunc obs=1 seek=$((initrd_ofs_ofs)) if=$boot_dir/initrd.off of=$boot_dir/cd.ikr
dd status=none conv=notrunc obs=1 seek=$((initrd_siz_ofs)) if=$boot_dir/initrd.siz of=$boot_dir/cd.ikr
dd status=none conv=notrunc obs=4096 seek=$((initrd_ofs/4096)) if=$boot_dir/initrd of=$boot_dir/cd.ikr
# clear kernel cmdline area; it's actually 4 kiB, but 1 block should be more than enough
Expand Down
7 changes: 7 additions & 0 deletions live/src/agama-installer.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Feb 7 16:31:50 UTC 2025 - Eugenio Paolantonio <eugenio.paolantonio@suse.com>

- live: fix_bootconfig.s390x: restore initrd.off naming for the initrd offset
This essentially reverts the previous change (bsc#1236781, gh#agama-project/agama#1969,
gh#agama-project/agama#1974)

-------------------------------------------------------------------
Fri Feb 7 09:15:02 UTC 2025 - Ladislav Slezák <lslezak@suse.com>

Expand Down
10 changes: 6 additions & 4 deletions rust/agama-server/src/web/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ pub async fn login(
pub struct LoginFromQueryParams {
/// Token to use for authentication.
token: String,
/// Requested locale
lang: String,
/// Optional requested locale
lang: Option<String>,
}

#[utoipa::path(get, path = "/login", responses(
Expand All @@ -126,8 +126,10 @@ pub async fn login_from_query(
let mut target = String::from("/");

// keep the "lang" URL query if it was present in the original request
if !&params.lang.is_empty() {
target.push_str(format!("?lang={}", params.lang).as_str());
if let Some(lang) = params.lang {
if !lang.is_empty() {
target.push_str(format!("?lang={}", lang).as_str());
}
}

let location = HeaderValue::from_str(target.as_str());
Expand Down
6 changes: 6 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Feb 10 13:28:34 UTC 2025 - Ladislav Slezák <lslezak@suse.com>

- Fixup: Make the "lang" URL query optional, do not fail when it
is missing. This fixes crash on non-UEFI systems.

-------------------------------------------------------------------
Fri Feb 7 11:03:29 UTC 2025 - Ladislav Slezák <lslezak@suse.com>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def InitPackageCallbacks(logger = nil)
Agama::Software::Callbacks::Media.new(
questions_client, logger
).setup

Agama::Software::Callbacks::Provide.new(
questions_client, logger
).setup
end

# Returns the client to ask questions
Expand All @@ -59,4 +63,3 @@ def questions_client
PackageCallbacks = PackageCallbacksClass.new
PackageCallbacks.main
end

2 changes: 2 additions & 0 deletions service/lib/agama/software/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ module Callbacks

require "agama/software/callbacks/media"
require "agama/software/callbacks/progress"
require "agama/software/callbacks/provide"
require "agama/software/callbacks/script"
require "agama/software/callbacks/signature"
21 changes: 19 additions & 2 deletions service/lib/agama/software/callbacks/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,25 @@ def setup
# @return [String]
# @see https://github.com/yast/yast-yast2/blob/19180445ab935a25edd4ae0243aa7a3bcd09c9de/library/packages/src/modules/PackageCallbacks.rb#L620
# rubocop:disable Metrics/ParameterLists
def media_change(_error_code, error, url, _product, _current, _current_label, _wanted,
_wanted_label, _double_sided, _devices, _current_device)
def media_change(error_code, error, url, product, current, current_label, wanted,
wanted_label, double_sided, devices, current_device)
logger.debug(
format("MediaChange callback: error_code: %s, error: %s, url: %s, product: %s, " \
"current: %s, current_label: %s, wanted: %s, wanted_label: %s, " \
"double_sided: %s, devices: %s, current_device",
error_code,
error,
Yast::URL.HidePassword(url),
product,
current,
current_label,
wanted,
wanted_label,
double_sided,
devices,
current_device)
)

question = Agama::Question.new(
qclass: "software.medium_error",
text: error,
Expand Down
Loading

0 comments on commit 35fa4dd

Please sign in to comment.