summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs
diff options
context:
space:
mode:
authorJonathan Bauer2017-03-07 11:14:32 +0100
committerJonathan Bauer2017-03-07 11:14:32 +0100
commit9b61577c3ceb809c2473d4757590a01054466eaf (patch)
tree2bbbd2dc0a7e79f8509b53bef2f1aba939900489 /builder/dnbd3-rootfs
parentYannick Bilger's WLAN boot prototype (diff)
downloadsystemd-init-9b61577c3ceb809c2473d4757590a01054466eaf.tar.gz
systemd-init-9b61577c3ceb809c2473d4757590a01054466eaf.tar.xz
systemd-init-9b61577c3ceb809c2473d4757590a01054466eaf.zip
moved all dracut modules to modules.d/ + support
Diffstat (limited to 'builder/dnbd3-rootfs')
m---------builder/dnbd3-rootfs/binaries/dnbd30
m---------builder/dnbd3-rootfs/binaries/qemu-xmount0
-rw-r--r--builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/Makefile12
-rw-r--r--builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker.c33
m---------builder/dnbd3-rootfs/binaries/xmount0
-rwxr-xr-xbuilder/dnbd3-rootfs/configuration/bash3
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh33
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh66
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh28
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/enable-sysrq.sh10
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/fetch-config.sh53
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/load-custom-kernel-modules.sh32
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/mount-root-device.sh33
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh89
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/prepare-root-partition.sh163
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/set-dracut-environment-variables.sh16
-rw-r--r--builder/dnbd3-rootfs/hooks/shutdown-umount.sh8
-rwxr-xr-xbuilder/dnbd3-rootfs/module-setup.sh269
-rw-r--r--builder/dnbd3-rootfs/scripts/build.sh126
-rwxr-xr-xbuilder/dnbd3-rootfs/scripts/container-unpack-qemu.sh35
-rwxr-xr-xbuilder/dnbd3-rootfs/scripts/container-unpack-xmount.sh34
-rwxr-xr-xbuilder/dnbd3-rootfs/scripts/device-add-write-layer.sh26
m---------builder/dnbd3-rootfs/scripts/rebash0
-rw-r--r--builder/dnbd3-rootfs/scripts/tools.sh105
-rw-r--r--builder/dnbd3-rootfs/services/dnbd3root.service17
-rw-r--r--builder/dnbd3-rootfs/udev/70-openslx-disk.rules7
26 files changed, 0 insertions, 1198 deletions
diff --git a/builder/dnbd3-rootfs/binaries/dnbd3 b/builder/dnbd3-rootfs/binaries/dnbd3
deleted file mode 160000
-Subproject 210b653ff4043a27992389e765a2c3a79938a54
diff --git a/builder/dnbd3-rootfs/binaries/qemu-xmount b/builder/dnbd3-rootfs/binaries/qemu-xmount
deleted file mode 160000
-Subproject 4873cd023da8511ed9792a318d1456c94904612
diff --git a/builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/Makefile b/builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/Makefile
deleted file mode 100644
index 406ec50f..00000000
--- a/builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-CC=gcc
-OPTS=-c -Wall
-SOURCES=$(wildcard *.c)
-OBJECTS=$(SOURCES:.c=.o)
-BINS=$(SOURCES:.c=)
-
-all: $(BINS)
-
-$(BINS): $(OBJECTS)
-
-clean:
- rm -f $(BINS) $(OBJECTS)
diff --git a/builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker.c b/builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker.c
deleted file mode 100644
index 8f0fc108..00000000
--- a/builder/dnbd3-rootfs/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-void print_array(int argc, char *argv[]) {
- // Helper function to print given array with given length.
- int i = 0;
- int j = 0;
- for (i = 0; i < argc; i ++) {
- j = 0;
- while(argv[i][j] != '\0')
- printf("%c", argv[i][j++]);
- printf(" ");
- }
- printf("\n");
-}
-int main(int argc, char *argv[]) {
- int count;
- // Last item acts as null pointer.
- char **copy = calloc(sizeof(char *), argc);
- // Slice first given command line argument.
- for (count = 0; count < argc - 1; count++)
- copy[count] = strdup(argv[count + 1]);
- // Adding systemd indicator to preserve wrapped process during changing
- // root filesystem. We mark wrapper and child process.
- argv[0][0] = '@';
- copy[0][0] = '@';
- if (-1 == execvp(argv[1], copy)) {
- perror("Executing child process failed.");
- return -1;
- }
-}
diff --git a/builder/dnbd3-rootfs/binaries/xmount b/builder/dnbd3-rootfs/binaries/xmount
deleted file mode 160000
-Subproject 015137556fce1e21273f198ae0b9158157f74f7
diff --git a/builder/dnbd3-rootfs/configuration/bash b/builder/dnbd3-rootfs/configuration/bash
deleted file mode 100755
index adefda40..00000000
--- a/builder/dnbd3-rootfs/configuration/bash
+++ /dev/null
@@ -1,3 +0,0 @@
-alias poweroff='poweroff --force'
-alias halt='poweroff'
-alias reboot='reboot --force'
diff --git a/builder/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh b/builder/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh
deleted file mode 100755
index ee308af6..00000000
--- a/builder/dnbd3-rootfs/hooks/copy-dnbd3-service-into-newroot.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-core.import logging
-type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-# endregion
-exceptions.try
-{
-logging.set_commands_level debug
-logging.set_level debug
-[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx
-logging.set_log_file "$SLX_LOG_FILE_PATH"
-
-systemd_system_unit_path="$(dirname "$(find / -name dracut-mount.service \
- -type f -print -quit)")"
-new_systemd_system_unit_path="${NEWROOT}/lib/systemd/system"
-cp "${systemd_system_unit_path}/dnbd3root.service" \
- "${new_systemd_system_unit_path}/dnbd3root.service"
-mkdir --parents "${new_systemd_system_unit_path}/sysinit.target.wants"
-! ln --symbolic '../dnbd3root.service' \
- "${new_systemd_system_unit_path}/sysinit.target.wants/dnbd3root.service"
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh b/builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh
deleted file mode 100755
index a887d8c9..00000000
--- a/builder/dnbd3-rootfs/hooks/copy-dracut-systemd-files-into-newroot.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-core.import logging
-type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-# endregion
-exceptions.try
-{
-logging.set_commands_level debug
-logging.set_level debug
-[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx
-logging.set_log_file "$SLX_LOG_FILE_PATH"
-
-# Needed to be able to go back to dracut at system shutdown.
-temporary_directory_path="$(mktemp --directory)"
-mount --options bind / "$temporary_directory_path"
-cp --recursive --no-target-directory "$temporary_directory_path" /run/initramfs
-umount "$temporary_directory_path"
-rm --dir "$temporary_directory_path"
-}
-exceptions.catch
-{
- logging.warn "Failed to copy initramfs to /run/initramfs, shutdown hooks" \
- "will not work."
-}
-
-exceptions.try
-{
-# Dracut may not be installed on the new root. Thus copy all services over.
-systemd_system_unit_path="$(dirname "$(find / -name dracut-mount.service \
- -type f -print -quit)")"
-new_systemd_system_unit_path="${NEWROOT}/lib/systemd/system"
-
-mkdir --parents "$new_systemd_system_unit_path/initrd.target.wants"
-for file in \
- dracut-cmdline.service \
- dracut-initqueue.service \
- dracut-mount.service \
- dracut-pre-mount.service \
- dracut-pre-pivot.service \
- dracut-pre-trigger.service \
- dracut-pre-udev.service
-do
- cp "${systemd_system_unit_path}/${file}" \
- "${new_systemd_system_unit_path}/${file}"
- # "ln" returns an error if the link already exists.
- source_path="../${file}"
- target_path="${new_systemd_system_unit_path}/initrd.target.wants/${file}"
- ln --symbolic "$source_path" "$targetPath" &>/dev/null || \
- logging.warn "Failed to link \"$source_path\" to \"$target_path\"."
-done
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
-
-# region vim modline
-
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh b/builder/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh
deleted file mode 100755
index 6a56f857..00000000
--- a/builder/dnbd3-rootfs/hooks/copy-openslx-configuration-into-newroot.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-core.import logging
-type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-# endregion
-exceptions.try
-{
-source "/etc/openslx"
-logging.set_commands_level debug
-logging.set_level debug
-[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx
-logging.set_log_file "$SLX_LOG_FILE_PATH"
-
-mkdir --parents "${NEWROOT}${SLX_CONFIGURATION_LOCATION}"
-cp "/etc/openslx" "${NEWROOT}${SLX_CONFIGURATION_LOCATION}"
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/enable-sysrq.sh b/builder/dnbd3-rootfs/hooks/enable-sysrq.sh
deleted file mode 100755
index f159e3ae..00000000
--- a/builder/dnbd3-rootfs/hooks/enable-sysrq.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-
-# Enables magic sysrq kernel supported key combinations.
-echo 1 > /proc/sys/kernel/sysrq
-
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/fetch-config.sh b/builder/dnbd3-rootfs/hooks/fetch-config.sh
deleted file mode 100755
index 23c5f004..00000000
--- a/builder/dnbd3-rootfs/hooks/fetch-config.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-core.import logging
-type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-# endregion
-exceptions.try
-{
-logging.set_commands_level debug
-logging.set_level debug
-[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx
-logging.set_log_file "$SLX_LOG_FILE_PATH"
-
-# NOTE: "getarg" raises an exception so deactivate exceptions for now.
-exceptions.deactivate
-configuration_file_name="$(getarg slx_configuration_filename=)"
-if [ -z "$configuration_file_name" ]; then
- configuration_file_name='config'
-fi
-slx_server="$(getarg slxsrv=)"
-slx_server_base="$(getarg slxbase=)"
-exceptions.activate
-
-logging.info 'Getting configuration file.'
-IFS_backup="$IFS"
-IFS=','
-for host in ${slx_server}; do
- logging.info "Trying host \"$host\"."
- if wget --timeout 5 \
- "http://${host}/${slx_server_base}/${configuration_file_name}" \
- --output-document '/etc/openslx'
- then
- break
- fi
-done
-IFS="$IFS_backup"
-
-if [[ ! -e "/etc/openslx" ]]; then
- logging.warn "Downloading OpenSLX configuration file from any of the servers \"${slx_server}\" at location \"${slx_server_base}/${configuration_file_name}\" failed. Return code: $return_code"
- exit 1
-fi
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/load-custom-kernel-modules.sh b/builder/dnbd3-rootfs/hooks/load-custom-kernel-modules.sh
deleted file mode 100755
index fe153265..00000000
--- a/builder/dnbd3-rootfs/hooks/load-custom-kernel-modules.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-core.import logging
-type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-# endregion
-exceptions.try
-{
-DNBD3_MOD_PATH="/usr/lib/modules/current/extra/dnbd3.ko"
-
-if [ ! -e "${DNBD3_MOD_PATH}" ]; then
- logging.warn "No such file of directory: ${DNBD3_MOD_PATH}"
- exit 1
-fi
-
-# load the kernel modules for dnbd3 and nbd
-if ! insmod "${DNBD3_MOD_PATH}"; then
- logging.warn "Failed to load DNBD3 kernel module..."
- exit 1
-fi
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/mount-root-device.sh b/builder/dnbd3-rootfs/hooks/mount-root-device.sh
deleted file mode 100755
index 35443def..00000000
--- a/builder/dnbd3-rootfs/hooks/mount-root-device.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-# endregion
-exceptions.try
-{
-logging.set_commands_level debug
-logging.set_level debug
-[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx
-logging.set_log_file "$SLX_LOG_FILE_PATH"
-
-if ! getarg root=; then
- source "/etc/openslx"
- mount /dev/mapper/root "$NEWROOT" $SLX_MOUNT_ROOT_OPTIONS
- if [ -n "$SLX_GENERATE_FSTAB_SCRIPT" ]; then
- eval "$SLX_GENERATE_FSTAB_SCRIPT"
- else
- echo "" > "$NEWROOT/etc/fstab"
- fi
-fi
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh b/builder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh
deleted file mode 100755
index 20041ecf..00000000
--- a/builder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-core.import logging
-# endregion
-(
-logging.set_commands_level debug
-logging.set_level debug
-[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx
-logging.set_log_file "$SLX_LOG_FILE_PATH"
-
-SLX_INITIAL_KERNEL_COMMAND_LINE="$(cat /proc/cmdline | tr --delete '\n')"
-
-# This location will be used to have a writable kernel command line file
-# location.
-writeable_proc_cmdline_path='/writable_proc_cmdline/'
-mkdir --parents "$writeable_proc_cmdline_path"
-# NOTE: The fake writeable overlay have to be a temporary filesystem for the
-# hack to work.
-mount --types tmpfs tmpfs "$writeable_proc_cmdline_path"
-echo -n "$SLX_INITIAL_KERNEL_COMMAND_LINE" > \
- "${writeable_proc_cmdline_path}/cmdline"
-
-logging.debug \
- '-----------------------Kernel-Command-Line:------------------------------'
-logging.debug "${SLX_INITIAL_KERNEL_COMMAND_LINE}"
-logging.debug \
- '-------------------------------------------------------------------------'
-
-for parameter in $(getargs BOOTIF=); do
- logging.debug "PXE given boot interface $parameter"
- dracut_interface_name="bootnet:$(echo $parameter | \
- sed --regexp-extended 's/.{2}[:\-]((.{2}[:\-]){5}.{2})/\1/' | \
- sed s/-/:/g)"
- logging.debug "Dracut interface name is: $dracut_interface_name"
- logging.plain -n " ifname=$dracut_interface_name" >> \
- "${writeable_proc_cmdline_path}cmdline"
-done
-for parameter in $(getargs ip=); do
- temp="$parameter:"
- set --
- while [ -n "$temp" ]; do
- set -- "$@" "${temp%%:*}"
- temp=${temp#*:}
- done
-
- [ -n "$1" ] && ip=$1
- [ -n "$2" ] && server_ip=$2
- [ -n "$3" ] && gateway_ip=$3
- [ -n "$4" ] && net_mask=$4
-
- logging.debug "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask"
- dracut_ip_configuration="$ip::$gateway_ip:$net_mask::bootnet:off"
- logging.debug "Dracut ip configuration is: $dracut_ip_configuration"
- sed --regexp-extended "s/ip=[^ ]*/ip=$dracut_ip_configuration/g" \
- --in-place "${writeable_proc_cmdline_path}cmdline"
-done
-
-if [ -z "$dracut_ip_configuration" ]; then
- logging.warn 'No "ip" parameter found in the kernel command line.'
-fi
-if [ -z "$dracut_interface_name" ]; then
- logging.warn 'No "BOOTIF" parameter found in the kernel command line.'
-fi
-mount --options bind "${writeable_proc_cmdline_path}cmdline" /proc/cmdline
-
-if [ -z "$(getargs slxsrv=)" ]; then
- logging.warn 'No "slxsrv" parameter found in the kernel command line.'
- exit 1
-fi
-if [ -z "$(getargs slxbase=)" ]; then
- logging.warn 'No "slxbase" parameter found in the kernel command line.'
- exit 1
-fi
-
-logging.debug \
- '-----------------------Dracut-Kernel-Command-Line:-----------------------'
-logging.debug "$(logging.cat /proc/cmdline)"
-logging.debug \
- '-------------------------------------------------------------------------'
-)
-# region vim modline
-
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
deleted file mode 100755
index 3e93253f..00000000
--- a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/usr/bin/env bash
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import '/usr/lib/openslx/tools.sh'
-core.import exceptions
-core.import utils
-core.import logging
-type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-# endregion
-exceptions.try
-{
-source /etc/openslx
-logging.set_commands_level debug
-logging.set_level debug
-[[ "$SLX_LOG_FILE_PATH" == "" ]] && SLX_LOG_FILE_PATH=/var/log/openslx
-logging.set_log_file "$SLX_LOG_FILE_PATH"
-
-# region find writable partition
-if [[ "$SLX_WRITABLE_DEVICE_IDENTIFIER" != '' ]] &&
- ! persistent_device="$(
- tools.find_block_device "$SLX_WRITABLE_DEVICE_IDENTIFIER" '' \
- "$SLX_WRITABLE_DEVICE_IDENTIFIER_TIMEOUT_IN_SECONDS"
- )"
-then
- logging.warn "Failed to find unique device with identifier" \
- "\"${SLX_WRITABLE_DEVICE_IDENTIFIER}\"; matched devices:" \
- "\"${persistent_device}\""
-fi
-if [ -n "$SLX_WRITABLE_DEVICE_STORAGE_FILE_PATH" ] && [ -n "$persistent_device" ]
-then
- persistent_mountpoint=/mnt/slx_writable_device
- storage_file_path="${persistent_mountpoint}/$SLX_WRITABLE_DEVICE_STORAGE_FILE_PATH"
- ! mkdir --parents "$(dirname "$storage_file_path")"
- if ! mount --type auto "$persistent_device" "$persistent_mountpoint"; then
- logging.warn "Failed to mount $persistent_device, checking filesystem."
- ! $SLX_WRITABLE_DEVICE_STORAGE_FILESYSTEM_CHECK_COMMAND \
- "$persistent_device"
- if ! mount --type auto "$persistent_device" "$persistent_mountpoint"
- then
- logging.warn "Mounting $persistent_device, still failing," \
- "creating new filesystem on device"
- $SLX_WRITABLE_DEVICE_STORAGE_FILESYSTEM_CREATE_COMMAND \
- "$persistent_device"
- fi
- if ! mount --type auto "$persistent_device" "$persistent_mountpoint"
- then
- logging.warn "Mounting $persistent_device, still failing," \
- "giving up, and using ramdisk"
- persistent_device=""
- fi
- fi
- if [ -n "$persistent_device" ]; then
- if [ ! -e "$storage_file_path" ]; then
- # Create a sparse file.
- dd of="$storage_file_path" bs=1M \
- seek="$SLX_WRITABLE_DEVICE_STORAGE_MAXIMUM_FILE_SIZE_IN_MB" count=0
- fi
- persistent_device="$(losetup --find)"
- losetup "$persistent_device" "$storage_file_path"
- fi
-fi
-
-# "P" for persistent storage, "N" for not persistent (affects dmsetup call,
-# see scripts/device-add-write-layer.sh)
-persistent='N'
-if [ -n "$persistent_device" ]; then
- writable_device="$persistent_device"
- if [ "$SLX_WRITABLE_DEVICE_PERSISTENT" = "yes" ]; then
- persistent='P'
- fi
-else
- ramdisk_size_in_kb="$SLX_RAMDISK_SIZE_IN_KB"
- if [ "$ramdisk_size_in_kb" = '' ]; then
- ramdisk_size_in_kb="$(awk '/MemTotal/ {print $2}' /proc/meminfo)"
- fi
- # NOTE: If the kernel modul "brd" is compiled into current kernel we can't
- # configure ram disk size dynamically. In this case it have to be
- # configured via kernel command line: "brd.rd_size=SITE_IN_KILOBYTE"
- # statically:
- #! rmmod brd 2>/dev/null
- #modprobe brd max_part=1 rd_size="$ramdisk_size_in_kb"
- #writable_device='/dev/ram0'
- ramdisk_location="$(mktemp)"
- dd of="$ramdisk_location" seek="$ramdisk_size_in_kb" count=0 1>/dev/null
- writable_device="$(losetup --find)"
- losetup "$writable_device" "$ramdisk_location"
-fi
-# endregion
-# region connect dnbd3
-IFS_backup="$IFS"
-IFS=","
-return_code=1
-for host in ${SLX_DNBD3_SERVERS}; do
- logging.info "Trying host \"$host\"."
- if systemd-preserve-process-marker dnbd3-client --host "$host" --image \
- "${SLX_DNBD3_IMAGE}" --device "$SLX_DNBD3_DEVICE" \
- --rid "$SLX_DNBD3_RID"
- then
- return_code=0
- break
- fi
-done
-IFS="$IFS_backup"
-
-if [[ $return_code != 0 ]]; then
- logging.warn "Failed to connect \"${SLX_DNBD3_IMAGE}\" (revision" \
- "\"$SLX_DNBD3_RID\") from one of \"$SLX_DNBD3_SERVERS\" to" \
- "\"$SLX_DNBD3_DEVICE\"."
- exit 1
-fi
-# endregion
-# region scan partitions
-if [ "$SLX_LOG_FILE_PATH" != "" ]; then
- read_only_device="$(container-unpack-xmount "$SLX_DNBD3_DEVICE" \
- 2>>"$SLX_LOG_FILE_PATH")"
-else
- read_only_device="$(container-unpack-xmount "$SLX_DNBD3_DEVICE")"
-fi
-
-
-# Fail fast if no device could be determined.
-[ -z "$read_only_device" ] && exit 1
-# endregion
-# region find read-only partition
-if [ -z "$SLX_SYSTEM_PARTITION_PREPARATION_SCRIPT" ]; then
- if [ -z "$SLX_SYSTEM_PARTITION_IDENTIFIER" ]; then
- # if empty use whole device
- read_only_partition="$read_only_device"
- true
- else
- read_only_partition="$(tools.find_block_device \
- "$SLX_SYSTEM_PARTITION_IDENTIFIER" "$read_only_device")"
- fi
-else
- eval "$SLX_SYSTEM_PARTITION_PREPARATION_SCRIPT"
-fi
-if [[ ! $? || -z "$read_only_partition" ]]; then
- logging.error "Failed to find unique device with identifier" \
- "\"${SLX_SYSTEM_PARTITION_IDENTIFIER}\"; matched devices:" \
- "\"${read_only_partition}\""
- exit 1
-fi
-# endregion
-
-logging.info "Using read-only partition: $read_only_partition"
-logging.info "Using writable device $writable_device, persistency: $persistent"
-
-# combine devices with device mapper
-device-add-write-layer "root" "$read_only_partition" "$writable_device" \
- "$persistent"
-
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
-# region vim modline
-
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/set-dracut-environment-variables.sh b/builder/dnbd3-rootfs/hooks/set-dracut-environment-variables.sh
deleted file mode 100755
index ad80349b..00000000
--- a/builder/dnbd3-rootfs/hooks/set-dracut-environment-variables.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-
-# Set rootok and root as dracut expects them to be set by the module preparing
-# the root filesystem.
-
-# Tell dracut that we parsed the command line and all needed parameters are
-# available.
-rootok=1
-# Tell dracut where the final root fs will be located.
-root=block:/dev/devicemapper/root
-
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/hooks/shutdown-umount.sh b/builder/dnbd3-rootfs/hooks/shutdown-umount.sh
deleted file mode 100644
index 29b52187..00000000
--- a/builder/dnbd3-rootfs/hooks/shutdown-umount.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-source /etc/openslx
-
-umount /oldroot
-dmsetup --noudevsync remove root
-losetup --detach-all
-umount /mnt/*
-dnbd3-client --device "$SLX_DNBD3_DEVICE" --close
diff --git a/builder/dnbd3-rootfs/module-setup.sh b/builder/dnbd3-rootfs/module-setup.sh
deleted file mode 100755
index 549900ad..00000000
--- a/builder/dnbd3-rootfs/module-setup.sh
+++ /dev/null
@@ -1,269 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source "$(dirname "${BASH_SOURCE[0]}")/scripts/rebash/core.sh"
-core.import exceptions
-core.import logging
-core.import utils
-core.import "$(core_abs_path "$(dirname "${BASH_SOURCE[0]}")/scripts/build.sh")"
-# endregion
-# region forward "build-initrfams.sh" logging configuration if present.
-_parse_dracut_args() {
- local __doc__='
- Set log level via dracut logging options and returns current debug state.
-
- >>> echo "$_debug"
- 1
- >>> _parse_dracut_args; echo $?
- 1
-
- >>> _parse_dracut_args --stdlog 3; echo $?
-
- >>> _parse_dracut_args --stdlog 4; echo $?
- >>> logging.get_commands_level
- >>> logging.get_level
- 0
- debug
- debug
-
- >>> logging.get_level
- critical
- >>> _parse_dracut_args --stdlog 4 --verbose
- >>> logging.get_level
- debug
-
- >>> _parse_dracut_args --stdlog 4 --unknown-dracut-option; echo $?
- 0
- '
- local verbose=false
- local debug=false
- while true; do
- case "$1" in
- --stdlog)
- shift
- local level="$1"
- shift
- [[ "$level" -ge 4 ]] && debug=true
- ;;
- --verbose)
- shift
- verbose=true
- ;;
- '')
- break
- ;;
- *)
- shift
- ;;
- esac
- local level
- $verbose && level=info
- $debug && level=debug
- logging.set_level "$level"
- logging.set_commands_level debug
- done
- $debug
- return $?
-}
-_debug=0
-_parse_dracut_args ${dracut_args[*]} || _debug=$?
-# endregion
-clean() {
- local __doc__='
- Removes all compiled kernel specific files.
- NOTE: This method is triggered manually and not supported by dracut itself.
-
- Example:
-
- `clean`
- '
- build_clean_xmount "$moddir/binaries/xmount/"
- build_clean_qemu_xmount "$moddir/binaries/qemu-xmount/"
- build_clean_dnbd3 "$moddir/binaries/dnbd3/"
- build_clean_systemd_preserve_process_marker \
- "$moddir/binaries/systemd-preserve-process-marker/"
- return 0
-}
-# region dracut plugin api
-check() {
- local __doc__='
- Checks wether all template system assumptions are satisfied.
-
- Example:
-
- `check`
- '
- exceptions.activate
- # NOTE: xmount must be compiled before qemu_xmount
- local xmount_is_built=true
- if [[ ! -f "$moddir/binaries/xmount/trunk/build/src/xmount" ]]; then
- if ! build_compile_xmount "$moddir/binaries/xmount/"; then
- xmount_is_built=false
- fi
- fi
- if $xmount_is_built && [[ \
- ! -f "$moddir/binaries/qemu-xmount/libxmount_input_qemu.so" \
- ]]; then
- build_compile_qemu_xmount "$moddir/binaries/qemu-xmount/" || \
- xmount_is_built=false
- fi
- $xmount_is_built || logging.warn \
- "Compiling \"xmount\" failed -> No support for container files (only raw images)."
-
- if [[ ! -f "$moddir/binaries/dnbd3/build/dnbd3.ko" ]] || \
- [[ ! -f "$moddir/binaries/dnbd3/build/dnbd3-client" ]]
- then
- build_compile_dnbd3 "$moddir/binaries/dnbd3/"
- [[ $? != 0 ]] && return 1
- fi
- if [[ ! -f "$moddir/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker" ]]; then
- build_compile_systemd_preserve_process_marker \
- "$moddir/binaries/systemd-preserve-process-marker/"
- [[ $? != 0 ]] && return 1
- fi
- # NOTE: This are workarounds for:
- # - distributions where "systemd-udevd" doesn't lives in "/usr/lib" but in
- # "/lib".
- local alternate_systemd_udevd_location='/lib/systemd/systemd-udevd'
- if [[ ! -f "${systemdutildir}/systemd-udevd" ]] && \
- [[ -f "$alternate_systemd_udevd_location" ]]; then
- mkdir --parents "${initdir}${systemdutildir}"
- ln --symbolic --force "$alternate_systemd_udevd_location" \
- "${initdir}${systemdutildir}/systemd-udevd"
- #cp "$alternate_systemd_udevd_location" \
- # "${initdir}${systemdutildir}/systemd-udevd" 1>&2
- fi
- # - "/usr/bin/sh" isn't available but "/bin/sh".
- if [[ ! -f /usr/bin/sh ]] && [[ -f /bin/sh ]]; then
- ln --symbolic --force /bin/sh /usr/bin/sh
- fi
- exceptions.deactivate
- # Tell dracut that this module should only be included if it is required
- # explicitly.
- return 255
-}
-depends() {
- local __doc__='
- Outputs all dependent dracut modules to make this module work.
-
- >>> depends
- +doc_test_contains
- base
- '
- echo base network bash kernel-modules shutdown
-}
-installkernel() {
- local __doc__='
- Copies all needed kernel modules into initramfs file needed work at
- runtime.
-
- Example:
-
- `installkernel`
- '
- inst "$moddir/binaries/dnbd3/build/dnbd3.ko" \
- /usr/lib/modules/current/extra/dnbd3.ko
- instmods dm_snapshot btrfs crc32c
-}
-install() {
- local __doc__='
- Copies all needed files into the initramfs image and registers all needed
- dracut hooks.
-
- Example:
-
- `install`
- '
- # region binaries
- inst "$moddir/binaries/dnbd3/build/dnbd3-client" /usr/bin/dnbd3-client
- inst "$moddir/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker" \
- /usr/bin/systemd-preserve-process-marker
- inst "$moddir/scripts/device-add-write-layer.sh" \
- /usr/bin/device-add-write-layer
- inst "$moddir/scripts/container-unpack-xmount.sh" \
- /usr/bin/container-unpack-xmount
- # xmount
- local \
- xmount_installation="$moddir/binaries/xmount/trunk/build/release_build"
- inst "${xmount_installation}/usr/bin/xmount" /usr/bin/xmount
- for file in ${xmount_installation}/usr/lib/xmount/*; do
- inst "$file" /usr/lib/xmount/"$(basename "$file")"
- done
- inst "$moddir/binaries/qemu-xmount/libxmount_input_qemu.so" \
- /usr/lib/xmount/libxmount_input_qemu.so
- # endregion
- # region hooks
- inst_hook cmdline 00 "$moddir/hooks/enable-sysrq.sh"
- # NOTE: Can be used to support old style ip append syntax and have an
- # exclusive interface name.
- inst_hook cmdline 10 \
- "$moddir/hooks/prepare-kernel-command-line-parameter.sh"
- inst_hook cmdline 90 "$moddir/hooks/set-dracut-environment-variables.sh"
- inst_hook pre-udev 00 "$moddir/hooks/load-custom-kernel-modules.sh"
- # Get the openslx config from the servers configured in the kernel command
- # line (${SLX_SERVER}/${SLX_SERVER_BASE}/config).
- inst_hook pre-mount 00 "$moddir/hooks/fetch-config.sh"
- # make the final blockdevice for the root system (dnbd3 -> xmount ->
- # device-mapper)
- if dracut_module_included "systemd-initrd"; then
- inst "$moddir/hooks/prepare-root-partition.sh" \
- /usr/bin/dnbd3root
- inst_simple "${moddir}/services/dnbd3root.service" \
- "${systemdsystemunitdir}/dnbd3root.service"
- mkdir --parents \
- "${initdir}/${systemdsystemunitdir}/dracut-mount.service.requires"
- ln_r "${systemdsystemunitdir}/dnbd3root.service" \
- "${systemdsystemunitdir}/dracut-mount.service.requires/dnbd3root.service"
- mkdir --parents \
- "${initdir}/${systemdsystemunitdir}/initrd.target.requires"
- ln_r "${systemdsystemunitdir}/dnbd3root.service" \
- "${systemdsystemunitdir}/initrd.target.requires/dnbd3root.service"
- # Copy systemd services to new root (so they don't get killed after
- # switch_root)
- inst_hook pre-pivot 00 \
- "$moddir/hooks/copy-dnbd3-service-into-newroot.sh"
- inst_hook pre-pivot 00 \
- "$moddir/hooks/copy-dracut-systemd-files-into-newroot.sh"
- inst_hook pre-shutdown 00 "$moddir/hooks/shutdown-umount.sh"
- else
- inst_hook pre-mount 10 "$moddir/hooks/prepare-root-partition.sh"
- fi
- inst_hook mount 10 "$moddir/hooks/mount-root-device.sh"
- inst_hook pre-pivot 00 \
- "$moddir/hooks/copy-openslx-configuration-into-newroot.sh"
- # endregion
- # region scripts
- local file_path
- for file_path in "$moddir/scripts/rebash/"*; do
- inst "$file_path" "/usr/lib/rebash/$(basename "$file_path")"
- done
- inst "$moddir/scripts/tools.sh" "/usr/lib/openslx/tools.sh"
- # endregion
- # region configuration files
- # Use terminal readline settings from the template system.
- inst /etc/inputrc /etc/inputrc
- # Set some aliases for the initramfs context.
- if [[ "$_debug" == 0 ]]; then
- inst "$moddir/configuration/bash" '/etc/bash.bashrc'
- inst "$moddir/configuration/bash" '/etc/profile.d/aliases'
- fi
- # endregion
- inst_multiple \
- awk \
- basename bash blockdev \
- cat cut \
- dd diff dirname dmsetup \
- find fsck.ext4 \
- grep \
- insmod \
- losetup lsblk \
- mkfifo mkfs.ext4 mktemp mount mountpoint \
- sed sleep sort \
- tee touch tr \
- wget
-}
-# endregion
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/scripts/build.sh b/builder/dnbd3-rootfs/scripts/build.sh
deleted file mode 100644
index 47e5dcc7..00000000
--- a/builder/dnbd3-rootfs/scripts/build.sh
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# shellcheck source=./rebash/core.sh
-source "$(dirname "${BASH_SOURCE[0]}")/rebash/core.sh"
-core.import logging
-
-build_compile_qemu_xmount() {
- local __doc__='
- Compiles qemu libxmount.
- NOTE: expects xmount installation under
- $1/../xmount/trunk/build/release_build/
-
- Provides the following file:
- "$1/libxmount_input_qemu.so"
-
- Example:
-
- `build_compile_qemu_xmount /qemu_source /xmount/installation`
- '
- pushd "$1"
- local xmount_installation="../xmount/trunk/build/release_build/usr"
- [ ! -z "$2" ] && xmount_installation="$2"
- ./configure --enable-xmount-input --python="$(which python2)" \
- --extra-cflags="-fPIC" \
- --extra-cflags="-std=gnu99" \
- --extra-cflags="-I${xmount_installation}/include" \
- --extra-cflags="-I${xmount_installation}/include/xmount" \
- --disable-fdt --target-list=""
- make -j4 libxmount_input_qemu.so
- local ret=$?
- popd
- return $ret
-}
-build_clean_qemu_xmount() {
- local __doc__='Clean the build of `build_compile_qemu_xmount`.'
- pushd "$1"
- make clean
- popd
- return $?
-}
-build_compile_xmount() {
- local __doc__='
- Compiles xmount.
-
- Provides the xmount installation under:
- "$1/trunk/build/release_build/"
-
- Example:
-
- `build_compile_xmount /xmount_source /xmount_source/build /usr`
- '
- pushd "$1"
-
- local destination_directory="./release_build"
- [ ! -z "$2" ] && destination_directory="$2"
- local install_prefix="/usr"
- [ ! -z "$3" ] && install_prefix="$3"
-
- mkdir --parents trunk/build
- cd trunk/build || return 1
- cmake -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX="$install_prefix" ..
- make -j4
- make install DESTDIR="$destination_directory"
- local ret=$?
- popd
- return $ret
-}
-build_clean_xmount() {
- local __doc__='Clean the build of `build_compile_xmount`.'
- rm --recursive --force "$1/trunk/build"
-}
-build_compile_dnbd3() {
- local __doc__='
- Compiles dnbd3 kernel module and client.
-
- Provides the following file:
- "$1/build/dnbd3.ko"
- "$1/build/dnbd3-client"
-
- Examples:
-
- `build_compile_dnbd3 path/to/dnbd3/source/`
- '
- pushd "$1"
- # NOTE: The generic way would be: "./build.sh" but this tries to build
- # more than we really need and takes more time.
- mkdir --parents build
- pushd build
- cmake ../
- make -j4 dnbd3 dnbd3-client
- popd
- return $?
-}
-build_clean_dnbd3() {
- local __doc__='Clean the build of `build_compile_dnbd3`.'
- rm --recursive --force "$1/build"
- return $?
-}
-build_compile_systemd_preserve_process_marker() {
- local __doc__='
- Compiles simple c program.
-
- Examples:
-
- `build_compile_systemd_preserve_process_marker path/to/program/folder`
- '
- pushd "$1"
- make
- popd
- return $?
-}
-build_clean_systemd_preserve_process_marker() {
- local __doc__='
- Clean the build of
- `build_compile_systemd_preserve_process_marker`.
- '
- pushd "$1"
- make clean
- popd
- return $?
-}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/scripts/container-unpack-qemu.sh b/builder/dnbd3-rootfs/scripts/container-unpack-qemu.sh
deleted file mode 100755
index 53fd73dc..00000000
--- a/builder/dnbd3-rootfs/scripts/container-unpack-qemu.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source "/usr/lib/rebash/core.sh"
-core.import exceptions
-exceptions.activate
-# endregion
-
-in_device="$1"
-nbd_device="$2" # TODO detect first free nbd device
-
-systemd-preserve-process-marker qemu-nbd --connect="$nbd_device" \
- "$in_device" --read-only --persistent --nocache
-
-# TODO better way to wait for the device to be made?
-i=0
-while [ ! -b "$nbd_device" ]; do
- [ $i -ge 20 ] && exit 1
- if [ $UDEVVERSION -ge 143 ]; then
- udevadm settle --exit-if-exists="$nbd_device"
- else
- sleep 0.1
- fi
- i=$(($i + 1))
-done
-
-# NBD doesn't emit uevents when it gets connected, so kick it
-# TODO get path from $nbd_device
-echo change > /sys/block/nbd0/uevent
-udevadm settle
-
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/scripts/container-unpack-xmount.sh b/builder/dnbd3-rootfs/scripts/container-unpack-xmount.sh
deleted file mode 100755
index c7e1b45c..00000000
--- a/builder/dnbd3-rootfs/scripts/container-unpack-xmount.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-source '/usr/lib/rebash/core.sh'
-core.import logging
-core.import utils
-core.import exceptions
-exceptions.activate
-# endregion
-logging.set_level info
-logging.set_commands_level info
-
-# NOTE: All output has to be forwarded to standard error because determined
-# device should be printed on standard output.
-in_device="$1"
-mkdir --parents /mnt/xmount
-loop_device="$(losetup --find)"
-if ! utils.dependency_check xmount; then
- logging.warn "\"xmount\" not found, assuming raw image." 1>&2
-elif systemd-preserve-process-marker xmount --in qemu "$in_device" --out raw \
- /mnt/xmount &>/dev/null
-then
- in_device="/mnt/xmount/*.dd"
-else
- logging.warn "\"xmount\" call failed, assuming raw image." 1>&2
-fi
-losetup "$loop_device" $in_device --partscan
-udevadm settle
-echo "$loop_device"
-
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/scripts/device-add-write-layer.sh b/builder/dnbd3-rootfs/scripts/device-add-write-layer.sh
deleted file mode 100755
index 2e4116a7..00000000
--- a/builder/dnbd3-rootfs/scripts/device-add-write-layer.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-# shellcheck source=./rebash/core.sh
-source "/usr/lib/rebash/core.sh"
-core.import exceptions
-exceptions.activate
-# endregion
-
-combined_device_name="$1"
-read_only_device="$2"
-writable_device="$3"
-persistent="$4" # P or N
-chunksize='1'
-
-partition_size="$(blockdev --getsz "$read_only_device")"
-writable_partition_name='root'
-modprobe dm_snapshot
-dmsetup create "$combined_device_name" --noudevsync --table \
- "0 $partition_size snapshot $read_only_device $writable_device $persistent $chunksize"
-dmsetup mknodes --noudevsync "$combined_device_name"
-
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/scripts/rebash b/builder/dnbd3-rootfs/scripts/rebash
deleted file mode 160000
-Subproject 6ca5b39c862aed6a13146f4121fb51f784b1eb4
diff --git a/builder/dnbd3-rootfs/scripts/tools.sh b/builder/dnbd3-rootfs/scripts/tools.sh
deleted file mode 100644
index bace775e..00000000
--- a/builder/dnbd3-rootfs/scripts/tools.sh
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
-# shellcheck source=./rebash/core.sh
-source "/usr/lib/rebash/core.sh"
-core.import logging
-# endregion
-tools__doc_test_setup__='
-lsblk() {
- if [[ "${@: -1}" == "" ]];then
- echo "lsblk: : not a block device"
- return 1
- fi
- if [[ "${@: -1}" != "/dev/sdb" ]];then
- echo "/dev/sda disk"
- echo "/dev/sda1 part SYSTEM_LABEL 0x7"
- echo "/dev/sda2 part"
- fi
- if [[ "${@: -1}" != "/dev/sda" ]];then
- echo "/dev/sdb disk"
- echo "/dev/sdb1 part boot_partition "
- echo "/dev/sdb2 part system_partition"
- fi
-}
-blkid() {
- [[ "${@: -1}" != "/dev/sda2" ]] && return 0
- echo "gpt"
- echo "only discoverable by blkid"
- echo "boot_partition"
- echo "192d8b9e"
-}
-sleep() {
- ((_test_sleep_time++))
-}
-'
-
-tools_find_block_device() {
- # shellcheck disable=SC2034,SC2016
- local __doc__='
- >>> tools.find_block_device "boot_partition"
- /dev/sdb1
- >>> tools.find_block_device "boot_partition" /dev/sda
- /dev/sda2
- >>> tools.find_block_device "discoverable by blkid"
- /dev/sda2
- >>> tools.find_block_device "_partition"
- /dev/sdb1 /dev/sdb2
- >>> tools.find_block_device "not matching anything"; echo $?
- 1
- >>> tools.find_block_device ""; echo $?
- 1
-
- >>> local _test_sleep_time=0
- >>> tools.find_block_device "not matching anything" /dev/sda 10; echo $?
- >>> echo $_test_sleep_time
- 1
- 10
- '
- local partition_pattern="$1"
- [ "$partition_pattern" = '' ] && return 1
- local device="$2"
- local timeout=0
- [ ! -z "$3" ] && timeout="$3"
- tools_find_block_device_simple() {
- local device_info
- lsblk --noheadings --list --paths --output \
- NAME,TYPE,LABEL,PARTLABEL,UUID,PARTUUID ${device:+"$device"} \
- | sort --unique | while read -r device_info; do
- local current_device
- current_device=$(echo "$device_info" | cut -d' ' -f1)
- if [[ "$device_info" = *"${partition_pattern}"* ]]; then
- echo "$current_device"
- fi
- done
- }
- tools_find_block_device_deep() {
- local device_info
- lsblk --noheadings --list --paths --output NAME ${device:+"$device"} \
- | sort --unique | cut -d' ' -f1 | while read -r current_device; do
- blkid -p -o value "$current_device" \
- | while read -r device_info; do
- if [[ "$device_info" = *"${partition_pattern}"* ]]; then
- echo "$current_device"
- fi
- done
- done
- }
- while ((timeout >= 0)); do
- local candidates
- candidates=($(tools_find_block_device_simple))
- (( ${#candidates[@]} == 0 )) && candidates=($(tools_find_block_device_deep))
- (( ${#candidates[@]} > 1 )) && echo "${candidates[@]}" && return 1
- (( ${#candidates[@]} == 1 )) && echo "${candidates[0]}" && return 0
- ((timeout == 0)) || sleep 1
- ((timeout--))
- done
- # no candidates
- return 1
-}
-alias tools.find_block_device="tools_find_block_device"
-
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/builder/dnbd3-rootfs/services/dnbd3root.service b/builder/dnbd3-rootfs/services/dnbd3root.service
deleted file mode 100644
index 592b049d..00000000
--- a/builder/dnbd3-rootfs/services/dnbd3root.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=root fs on dnbd3 (distributed network block device)
-After=dracut-pre-mount.service network.target
-Before=dracut-mount.service
-DefaultDependencies=no
-IgnoreOnIsolate=true
-#OnFailure=emergency.target
-#Conflicts=shutdown.target
-#ConditionKernelCommandLine=!
-#ConditionPathExists=/etc/multipath.conf
-
-[Service]
-Type=oneshot
-RemainAfterExit=true
-KillMode=none
-ExecStart=/usr/bin/dnbd3root
-#ExecStop=echo 'stopping dnbd3'
diff --git a/builder/dnbd3-rootfs/udev/70-openslx-disk.rules b/builder/dnbd3-rootfs/udev/70-openslx-disk.rules
deleted file mode 100644
index 9aad9a41..00000000
--- a/builder/dnbd3-rootfs/udev/70-openslx-disk.rules
+++ /dev/null
@@ -1,7 +0,0 @@
-# GPT rules
-KERNEL=="sd?[0-9]" SUBSYSTEM=="block" ENV{ID_PART_TABLE_TYPE}=="gpt" ENV{ID_PART_ENTRY_NAME}=="OPENSLX_TMP" RUN+="/sbin/prepare-persistent-disks %E{ID_PART_ENTRY_NAME} %k"
-KERNEL=="sd?[0-9]" SUBSYSTEM=="block" ENV{ID_PART_TABLE_TYPE}=="gpt" ENV{ID_PART_ENTRY_NAME}=="OPENSLX_SYS" RUN+="/sbin/prepare-persistent-disks %E{ID_PART_ENTRY_NAME} %k"
-
-# MBR rules
-KERNEL=="sd?[0-9]" SUBSYSTEM=="block" ENV{ID_PART_TABLE_TYPE}=="dos" ENV{ID_PART_ENTRY_TYPE}=="0x44" RUN+="/sbin/prepare-persistent-disks OPENSLX_TMP %k"
-KERNEL=="sd?[0-9]" SUBSYSTEM=="block" ENV{ID_PART_TABLE_TYPE}=="dos" ENV{ID_PART_ENTRY_TYPE}=="0x46" RUN+="/sbin/prepare-persistent-disks OPENSLX_SYS %k"