Skip to content

Commit

Permalink
Use the elemental-rootfs feature (#1163)
Browse files Browse the repository at this point in the history
Use the elemental-rootfs feature

The new elemental-rootfs and elemental-sysroot features are drop-in
replacements for immutable-rootfs feature.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
  • Loading branch information
frelon authored Jan 11, 2024
1 parent 42f9759 commit c1f29a3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .obs/dockerfile/slem-base-os/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ RUN zypper clean --all && \
rm -rf /boot/vmlinux*

# Rebuild initrd to setup dracut with the boot configurations
RUN elemental init --force immutable-rootfs,grub-config,dracut-config,cloud-config-essentials,elemental-setup && \
RUN elemental init --force elemental-rootfs,elemental-sysroot,grub-config,dracut-config,cloud-config-essentials,elemental-setup && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* 2>/dev/null | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi
2 changes: 1 addition & 1 deletion .obs/dockerfile/slem-flavored-os/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ RUN rm -rf /var/log/update* && \
rm -rf /boot/vmlinux*

# Rebuild initrd to setup dracut with the boot configurations
RUN elemental init --force immutable-rootfs,grub-config,dracut-config,cloud-config-essentials,elemental-setup && \
RUN elemental init --force elemental-rootfs,elemental-sysroot,grub-config,dracut-config,cloud-config-essentials,elemental-setup && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* 2>/dev/null | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi
4 changes: 2 additions & 2 deletions framework/files/system/oem/01_elemental-rootfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ stages:
rootfs:
- if: '[ ! -f "/run/elemental/recovery_mode" ]'
name: "Layout configuration"
environment_file: /run/cos/cos-layout.env
environment_file: /run/elemental/mount-layout.env
environment:
OVERLAY: "tmpfs:25%"
RW_PATHS: "/var /etc /srv"
Expand All @@ -51,6 +51,6 @@ stages:
- if: '[ -f "/run/elemental/recovery_mode" ]'
# omit the persistent partition on recovery mode
name: "Layout configuration for recovery"
environment_file: /run/cos/cos-layout.env
environment_file: /run/elemental/mount-layout.env
environment:
OVERLAY: "tmpfs:25%"
2 changes: 1 addition & 1 deletion framework/files/system/oem/05_motd_and_autologin.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Root autologin"
stages:
initramfs:
- if: '[ -f /run/cos/live_mode ]'
- if: '[ -f /run/elemental/live_mode ]'
files:
- path: /etc/motd
content: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Elemental Register install"
stages:
network.after:
- if: '[ -f /run/cos/live_mode ]'
- if: '[ -f /run/elemental/live_mode ]'
commands:
- systemctl start elemental-register-install
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Elemental Register start"
stages:
network.after:
- if: '[ ! -f /run/cos/live_mode ] && [ ! -f /run/cos/recovery_mode ]'
- if: '[ ! -f /run/elemental/live_mode ] && [ ! -f /run/elemental/recovery_mode ]'
commands:
- systemctl start elemental-register.timer
9 changes: 6 additions & 3 deletions framework/files/usr/sbin/suc-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RELEASE_FILE="${RELEASE_FILE:-/etc/os-release}"
CONF_FILE="${CONF_FILE:-/run/data/cloud-config}"
LOCK_TIMEOUT="${LOCK_TIMEOUT:-600}"
LOCK_FILE="${LOCK_FILE:-$HOST_DIR/run/elemental/upgrade.lock}"
ACTIVE_FILE="${ACTIVE_FILE:-$HOST_DIR/run/cos/active_mode}"
ACTIVE_FILE="${ACTIVE_FILE:-$HOST_DIR/run/elemental/active_mode}"

mkdir -p $HOST_DIR/run/elemental

Expand Down Expand Up @@ -101,12 +101,15 @@ function isActiveSystem() {
mount --rbind $HOST_DIR/run /run
elemental --debug upgrade --system.uri dir:/

STATE_PATH=/run/initramfs/elemental-state
[ ! -d "${STATE_PATH}" ] && STATE_PATH=/run/initramfs/cos-state

# After elemental upgrade we have to also copy
# /etc/resolv.conf from /host filesystem, otherwise
# it will be taken from container context
mount -o remount,rw /run/initramfs/cos-state
mount -o remount,rw $STATE_PATH
LOOP_DEV=$(losetup -f)
losetup $LOOP_DEV /run/initramfs/cos-state/cOS/active.img
losetup $LOOP_DEV ${STATE_PATH}/cOS/active.img
mkdir -p /tmp/cOS
mount $LOOP_DEV /tmp/cOS
rsync -av $HOST_DIR/etc/resolv.conf /tmp/cOS/etc/resolv.conf
Expand Down

0 comments on commit c1f29a3

Please sign in to comment.