diff options
author | CoprDistGit <infra@openeuler.org> | 2023-09-19 03:22:19 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-09-19 03:22:19 +0000 |
commit | bb2d27c6843d99793e50a67e20e64852c3dd4d85 (patch) | |
tree | 74f3f8647e43cc7f39873fb2ba713cebe9862c1d | |
parent | ff3056a5eddb9b203fdd900eeecc0771d981d138 (diff) |
automatic import of dracutopeneuler20.03
23 files changed, 2398 insertions, 0 deletions
@@ -0,0 +1 @@ +/dracut-055.tar.xz diff --git a/add-option-to-include-file-metadata-in-initramfs.patch b/add-option-to-include-file-metadata-in-initramfs.patch new file mode 100644 index 0000000..8b90265 --- /dev/null +++ b/add-option-to-include-file-metadata-in-initramfs.patch @@ -0,0 +1,79 @@ +From 9d267e664c6f95a7b940c5706643b055623a39d7 Mon Sep 17 00:00:00 2001 +From: Anakin Zhang <benjamin93@163.com> +Date: Thu, 2 Jul 2020 14:46:51 +0800 +Subject: [PATCH] add option to include file metadata in initramfs + +Signed-off-by: Anakin Zhang <benjamin93@163.com> +--- + dracut.sh | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index 60ac46f..bab91ca 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -246,6 +246,9 @@ Creates initial ramdisk images for preloading modules + --kernel-image [FILE] location of the kernel image + --regenerate-all Regenerate all initramfs images at the default location + for the kernel versions found on the system ++ -e, --file-metadata [TYPE] ++ Include file metadata in the initramfs. Specify "xattr" ++ to include file extended attributes. + --version Display version + + If [LIST] has multiple arguments, then you have to put these in quotes. +@@ -341,7 +344,7 @@ rearrange_params() { + TEMP=$( + unset POSIXLY_CORRECT + getopt \ +- -o "a:m:o:d:I:k:c:r:L:fvqlHhMN" \ ++ -o "a:m:o:d:I:k:c:r:L:fvqlHhMNe:" \ + --long kver: \ + --long add: \ + --long force-add: \ +@@ -432,6 +435,7 @@ rearrange_params() { + --long hostonly-i18n \ + --long hostonly-nics: \ + --long no-machineid \ ++ --long file-metadata: \ + --long version \ + -- "$@" + ) +@@ -800,6 +804,8 @@ while :; do + --no-machineid) + machine_id_l="no" + ;; ++ -e|--file-metadata) ++ file_metadata_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;; + --version) + long_version + exit 1 +@@ -998,6 +1004,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) + [[ $uefi_splash_image_l ]] && uefi_splash_image="$uefi_splash_image_l" + [[ $kernel_image_l ]] && kernel_image="$kernel_image_l" + [[ $machine_id_l ]] && machine_id="$machine_id_l" ++[[ $file_metadata_l ]] && file_metadata_opt="-e $file_metadata_l" + + if ! [[ $outfile ]]; then + if [[ $machine_id != "no" ]]; then +@@ -2324,7 +2331,7 @@ if [[ $create_early_cpio == yes ]]; then + cd "$early_cpio_dir/d" + find . -print0 | sort -z \ + | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null \ +- ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img" ++ ${cpio_owner:+-R "$cpio_owner"} -H newc $file_metadata_opt -o --quiet > "${DRACUT_TMPDIR}/initramfs.img" + ); then + dfatal "dracut: creation of $outfile failed" + exit 1 +@@ -2382,7 +2389,7 @@ if ! ( + umask 077 + cd "$initdir" + find . -print0 | sort -z \ +- | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet \ ++ | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null ${cpio_owner:+-R "$cpio_owner"} -H newc $file_metadata_opt -o --quiet \ + | $compress >> "${DRACUT_TMPDIR}/initramfs.img" + ); then + dfatal "dracut: creation of $outfile failed" +-- +1.8.3.1 + diff --git a/backport-Bring-back-51-dracut-rescue-postinst.sh.patch b/backport-Bring-back-51-dracut-rescue-postinst.sh.patch new file mode 100644 index 0000000..c2f071b --- /dev/null +++ b/backport-Bring-back-51-dracut-rescue-postinst.sh.patch @@ -0,0 +1,91 @@ +From 819ea3865161d440353b2f961f3dfeaabeed333d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer <harald@redhat.com> +Date: Thu, 26 Jul 2018 12:49:45 +0200 +Subject: [PATCH] Bring back 51-dracut-rescue-postinst.sh + +can only be obsoleted after F30 + +Reference:https://github.com/dracutdevs/dracut/commit/819ea3865161d440353b2f961f3dfeaabeed333d +Conflict:delete contents of dracut.spec +--- + 51-dracut-rescue-postinst.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) + create mode 100755 51-dracut-rescue-postinst.sh + +diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh +new file mode 100755 +index 0000000..67f5b71 +--- /dev/null ++++ b/51-dracut-rescue-postinst.sh +@@ -0,0 +1,68 @@ ++#!/bin/bash ++ ++export LANG=C ++ ++KERNEL_VERSION="$1" ++KERNEL_IMAGE="$2" ++ ++[[ -f /etc/os-release ]] && . /etc/os-release ++ ++if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then ++ systemd-machine-id-setup ++fi ++ ++[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id ++ ++[[ $MACHINE_ID ]] || exit 1 ++[[ -f $KERNEL_IMAGE ]] || exit 1 ++ ++INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img" ++NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}" ++ ++[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0 ++ ++dropindirs_sort() ++{ ++ suffix=$1; shift ++ args=("$@") ++ files=$( ++ while (( $# > 0 )); do ++ for i in ${1}/*${suffix}; do ++ [[ -f $i ]] && echo ${i##*/} ++ done ++ shift ++ done | sort -Vu ++ ) ++ ++ for f in $files; do ++ for d in "${args[@]}"; do ++ if [[ -f "$d/$f" ]]; then ++ echo "$d/$f" ++ continue 2 ++ fi ++ done ++ done ++} ++ ++# source our config dir ++for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do ++ [[ -e $f ]] && . "$f" ++done ++ ++[[ $dracut_rescue_image != "yes" ]] && exit 0 ++ ++if [[ ! -f $INITRDFILE ]]; then ++ dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION" ++ ((ret+=$?)) ++fi ++ ++if [[ ! -f $NEW_KERNEL_IMAGE ]]; then ++ cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE" ++ ((ret+=$?)) ++fi ++ ++new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID" ++ ++((ret+=$?)) ++ ++exit $ret +-- +1.8.3.1 + diff --git a/backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch b/backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch new file mode 100644 index 0000000..b4ccd97 --- /dev/null +++ b/backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch @@ -0,0 +1,54 @@ +From 1af46743195422aaebcde5c508a5dd479eff51ea Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Fri, 10 Dec 2021 12:51:26 -0600 +Subject: [PATCH] feat(lvm): only run lvchange for LV that is seen on devices + +Change the command listing LVs from lvscan to lvs, and list +only the LV names that are being activated. Before attempting +to activate an LV, check that that LV name appears in the +lvs command output. This avoids wasting time running an +lvchange command that we know will fail. +--- + modules.d/90lvm/lvm_scan.sh | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index bda265f..89f077a 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -119,7 +119,7 @@ sub=${sub%%\(*} + # ignores locking failures (--ignorelockingfailure) + # disables hints (--nohints) + # +-# For lvscan and vgscan: ++# For lvs and vgscan: + # disable locking (--nolocking) + # disable hints (--nohints) + +@@ -136,10 +136,20 @@ check_lvm_ver 2 3 14 "$maj" "$min" "$sub" \ + if [ -n "$LVS" ]; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" + # shellcheck disable=SC2086 +- lvm lvscan $scan_args 2>&1 | vinfo ++ LVSLIST=$(lvm lvs $scan_args --noheading -o lv_full_name,segtype $LVS) ++ info "$LVSLIST" ++ ++ # Only attempt to activate an LV if it appears in the lvs output. + for LV in $LVS; do +- # shellcheck disable=SC2086 +- lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo ++ if strstr "$LVSLIST" "$LV"; then ++ # This lvchange is expected to fail if all PVs used by ++ # the LV are not yet present. Premature/failed lvchange ++ # could be avoided by reporting if an LV is complete ++ # from the lvs command above and skipping this lvchange ++ # if the LV is not lised as complete. ++ # shellcheck disable=SC2086 ++ lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo ++ fi + done + fi + +-- +1.8.3.1 + diff --git a/backport-feat-lvm-update-lvm-command-options.patch b/backport-feat-lvm-update-lvm-command-options.patch new file mode 100644 index 0000000..2ff0c37 --- /dev/null +++ b/backport-feat-lvm-update-lvm-command-options.patch @@ -0,0 +1,83 @@ +From c0a54f2993b1d3c2101202c274a41f925445d54b Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Wed, 8 Dec 2021 14:43:58 -0600 +Subject: [PATCH] feat(lvm): update lvm command options + +Drop checking for options that have been available for +at least ten years. This simplifies code maintenance. + +Add the new --nohints option (when available) to disable +the use of hints which is not useful during startup. +--- + modules.d/90lvm/lvm_scan.sh | 41 ++++++++++++++++++++++------------------- + 1 file changed, 22 insertions(+), 19 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index 8038240..00143bf 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -59,39 +59,42 @@ min=$2 + sub=${3%% *} + sub=${sub%%\(*} + +-lvm_ignorelockingfailure="--ignorelockingfailure" +-lvm_quirk_args="--ignorelockingfailure --ignoremonitoring" +- +-check_lvm_ver 2 2 57 "$maj" "$min" "$sub" \ +- && lvm_quirk_args="$lvm_quirk_args --poll n" +- +-if check_lvm_ver 2 2 65 "$maj" "$min" "$sub"; then +- lvm_quirk_args=" --sysinit $extraargs" +-fi +- +-if check_lvm_ver 2 2 221 "$maj" "$min" "$sub"; then +- lvm_quirk_args=" $extraargs" +- unset lvm_ignorelockingfailure +-fi +- ++# For lvchange and vgchange use --sysinit which: ++# disables polling (--poll n) ++# ignores monitoring (--ignoremonitoring) ++# ignores locking failures (--ignorelockingfailure) ++# disables hints (--nohints) ++# ++# For lvscan and vgscan: ++# disable locking (--nolocking) ++# disable hints (--nohints) ++ ++activate_args="--sysinit $extraargs" + unset extraargs + + export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 + ++scan_args="--nolocking" ++ ++check_lvm_ver 2 3 14 "$maj" "$min" "$sub" \ ++ && scan_args="$scan_args --nohints" ++ + if [ -n "$LVS" ]; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" +- lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo ++ # shellcheck disable=SC2086 ++ lvm lvscan $scan_args 2>&1 | vinfo + for LV in $LVS; do + # shellcheck disable=SC2086 +- lvm lvchange --yes -K -ay $lvm_quirk_args "$LV" 2>&1 | vinfo ++ lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo + done + fi + + if [ -z "$LVS" ] || [ -n "$VGS" ]; then + info "Scanning devices $lvmdevs for LVM volume groups $VGS" +- lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo + # shellcheck disable=SC2086 +- lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo ++ lvm vgscan $scan_args 2>&1 | vinfo ++ # shellcheck disable=SC2086 ++ lvm vgchange -ay $activate_args $VGS 2>&1 | vinfo + fi + + if [ "$lvmwritten" ]; then +-- +1.8.3.1 + diff --git a/backport-feat-lvm-use-generated-filter-when-none-is-set.patch b/backport-feat-lvm-use-generated-filter-when-none-is-set.patch new file mode 100644 index 0000000..d3da481 --- /dev/null +++ b/backport-feat-lvm-use-generated-filter-when-none-is-set.patch @@ -0,0 +1,141 @@ +From 7ffc5e388bcce20785803825bdd260c3c854b34f Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Wed, 8 Dec 2021 15:16:03 -0600 +Subject: [PATCH] feat(lvm): use generated filter when none is set + +Previously, the lvm device filter generated by dracut +would not be used if any lvm.conf file existed in the +initrd. Change this so that the generated filter will +be used when the included lvm.conf has no filter set. +--- + modules.d/90lvm/lvm_scan.sh | 91 +++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 75 insertions(+), 16 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index 00143bf..bda265f 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -10,6 +10,7 @@ LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=) + + # shellcheck disable=SC2174 + [ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm ++[ -d /run/lvm ] || mkdir -m 0755 -p /run/lvm + # build a list of devices to scan + lvmdevs=$( + for f in /tmp/.lvm_scan-*; do +@@ -18,22 +19,6 @@ lvmdevs=$( + done + ) + +-if [ ! -e /etc/lvm/lvm.conf ]; then +- { +- echo 'devices {' +- printf ' filter = [ ' +- for dev in $lvmdevs; do +- printf '"a|^/dev/%s$|", ' "$dev" +- done +- echo '"r/.*/" ]' +- echo '}' +- +- echo 'global {' +- echo '}' +- } > /etc/lvm/lvm.conf +- lvmwritten=1 +-fi +- + check_lvm_ver() { + maj=$1 + min=$2 +@@ -47,6 +32,75 @@ check_lvm_ver() { + return 1 + } + ++no_lvm_conf_filter() { ++ if [ ! -e /etc/lvm/lvm.conf ]; then ++ return 0 ++ fi ++ ++ if [ -e /run/lvm/initrd_no_filter ]; then ++ return 0 ++ fi ++ ++ if [ -e /run/lvm/initrd_filter ]; then ++ return 1 ++ fi ++ ++ if [ -e /run/lvm/initrd_global_filter ]; then ++ return 1 ++ fi ++ ++ # Save lvm config results in /run to avoid running ++ # lvm config commands for every PV that's scanned. ++ ++ filter=$(lvm config devices/filter | grep "$filter=") ++ if [ -n "$filter" ]; then ++ printf '%s\n' "$filter" > /run/lvm/initrd_filter ++ return 1 ++ fi ++ ++ global_filter=$(lvm config devices/global_filter | grep "$global_filter=") ++ if [ -n "$global_filter" ]; then ++ printf '%s\n' "$global_filter" > /run/lvm/initrd_global_filter ++ return 1 ++ fi ++ ++ # /etc/lvm/lvm.conf exists with no filter setting ++ true > /run/lvm/initrd_no_filter ++ return 0 ++} ++ ++# If no lvm.conf exists, create a basic one with a global section. ++if [ ! -e /etc/lvm/lvm.conf ]; then ++ { ++ echo 'global {' ++ echo '}' ++ } > /etc/lvm/lvm.conf ++ lvmwritten=1 ++fi ++ ++# Save the original lvm.conf before appending a filter setting. ++if [ ! -e /etc/lvm/lvm.conf.orig ]; then ++ cp /etc/lvm/lvm.conf /etc/lvm/lvm.conf.orig ++fi ++ ++# If the original lvm.conf does not contain a filter setting, ++# then generate a filter and append it to the original lvm.conf. ++# The filter is generated from the list PVs that have been seen ++# so far (each has been processed by the lvm udev rule.) ++if no_lvm_conf_filter; then ++ { ++ echo 'devices {' ++ printf ' filter = [ ' ++ for dev in $lvmdevs; do ++ printf '"a|^/dev/%s$|", ' "$dev" ++ done ++ echo '"r/.*/" ]' ++ echo '}' ++ } > /etc/lvm/lvm.conf.filter ++ lvmfilter=1 ++ cat /etc/lvm/lvm.conf.orig /etc/lvm/lvm.conf.filter > /etc/lvm/lvm.conf ++fi ++ + # hopefully this output format will never change, e.g.: + # LVM version: 2.02.53(1) (2009-09-25) + OLDIFS=$IFS +@@ -99,8 +153,13 @@ fi + + if [ "$lvmwritten" ]; then + rm -f -- /etc/lvm/lvm.conf ++elif [ "$lvmfilter" ]; then ++ # revert filter that was appended to existing lvm.conf ++ cp /etc/lvm/lvm.conf.orig /etc/lvm/lvm.conf ++ rm -f -- /etc/lvm/lvm.conf.filter + fi + unset lvmwritten ++unset lvmfilter + + udevadm settle + +-- +1.8.3.1 + diff --git a/backport-fix-dracut-shutdown-add-cleanup-handler-on-failure.patch b/backport-fix-dracut-shutdown-add-cleanup-handler-on-failure.patch new file mode 100644 index 0000000..23bbda6 --- /dev/null +++ b/backport-fix-dracut-shutdown-add-cleanup-handler-on-failure.patch @@ -0,0 +1,96 @@ +From 7ab1d00227cad6f1b86ba01fdc766769faebb031 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com> +Date: Thu, 13 Jan 2022 17:35:59 +0100 +Subject: [PATCH] fix(dracut-shutdown): add cleanup handler on failure + +It may happen that dracut-shutdown.service fails, for example on timeout +due to very low bandwidth. +In such case, for hardening purposes, a new dracut-shutdown-onfailure.service +unit doing dracut-shutdown.service cleanup needs to execute to make sure +switching root to an incomplete initramfs won't occur later. + +See also RHBZ #1924587 (https://bugzilla.redhat.com/show_bug.cgi?id=1924587). + +Reference:https://github.com/dracutdevs/dracut/commit/7ab1d00227cad6f1b86ba01fdc766769faebb031 +Conflict:NA +--- + Makefile | 1 + + .../dracut-shutdown-onfailure.service | 13 +++++++++++++ + modules.d/98dracut-systemd/dracut-shutdown.service | 1 + + .../98dracut-systemd/dracut-shutdown.service.8.asc | 3 +++ + pkgbuild/dracut.spec | 1 + + 5 files changed, 19 insertions(+) + create mode 100644 modules.d/98dracut-systemd/dracut-shutdown-onfailure.service + +diff --git a/Makefile b/Makefile +index 85e1020a..ab47fed8 100644 +--- a/Makefile ++++ b/Makefile +@@ -178,6 +178,7 @@ ifneq ($(enable_documentation),no) + endif + if [ -n "$(systemdsystemunitdir)" ]; then \ + mkdir -p $(DESTDIR)$(systemdsystemunitdir); \ ++ ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown-onfailure.service; \ + ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \ + mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \ + ln -s ../dracut-shutdown.service \ +diff --git a/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service b/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service +new file mode 100644 +index 00000000..96de58c5 +--- /dev/null ++++ b/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service +@@ -0,0 +1,13 @@ ++# This file is part of dracut. ++# ++# See dracut.bootup(7) for details ++ ++[Unit] ++Description=Service executing upon dracut-shutdown failure to perform cleanup ++Documentation=man:dracut-shutdown.service(8) ++DefaultDependencies=no ++ ++[Service] ++Type=oneshot ++ExecStart=-/bin/rm /run/initramfs/shutdown ++StandardError=null +diff --git a/modules.d/98dracut-systemd/dracut-shutdown.service b/modules.d/98dracut-systemd/dracut-shutdown.service +index 81043b2d..7c36f14f 100644 +--- a/modules.d/98dracut-systemd/dracut-shutdown.service ++++ b/modules.d/98dracut-systemd/dracut-shutdown.service +@@ -10,6 +10,7 @@ Wants=local-fs.target + Conflicts=shutdown.target umount.target + DefaultDependencies=no + ConditionPathExists=!/run/initramfs/bin/sh ++OnFailure=dracut-shutdown-onfailure.service + + [Service] + RemainAfterExit=yes +diff --git a/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc b/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc +index ba80b187..21ec88ca 100644 +--- a/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc ++++ b/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc +@@ -40,6 +40,9 @@ by injecting "rd.break=pre-shutdown rd.shell" or "rd.break=shutdown rd.shell". + # touch /run/initramfs/.need_shutdown + ---- + ++In case the unpack of the initramfs fails, dracut-shutdown-onfailure.service ++executes to make sure switch root doesn't happen, since it would result in ++switching to an incomplete initramfs. + + AUTHORS + ------- +diff --git a/pkgbuild/dracut.spec b/pkgbuild/dracut.spec +index f94cbb3e..eca626bd 100644 +--- a/pkgbuild/dracut.spec ++++ b/pkgbuild/dracut.spec +@@ -416,6 +416,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ + %dir %{_sharedstatedir}/initramfs + %if %{defined _unitdir} + %{_unitdir}/dracut-shutdown.service ++%{_unitdir}/dracut-shutdown-onfailure.service + %{_unitdir}/sysinit.target.wants/dracut-shutdown.service + %{_unitdir}/dracut-cmdline.service + %{_unitdir}/dracut-initqueue.service +-- +2.33.0 + diff --git a/backport-fix-lvm-replace-partial-option.patch b/backport-fix-lvm-replace-partial-option.patch new file mode 100644 index 0000000..c1a687d --- /dev/null +++ b/backport-fix-lvm-replace-partial-option.patch @@ -0,0 +1,30 @@ +From 97543cca48dfde849396f11c83f9c320e1b91c46 Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Wed, 8 Dec 2021 14:14:27 -0600 +Subject: [PATCH] fix(lvm): replace --partial option + +The --partial option will activate a linear (or other) LV +without segments for missing devices, which is unlikely to +be useful. The intention was to activate raid LVs in a useful +form while missing devices, which is specified with the option +--activationmode degraded. +--- + modules.d/90lvm/64-lvm.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90lvm/64-lvm.rules b/modules.d/90lvm/64-lvm.rules +index 65f6524..ca718ce 100644 +--- a/modules.d/90lvm/64-lvm.rules ++++ b/modules.d/90lvm/64-lvm.rules +@@ -15,7 +15,7 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && + GOTO="lvm_end" + + RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan" +-RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --partial" ++RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --activationmode degraded" + RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'" + + LABEL="lvm_end" +-- +1.8.3.1 + diff --git a/backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch b/backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch new file mode 100644 index 0000000..72083da --- /dev/null +++ b/backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch @@ -0,0 +1,38 @@ +From 164e5ebb1199ea3e3d641ce402d8257f0055a529 Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Fri, 17 Dec 2021 12:14:51 -0600 +Subject: [PATCH] fix(lvm): restore setting LVM_MD_PV_ACTIVATED + +The 69-dm-lvm-metad.rules udev rule has been removed from +the initrd, because it's been dropped by recent upstream +lvm versions, and it never performed any primary function +within the initrd. But, it did have the job of setting +LVM_MD_PV_ACTIVATED=1 for active md devices used by PVs. +That step needs to be restored, and is now included in +64-lvm.rules. +--- + modules.d/90lvm/64-lvm.rules | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/modules.d/90lvm/64-lvm.rules b/modules.d/90lvm/64-lvm.rules +index ca718ce..1ad4911 100644 +--- a/modules.d/90lvm/64-lvm.rules ++++ b/modules.d/90lvm/64-lvm.rules +@@ -6,6 +6,14 @@ + + SUBSYSTEM!="block", GOTO="lvm_end" + ACTION!="add|change", GOTO="lvm_end" ++ ++# If the md device is active (indicated by array_state), then set the flag ++# LVM_MD_PV_ACTIVATED=1 indicating that the md device for the PV is ready ++# to be used. The lvm udev rule running in root will check that this flag ++# is set before it will process the md device (it wants to avoid ++# processing an md device that exists but is not yet ready to be used.) ++KERNEL=="md[0-9]*", ACTION=="change", ENV{ID_FS_TYPE}=="LVM2_member", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1" ++ + # Also don't process disks that are slated to be a multipath device + ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end" + KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end" +-- +1.8.3.1 + diff --git a/backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch b/backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch new file mode 100644 index 0000000..e35c1d6 --- /dev/null +++ b/backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch @@ -0,0 +1,44 @@ +From 50e74668434d935db649b5690dc2158b0f87d91c Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Wed, 8 Dec 2021 14:11:13 -0600 +Subject: [PATCH] revert(lvm): remove 69-dm-lvm-metad.rules + +This udev rule runs pvscan to autoactivate VGs, which dracut +does not want to do, and previously disabled by editing the +rule file and commenting out lines. + +This also stops /dev/disk/by-id/lvm-pv-uuid-* symlinks from +being created in the initrd. +--- + modules.d/90lvm/module-setup.sh | 15 +-------------- + 1 file changed, 1 insertion(+), 14 deletions(-) + +diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh +index 0bb491f..25be013 100755 +--- a/modules.d/90lvm/module-setup.sh ++++ b/modules.d/90lvm/module-setup.sh +@@ -78,20 +78,7 @@ install() { + unset LVM_SUPPRESS_FD_WARNINGS + fi + +- inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules +- +- # Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut! +- if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]]; then +- if grep -q SYSTEMD_WANTS "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules; then +- sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \ +- "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- sed -i -e 's/^ENV{ID_MODEL}=.*//' "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- sed -i -e 's/^ENV{SYSTEMD_WANTS}+\?=.*//' "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- else +- sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \ +- "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- fi +- fi ++ inst_rules 11-dm-lvm.rules + + # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules + # files, but provides the one below: +-- +1.8.3.1 + diff --git a/backport-revert-lvm-remove-lvmetad-config-changes.patch b/backport-revert-lvm-remove-lvmetad-config-changes.patch new file mode 100644 index 0000000..977c24a --- /dev/null +++ b/backport-revert-lvm-remove-lvmetad-config-changes.patch @@ -0,0 +1,69 @@ +From f6f393f550625e3e1c968ef32d6d7bdd90f51d73 Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Wed, 8 Dec 2021 14:07:42 -0600 +Subject: [PATCH] revert(lvm): remove lvmetad config changes + +Remove support for modifying use_lvmetad and locking_type +settings in lvm.conf for lvm versions 2.2.*. Recent lvm +versions (2.3.*) do not include lvmetad or locking_type. +This cleanup simplifies code maintenance. + +To use the lvm module with older versions (2.2), a user +would need to ensure that lvmetad settings are disabled +in the initrd's lvm.conf rather than relying on the lvm +dracut mode to modify their lvm.conf. +--- + modules.d/90lvm/lvm_scan.sh | 3 --- + modules.d/90lvm/module-setup.sh | 14 -------------- + 2 files changed, 17 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index 43601ad..8038240 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -28,10 +28,7 @@ if [ ! -e /etc/lvm/lvm.conf ]; then + echo '"r/.*/" ]' + echo '}' + +- # establish LVM locking + echo 'global {' +- echo ' locking_type = 4' +- echo ' use_lvmetad = 0' + echo '}' + } > /etc/lvm/lvm.conf + lvmwritten=1 +diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh +index e1e6c58..0bb491f 100755 +--- a/modules.d/90lvm/module-setup.sh ++++ b/modules.d/90lvm/module-setup.sh +@@ -61,10 +61,6 @@ install() { + if [[ $hostonly ]] || [[ $lvmconf == "yes" ]]; then + if [[ -f $dracutsysrootdir/etc/lvm/lvm.conf ]]; then + inst_simple -H /etc/lvm/lvm.conf +- # FIXME: near-term hack to establish read-only locking; +- # use command-line lvm.conf editor once it is available +- sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' "${initdir}/etc/lvm/lvm.conf" +- sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' "${initdir}/etc/lvm/lvm.conf" + fi + + export LVM_SUPPRESS_FD_WARNINGS=1 +@@ -82,16 +78,6 @@ install() { + unset LVM_SUPPRESS_FD_WARNINGS + fi + +- if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then +- mkdir -p "${initdir}/etc/lvm" +- { +- echo 'global {' +- echo 'locking_type = 4' +- echo 'use_lvmetad = 0' +- echo '}' +- } > "${initdir}/etc/lvm/lvm.conf" +- fi +- + inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules + + # Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut! +-- +1.8.3.1 + diff --git a/backport-revert-lvm-remove-snapshot-feature.patch b/backport-revert-lvm-remove-snapshot-feature.patch new file mode 100644 index 0000000..bba82e5 --- /dev/null +++ b/backport-revert-lvm-remove-snapshot-feature.patch @@ -0,0 +1,79 @@ +From 1549d5e89818603e1aa6dd8a40981222f59f1548 Mon Sep 17 00:00:00 2001 +From: David Teigland <teigland@redhat.com> +Date: Wed, 8 Dec 2021 14:04:25 -0600 +Subject: [PATCH] revert(lvm): remove snapshot feature + +The feature of managing lvm snapshots has no known +recent usage. It is unknown if it works. The lvm +developers do not wish to maintain or support it. +--- + modules.d/90lvm/lvm_scan.sh | 39 ++++----------------------------------- + 1 file changed, 4 insertions(+), 35 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index c42f97d..43601ad 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -7,8 +7,6 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh + + VGS=$(getargs rd.lvm.vg -d rd_LVM_VG=) + LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=) +-SNAPSHOT=$(getargs rd.lvm.snapshot -d rd_LVM_SNAPSHOT=) +-SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=) + + # shellcheck disable=SC2174 + [ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm +@@ -31,17 +29,10 @@ if [ ! -e /etc/lvm/lvm.conf ]; then + echo '}' + + # establish LVM locking +- if [ -n "$SNAPSHOT" ]; then +- echo 'global {' +- echo ' locking_type = 1' +- echo ' use_lvmetad = 0' +- echo '}' +- else +- echo 'global {' +- echo ' locking_type = 4' +- echo ' use_lvmetad = 0' +- echo '}' +- fi ++ echo 'global {' ++ echo ' locking_type = 4' ++ echo ' use_lvmetad = 0' ++ echo '}' + } > /etc/lvm/lvm.conf + lvmwritten=1 + fi +@@ -90,28 +81,6 @@ unset extraargs + + export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 + +-if [ -n "$SNAPSHOT" ]; then +- # HACK - this should probably be done elsewhere or turned into a function +- # Enable read-write LVM locking +- sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' /etc/lvm/lvm.conf +- +- # Expected SNAPSHOT format "<orig lv name>:<snap lv name>" +- ORIG_LV=${SNAPSHOT%%:*} +- SNAP_LV=${SNAPSHOT##*:} +- +- info "Removing existing LVM snapshot $SNAP_LV" +- lvm lvremove --force "$SNAP_LV" 2>&1 | vinfo +- +- # Determine snapshot size +- if [ -z "$SNAPSIZE" ]; then +- SNAPSIZE=$(lvm lvs --noheadings --units m --options lv_size "$ORIG_LV") +- info "No LVM snapshot size provided, using size of $ORIG_LV ($SNAPSIZE)" +- fi +- +- info "Creating LVM snapshot $SNAP_LV ($SNAPSIZE)" +- lvm lvcreate -s -n "$SNAP_LV" -L "$SNAPSIZE" "$ORIG_LV" 2>&1 | vinfo +-fi +- + if [ -n "$LVS" ]; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" + lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo +-- +1.8.3.1 + diff --git a/dracut-network-fixed-net-rules-issue-hence-systemd-r.patch b/dracut-network-fixed-net-rules-issue-hence-systemd-r.patch new file mode 100644 index 0000000..a6e6baf --- /dev/null +++ b/dracut-network-fixed-net-rules-issue-hence-systemd-r.patch @@ -0,0 +1,28 @@ +From b586f1d465f7454aa55bcf623409c6d86215ab15 Mon Sep 17 00:00:00 2001 +From: rpm-build <rpm-build> +Date: Wed, 25 Sep 2019 22:38:58 +0800 +Subject: [PATCH] dracut-network: fixed net-rules issue hence systemd rename + netif when anaconda pxe install + +--- + modules.d/35network-legacy/net-genrules.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/modules.d/35network-legacy/net-genrules.sh b/modules.d/35network-legacy/net-genrules.sh +index e6035e5..b111c0b 100755 +--- a/modules.d/35network-legacy/net-genrules.sh ++++ b/modules.d/35network-legacy/net-genrules.sh +@@ -113,8 +113,10 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh + # Fixme: waiting for the interface as well. + else + cond='ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"' ++ cond2='ACTION=="move", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"' + # if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh + echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules ++ echo "$cond2, $runcmd" >> /etc/udev/rules.d/91-default-net.rules + if [ "$NEEDNET" = "1" ]; then + # shellcheck disable=SC2016 + echo 'for i in /tmp/net.*.did-setup; do [ -f "$i" ] && exit 0; done; exit 1' > "$hookdir"/initqueue/finished/wait-network.sh +-- +1.8.3.1 + diff --git a/dracut.spec b/dracut.spec new file mode 100644 index 0000000..711f554 --- /dev/null +++ b/dracut.spec @@ -0,0 +1,585 @@ +# This spec obtain from source code(dracut-049.tar.gz) +%define dracutlibdir %{_prefix}/lib/dracut +%bcond_without doc + +# We ship a .pc file but don't want to have a dep on pkg-config. We +# strip the automatically generated dep here and instead co-own the +# directory. +%global __requires_exclude pkg-config + +Name: dracut +Version: 055 +Release: 8 + +Summary: Initramfs generator using udev + +# The entire source code is GPLv2+ +# except install/* which is LGPLv2+ +License: GPLv2+ and LGPLv2+ + +URL: https://dracut.wiki.kernel.org/ + +# Source can be generated by +# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%%{version};sf=tgz +Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz +#Source0: https://git.kernel.org/pub/scm/boot/dracut/dracut.git/snapshot/dracut-%{version}.tar.gz + +Patch1: dracut-network-fixed-net-rules-issue-hence-systemd-r.patch +Patch2: skip-the-broken-sd-in-initqueue.patch +Patch3: use-sleep-replace-check-sys-block.patch +Patch4: add-option-to-include-file-metadata-in-initramfs.patch +Patch5: revert-fix-systemd-networkd-make-systemd-networkd.patch +Patch6: make-network-legacy-instead-of-network-manager-the-network.patch +Patch7: backport-revert-lvm-remove-snapshot-feature.patch +Patch8: backport-revert-lvm-remove-lvmetad-config-changes.patch +Patch9: backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch +Patch10: backport-fix-lvm-replace-partial-option.patch +Patch11: backport-feat-lvm-update-lvm-command-options.patch +Patch12: backport-feat-lvm-use-generated-filter-when-none-is-set.patch +Patch13: backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch +Patch14: backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch +Patch15: backport-Bring-back-51-dracut-rescue-postinst.sh.patch +Patch16: backport-fix-dracut-shutdown-add-cleanup-handler-on-failure.patch + +Patch9000: remove-iscsi-related-code-since-it-is-no-longer-main.patch + +# openEuler summer ospp +Patch10000: summer-ospp-replace-isomd5sum-with-isosm3sum.patch + +Source1: https://www.gnu.org/licenses/lgpl-2.1.txt +Source2: openEuler.conf.example + +BuildRequires: bash +BuildRequires: git +BuildRequires: kmod-devel >= 23 +BuildRequires: gcc + +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} +BuildRequires: pkgconfig +BuildRequires: systemd +%endif +%if 0%{?fedora} +BuildRequires: bash-completion +%endif + +%if %{with doc} +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} +BuildRequires: docbook-style-xsl docbook-dtds libxslt +%endif + +%if 0%{?suse_version} +BuildRequires: docbook-xsl-stylesheets libxslt +%endif + +BuildRequires: asciidoc +%endif + +Obsoletes: dracut-fips <= 047 +Provides: dracut-fips = %{version}-%{release} +Obsoletes: dracut-fips-aesni <= 047 +Provides: dracut-fips-aesni = %{version}-%{release} + +Requires: bash >= 4 +Requires: coreutils +Requires: cpio +Requires: filesystem >= 2.1.0 +Requires: findutils +Requires: grep +Requires: kmod +Requires: sed +Requires: xz +Requires: gzip + +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} +Recommends: hardlink +Recommends: pigz +Recommends: kpartx +Requires: util-linux >= 2.21 +Requires: systemd >= 219 +Requires: systemd-udev >= 219 +Requires: procps-ng +%else +Requires: hardlink +Requires: gzip +Requires: kpartx +Requires: udev > 166 +Requires: util-linux >= 2.21 +%endif + +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} +Requires: libkcapi-hmaccalc +%endif + +%description +dracut contains tools to create bootable initramfses for the Linux +kernel. Unlike previous implementations, dracut hard-codes as little +as possible into the initramfs. dracut contains various modules which +are driven by the event-based udev. Having root on MD, DM, LVM2, LUKS +is supported as well as NFS, iSCSI, NBD, FCoE with the dracut-network +package. + +%package network +Summary: dracut modules to build a dracut initramfs with network support +%if 0%{?_module_build} +# In the module-build-service, we have pieces of dracut provided by different +# modules ("base-runtime" provides most functionality, but we need +# dracut-network in "installer". Since these two modules build with separate +# dist-tags, we need to reduce this strict requirement to ignore the dist-tag. +Requires: %{name} >= %{version}-%{dist_free_release} +%else +Requires: %{name} = %{version}-%{release} +%endif +Requires: iputils +Requires: iproute +Requires: dhcp +Obsoletes: dracut-generic < 008 +Provides: dracut-generic = %{version}-%{release} + +%description network +This package requires everything which is needed to build a generic +all purpose initramfs with network support with dracut. + +%package caps +Summary: dracut modules to build a dracut initramfs which drops capabilities +Requires: %{name} = %{version}-%{release} +Requires: libcap + +%description caps +This package requires everything which is needed to build an +initramfs with dracut, which drops capabilities. + +%package live +Summary: dracut modules to build a dracut initramfs with live image capabilities +%if 0%{?_module_build} +# See the network subpackage comment. +Requires: %{name} >= %{version}-%{dist_free_release} +%else +Requires: %{name} = %{version}-%{release} +%endif +Requires: %{name}-network = %{version}-%{release} +Requires: tar gzip coreutils bash device-mapper curl +%if 0%{?fedora} +Requires: fuse ntfs-3g +%endif + +%description live +This package requires everything which is needed to build an +initramfs with dracut, with live image capabilities, like Live CDs. + +%package config-generic +Summary: dracut configuration to turn off hostonly image generation +Requires: %{name} = %{version}-%{release} +Obsoletes: dracut-nohostonly < 030 +Provides: dracut-nohostonly = %{version}-%{release} + +%description config-generic +This package provides the configuration to turn off the host specific initramfs +generation with dracut and generates a generic image by default. + +%package config-rescue +Summary: dracut configuration to turn on rescue image generation +Requires: %{name} = %{version}-%{release} +Obsoletes: dracut < 030 + +%description config-rescue +This package provides the configuration to turn on the rescue initramfs +generation with dracut. + +%package tools +Summary: dracut tools to build the local initramfs +Requires: %{name} = %{version}-%{release} + +%description tools +This package contains tools to assemble the local initrd and host configuration. + +%package squash +Summary: dracut module to build an initramfs with most files in a squashfs image +Requires: %{name} = %{version}-%{release} +Requires: squashfs-tools + +%description squash +This package provides a dracut module to build an initramfs, but store most files +in a squashfs image, result in a smaller initramfs size and reduce runtime memory +usage. + +%prep +%autosetup -n %{name}-%{version} -S git_am +cp %{SOURCE1} . +cp %{SOURCE2} %_builddir/dracut-%{version}/dracut.conf.d/ +%build +%configure --systemdsystemunitdir=%{_unitdir} \ + --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) \ + --libdir=%{_prefix}/lib \ +%if %{without doc} + --disable-documentation \ +%endif + ${NULL} + +make %{?_smp_mflags} +sed -i 's/=\"idm[0-9]\{5,32\}\"/=\"idm123456789123456\"/g' dracut.html + +%install +make %{?_smp_mflags} install \ + DESTDIR=$RPM_BUILD_ROOT \ + libdir=%{_prefix}/lib + +echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh + +%if 0%{?openEuler} == 0 && 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0 +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips +%endif + +%if %{defined _unitdir} +# for systemd, better use systemd-bootchart +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart +%endif + +# we do not support dash in the initramfs +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash + +# we do not support mksh in the initramfs +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00mksh + +# remove gentoo specific modules +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash + +%if %{defined _unitdir} +# with systemd IMA and selinux modules do not make sense +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity +%endif + +%ifnarch s390 s390x +# remove architecture specific modules +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/80cms +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/81cio_ignore +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/91zipl +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_mod +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_rules +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dcssblk +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95qeth_rules +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp_rules +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95znet +%else +rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00warpclock +%endif + +mkdir -p $RPM_BUILD_ROOT/boot/dracut +mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log +touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log +mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs + +install -m 0644 dracut.conf.d/openEuler.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/99-initramfs.conf +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} +install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf +rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse* +%endif +%if 0%{?suse_version} +install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf +%endif + +%if 0%{?openEuler} == 0 && 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999 +rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd +%endif + +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} +echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf +echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d +install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh +%endif + +%files +%if %{with doc} +%doc README.md AUTHORS +%endif +%{!?_licensedir:%global license %%doc} +%license COPYING lgpl-2.1.txt +%{_bindir}/dracut +%{_datadir}/bash-completion/completions/dracut +%{_datadir}/bash-completion/completions/lsinitrd +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999 +%{_bindir}/lsinitrd +%endif +%dir %{dracutlibdir} +%dir %{dracutlibdir}/modules.d +%{dracutlibdir}/dracut-functions.sh +%{dracutlibdir}/dracut-init.sh +%{dracutlibdir}/dracut-functions +%{dracutlibdir}/dracut-version.sh +%{dracutlibdir}/dracut-logger.sh +%{dracutlibdir}/dracut-initramfs-restore +%{dracutlibdir}/dracut-install +%{dracutlibdir}/dracut-util +%{dracutlibdir}/skipcpio +%config(noreplace) %{_sysconfdir}/dracut.conf +%if 0%{?openEuler} || 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} +%{dracutlibdir}/dracut.conf.d/01-dist.conf +%endif +%{dracutlibdir}/dracut.conf.d/99-initramfs.conf +%dir %{_sysconfdir}/dracut.conf.d +%dir %{dracutlibdir}/dracut.conf.d +%dir %{_datadir}/pkgconfig +%{_datadir}/pkgconfig/dracut.pc + +%if %{with doc} +%{_mandir}/man8/dracut.8* +%{_mandir}/man8/*service.8* +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999 +%{_mandir}/man1/lsinitrd.1* +%endif +%{_mandir}/man7/dracut.kernel.7* +%{_mandir}/man7/dracut.cmdline.7* +%{_mandir}/man7/dracut.modules.7* +%{_mandir}/man7/dracut.bootup.7* +%{_mandir}/man5/dracut.conf.5* +%endif + +%if %{undefined _unitdir} +%{dracutlibdir}/modules.d/00bootchart +%endif +%{dracutlibdir}/modules.d/00bash +%{dracutlibdir}/modules.d/00systemd +%{dracutlibdir}/modules.d/00systemd-network-management +%ifnarch s390 s390x +%{dracutlibdir}/modules.d/00warpclock +%endif +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} +%{dracutlibdir}/modules.d/01fips +%endif +%{dracutlibdir}/modules.d/01systemd-ac-power +%{dracutlibdir}/modules.d/01systemd-ask-password +%{dracutlibdir}/modules.d/01systemd-coredump +%{dracutlibdir}/modules.d/01systemd-hostnamed +%{dracutlibdir}/modules.d/01systemd-initrd +%{dracutlibdir}/modules.d/01systemd-journald +%{dracutlibdir}/modules.d/01systemd-ldconfig +%{dracutlibdir}/modules.d/01systemd-modules-load +%{dracutlibdir}/modules.d/01systemd-repart +%{dracutlibdir}/modules.d/01systemd-resolved +%{dracutlibdir}/modules.d/01systemd-rfkill +%{dracutlibdir}/modules.d/01systemd-sysext +%{dracutlibdir}/modules.d/01systemd-sysctl +%{dracutlibdir}/modules.d/01systemd-sysusers +%{dracutlibdir}/modules.d/01systemd-timedated +%{dracutlibdir}/modules.d/01systemd-timesyncd +%{dracutlibdir}/modules.d/01systemd-tmpfiles +%{dracutlibdir}/modules.d/01systemd-udevd +%{dracutlibdir}/modules.d/01systemd-veritysetup +%{dracutlibdir}/modules.d/03modsign +%{dracutlibdir}/modules.d/03rescue +%{dracutlibdir}/modules.d/04watchdog +%{dracutlibdir}/modules.d/04watchdog-modules +%{dracutlibdir}/modules.d/05busybox +%{dracutlibdir}/modules.d/06dbus-broker +%{dracutlibdir}/modules.d/06dbus-daemon +%{dracutlibdir}/modules.d/06rngd +%{dracutlibdir}/modules.d/09dbus +%{dracutlibdir}/modules.d/10i18n +%{dracutlibdir}/modules.d/30convertfs +%{dracutlibdir}/modules.d/45url-lib +%{dracutlibdir}/modules.d/50drm +%{dracutlibdir}/modules.d/50plymouth +%{dracutlibdir}/modules.d/62bluetooth +%{dracutlibdir}/modules.d/80lvmmerge +%{dracutlibdir}/modules.d/90btrfs +%{dracutlibdir}/modules.d/90crypt +%{dracutlibdir}/modules.d/90dm +%{dracutlibdir}/modules.d/90dmraid +%{dracutlibdir}/modules.d/90kernel-modules +%{dracutlibdir}/modules.d/90kernel-modules-extra +%{dracutlibdir}/modules.d/90lvm +%{dracutlibdir}/modules.d/90mdraid +%{dracutlibdir}/modules.d/90multipath +%{dracutlibdir}/modules.d/90nvdimm +%{dracutlibdir}/modules.d/90qemu +%{dracutlibdir}/modules.d/90ppcmac +%{dracutlibdir}/modules.d/91crypt-gpg +%{dracutlibdir}/modules.d/91crypt-loop +%{dracutlibdir}/modules.d/91tpm2-tss +%{dracutlibdir}/modules.d/95debug +%{dracutlibdir}/modules.d/95fstab-sys +%{dracutlibdir}/modules.d/95lunmask +%{dracutlibdir}/modules.d/95nvmf +%{dracutlibdir}/modules.d/95resume +%{dracutlibdir}/modules.d/95rootfs-block +%{dracutlibdir}/modules.d/95terminfo +%{dracutlibdir}/modules.d/95udev-rules +%{dracutlibdir}/modules.d/95virtfs +%ifarch s390 s390x +%{dracutlibdir}/modules.d/80cms +%{dracutlibdir}/modules.d/81cio_ignore +%{dracutlibdir}/modules.d/91zipl +%{dracutlibdir}/modules.d/95dasd +%{dracutlibdir}/modules.d/95dasd_mod +%{dracutlibdir}/modules.d/95dasd_rules +%{dracutlibdir}/modules.d/95dcssblk +%{dracutlibdir}/modules.d/95qeth_rules +%{dracutlibdir}/modules.d/95zfcp +%{dracutlibdir}/modules.d/95zfcp_rules +%endif +%if %{undefined _unitdir} +%{dracutlibdir}/modules.d/96securityfs +%{dracutlibdir}/modules.d/97masterkey +%{dracutlibdir}/modules.d/98integrity +%endif +%{dracutlibdir}/modules.d/97biosdevname +%{dracutlibdir}/modules.d/98dracut-systemd +%{dracutlibdir}/modules.d/98ecryptfs +%{dracutlibdir}/modules.d/98pollcdrom +%{dracutlibdir}/modules.d/98selinux +%{dracutlibdir}/modules.d/98syslog +%{dracutlibdir}/modules.d/98usrmount +%{dracutlibdir}/modules.d/99base +%{dracutlibdir}/modules.d/99memstrack +%{dracutlibdir}/modules.d/99fs-lib +%{dracutlibdir}/modules.d/99shutdown +%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log +%dir %{_sharedstatedir}/initramfs +%if %{defined _unitdir} +%{_unitdir}/dracut-shutdown.service +%{_unitdir}/dracut-shutdown-onfailure.service +%{_unitdir}/sysinit.target.wants/dracut-shutdown.service +%{_unitdir}/dracut-cmdline.service +%{_unitdir}/dracut-initqueue.service +%{_unitdir}/dracut-mount.service +%{_unitdir}/dracut-pre-mount.service +%{_unitdir}/dracut-pre-pivot.service +%{_unitdir}/dracut-pre-trigger.service +%{_unitdir}/dracut-pre-udev.service +%{_unitdir}/initrd.target.wants/dracut-cmdline.service +%{_unitdir}/initrd.target.wants/dracut-initqueue.service +%{_unitdir}/initrd.target.wants/dracut-mount.service +%{_unitdir}/initrd.target.wants/dracut-pre-mount.service +%{_unitdir}/initrd.target.wants/dracut-pre-pivot.service +%{_unitdir}/initrd.target.wants/dracut-pre-trigger.service +%{_unitdir}/initrd.target.wants/dracut-pre-udev.service + +%endif +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} +%{_prefix}/lib/kernel/install.d/50-dracut.install +%endif + +%files network +%{dracutlibdir}/modules.d/01systemd-networkd +%{dracutlibdir}/modules.d/35network-manager +%{dracutlibdir}/modules.d/35network-legacy +%{dracutlibdir}/modules.d/35network-wicked +%{dracutlibdir}/modules.d/40network +%{dracutlibdir}/modules.d/45ifcfg +%{dracutlibdir}/modules.d/90kernel-network-modules +%{dracutlibdir}/modules.d/90qemu-net +%{dracutlibdir}/modules.d/95cifs +%{dracutlibdir}/modules.d/95fcoe +%{dracutlibdir}/modules.d/95fcoe-uefi +%{dracutlibdir}/modules.d/95iscsi +%{dracutlibdir}/modules.d/95nbd +%{dracutlibdir}/modules.d/95nfs +%{dracutlibdir}/modules.d/95ssh-client +%ifarch s390 s390x +%{dracutlibdir}/modules.d/95znet +%endif +%{dracutlibdir}/modules.d/99uefi-lib + +%files caps +%{dracutlibdir}/modules.d/02caps + +%files live +%{dracutlibdir}/modules.d/99img-lib +%{dracutlibdir}/modules.d/90dmsquash-live +%{dracutlibdir}/modules.d/90dmsquash-live-ntfs +%{dracutlibdir}/modules.d/90livenet + +%files tools +%if %{with doc} +%doc %{_mandir}/man8/dracut-catimages.8* +%endif + +%files squash +%{dracutlibdir}/modules.d/99squash + +%{_bindir}/dracut-catimages +%dir /boot/dracut +%dir /var/lib/dracut +%dir /var/lib/dracut/overlay + +%files config-generic +%{dracutlibdir}/dracut.conf.d/02-generic-image.conf + +%files config-rescue +%{dracutlibdir}/dracut.conf.d/02-rescue.conf +%if 0%{?openEuler} || 0%{?fedora} || 0%{?rhel} +%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install +%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh +%endif + +%changelog +* Thu Sep 07 2023 raki007 <278366432@qq.com> - 055-8 +- [add] add summer ospp patch + +* Wed Mar 22 2023 wangyuhang <wangyuhang27@huawei.com> - 055-7 +- fix(dracut-shutdown): add cleanup handler on failure + +* Sun Dec 4 2022 luck <lucx_ii@163.com> - 055-6 +- remove iscsi-related code since it is no longer maintained by + open-iscsi + +* Mon Apr 11 2022 panxiaohe <panxh.life@foxmail.com> - 055-5 +- bring back 51-dracut-rescue-postinst.sh for rescue mode + +* Wed Feb 16 2022 panxiaohe <panxiaohe@h-partners.com> - 055-4 +- backport patches from upstream: improve lvm module + +* Mon Jan 17 2022 panxiaohe <panxiaohe@huawei.com> - 055-3 +- make network-legacy instead of network-manager + the network provider + +* Wed Aug 25 2021 panxiaohe <panxiaohe@huawei.com> - 055-2 +- revert patch "make systemd networkd a proper network + provider" to use network-legacy. + +* Fri Aug 6 2021 panxiaohe <panxiaohe@huawei.com> - 055-1 +- Update to 055 + +* Thu Jul 22 2021 wangchen <wangchen137@huawei.com> - 050-5 +- Delete unnecessary gdb from BuildRequires + +* Wed May 26 2021 panxiaohe <panxiaohe@huawei.com> - 050-4 +- [add] backport patches from upstream + backport-fix-always-use-mkdir-p.patch + backport-fix-dracut.sh-omission-is-an-addition-to-other-omiss.patch + +* Thu Jul 23 2020 Liquor <lirui130@huawei.com> - 050-1 +- Update to 050 + +* Thu Jul 2 2020 Anakin Zhang <benjamin93@163.com> - 049-9 +- add -e option to include file metadata in initramfs + +* Sat Mar 21 2020 openEuler Buildteam <buildteam@openeuler.org> - 049-8 +- Add buildrequires of gdb + +* Fri Mar 20 2020 openEuler Buildteam <buildteam@openeuler.org> - 049-7 +- Add judgement of openEuler + +* Mon Feb 24 2020 openEuler Buildteam <buildteam@openeuler.org> - 049-6 +- Change requires of dracut-squash from squash-tools to squashfs-tools + +* Mon Dec 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 049-5 +- Use sleep replace check /sys/block and skip the broken sd in initqueue + +* Wed Sep 25 2019 hexiaowen <hexiaowen@huawei.com> - 049-4 +- fix issue when anaconda pxe install for dracut-network + +* Tue Sep 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 049-3 +- Adjust requires + +* Fri Sep 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 049-2 +- Delete redundant information + +* Thu Aug 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 049-1 +- Package init diff --git a/lgpl-2.1.txt b/lgpl-2.1.txt new file mode 100644 index 0000000..4362b49 --- /dev/null +++ b/lgpl-2.1.txt @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/make-network-legacy-instead-of-network-manager-the-network.patch b/make-network-legacy-instead-of-network-manager-the-network.patch new file mode 100644 index 0000000..cefbd18 --- /dev/null +++ b/make-network-legacy-instead-of-network-manager-the-network.patch @@ -0,0 +1,26 @@ +From 9c3c197ce47bc45d0ea97bd3d4e05860c778df1b Mon Sep 17 00:00:00 2001 +From: panxiaohe <panxiaohe@huawei.com> +Date: Mon, 17 Jan 2022 19:53:41 +0800 +Subject: [PATCH] make network-legacy instead of network-manager the network + provider + +--- + modules.d/40network/module-setup.sh | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh +index cbb5b70..5396a49 100755 +--- a/modules.d/40network/module-setup.sh ++++ b/modules.d/40network/module-setup.sh +@@ -19,8 +19,6 @@ depends() { + if [ -z "$network_handler" ]; then + if [[ -x $dracutsysrootdir$systemdsystemunitdir/wicked.service ]]; then + network_handler="network-wicked" +- elif [[ -x $dracutsysrootdir/usr/libexec/nm-initrd-generator ]]; then +- network_handler="network-manager" + else + network_handler="network-legacy" + fi +-- +1.8.3.1 + diff --git a/openEuler.conf.example b/openEuler.conf.example new file mode 100644 index 0000000..10dd251 --- /dev/null +++ b/openEuler.conf.example @@ -0,0 +1,3 @@ +#turn on virtio-gpu to print vnc log +logfile=/var/log/dracut.log +add_drivers+=" virtio-gpu " diff --git a/remove-iscsi-related-code-since-it-is-no-longer-main.patch b/remove-iscsi-related-code-since-it-is-no-longer-main.patch new file mode 100644 index 0000000..f6b47c7 --- /dev/null +++ b/remove-iscsi-related-code-since-it-is-no-longer-main.patch @@ -0,0 +1,129 @@ +From 38a3ee547e93c0b11020818cc4a244f89d492031 Mon Sep 17 00:00:00 2001 +From: luck <lucx_ii@163.com> +Date: Sun, 4 Dec 2022 16:00:32 +0800 +Subject: [PATCH] remove iscsi-related code since it is no longer maintained by + open-iscsi + +related commit:https://gitee.com/src-openeuler/open-iscsi/pulls/85/files +--- + modules.d/95iscsi/cleanup-iscsi.sh | 3 --- + modules.d/95iscsi/iscsiroot.sh | 8 ------- + modules.d/95iscsi/module-setup.sh | 29 +++-------------------- + test/container/Dockerfile-OpenSuse-latest | 2 +- + 4 files changed, 4 insertions(+), 38 deletions(-) + +diff --git a/modules.d/95iscsi/cleanup-iscsi.sh b/modules.d/95iscsi/cleanup-iscsi.sh +index 8338503..13f4793 100755 +--- a/modules.d/95iscsi/cleanup-iscsi.sh ++++ b/modules.d/95iscsi/cleanup-iscsi.sh +@@ -1,5 +1,2 @@ + #!/bin/sh + +-if [ -z "${DRACUT_SYSTEMD}" ] && { [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ]; }; then +- killproc iscsiuio +-fi +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 1a64465..a045af5 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -36,14 +36,6 @@ iroot=${iroot#:} + # figured out a way how to check whether this is built-in or not + modprobe crc32c 2> /dev/null + +-# start iscsiuio if needed +-if [ -z "${DRACUT_SYSTEMD}" ] \ +- && { [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ]; } \ +- && ! [ -e /tmp/iscsiuio-started ]; then +- iscsiuio +- : > /tmp/iscsiuio-started +-fi +- + handle_firmware() { + local ifaces retry + +diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh +index 88d6c92..41fbc7d 100755 +--- a/modules.d/95iscsi/module-setup.sh ++++ b/modules.d/95iscsi/module-setup.sh +@@ -185,17 +185,13 @@ cmdline() { + + # called by dracut + install() { +- inst_multiple -o iscsiuio + inst_libdir_file 'libgcc_s.so*' + inst_multiple umount iscsi-iname iscsiadm iscsid + + inst_multiple -o \ + "$systemdsystemunitdir"/iscsid.socket \ + "$systemdsystemunitdir"/iscsid.service \ +- "$systemdsystemunitdir"/iscsiuio.service \ +- "$systemdsystemunitdir"/iscsiuio.socket \ +- "$systemdsystemunitdir"/sockets.target.wants/iscsid.socket \ +- "$systemdsystemunitdir"/sockets.target.wants/iscsiuio.socket ++ "$systemdsystemunitdir"/sockets.target.wants/iscsid.socket + + if [[ $hostonly ]]; then + local -a _filenames +@@ -226,13 +222,10 @@ install() { + "$systemdsystemunitdir"/iscsi-init.service \ + "$systemdsystemunitdir"/iscsid.service \ + "$systemdsystemunitdir"/iscsid.socket \ +- "$systemdsystemunitdir"/iscsiuio.service \ +- "$systemdsystemunitdir"/iscsiuio.socket \ + iscsiadm iscsid + + for i in \ +- iscsid.socket \ +- iscsiuio.socket; do ++ iscsid.socket; do + $SYSTEMCTL -q --root "$initdir" enable "$i" + done + +@@ -252,22 +245,6 @@ install() { + echo "Before=shutdown.target sockets.target" + } > "${initdir}/$systemdsystemunitdir/iscsid.socket.d/dracut.conf" + +- mkdir -p "${initdir}/$systemdsystemunitdir/iscsiuio.service.d" +- { +- echo "[Unit]" +- echo "DefaultDependencies=no" +- echo "Conflicts=shutdown.target" +- echo "Before=shutdown.target" +- } > "${initdir}/$systemdsystemunitdir/iscsiuio.service.d/dracut.conf" +- +- mkdir -p "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d" +- { +- echo "[Unit]" +- echo "DefaultDependencies=no" +- echo "Conflicts=shutdown.target" +- echo "Before=shutdown.target sockets.target" +- } > "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d/dracut.conf" +- + # Fedora 34 iscsid requires iscsi-shutdown.service + # which would terminate all iSCSI connections on switch root + cat > "${initdir}/$systemdsystemunitdir/iscsi-shutdown.service" << EOF +@@ -276,7 +253,7 @@ Description=Dummy iscsi-shutdown.service for the initrd + Documentation=man:iscsid(8) man:iscsiadm(8) + DefaultDependencies=no + Conflicts=shutdown.target +-After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service ++After=systemd-remount-fs.service network.target iscsid.service + Before=remote-fs-pre.target + + [Service] +diff --git a/test/container/Dockerfile-OpenSuse-latest b/test/container/Dockerfile-OpenSuse-latest +index 637d50c..42de0ea 100644 +--- a/test/container/Dockerfile-OpenSuse-latest ++++ b/test/container/Dockerfile-OpenSuse-latest +@@ -13,7 +13,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \ + strace libkmod-devel gcc bzip2 xz tar wget rpm-build make git bash-completion \ + sudo kernel dhcp-client qemu-kvm /usr/bin/qemu-system-$(uname -m) e2fsprogs \ + tcpdump iproute iputils kbd NetworkManager btrfsprogs tgt dbus-broker \ +- iscsiuio open-iscsi which ShellCheck procps pigz \ ++ open-iscsi which ShellCheck procps pigz \ + && dnf -y update && dnf clean all + + RUN shfmt_version=3.2.4; wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt \ +-- +2.33.0 + diff --git a/revert-fix-systemd-networkd-make-systemd-networkd.patch b/revert-fix-systemd-networkd-make-systemd-networkd.patch new file mode 100644 index 0000000..277a7bb --- /dev/null +++ b/revert-fix-systemd-networkd-make-systemd-networkd.patch @@ -0,0 +1,160 @@ +From 03d8f6a99e9fbc73836982c84fda9fb74be8cda9 Mon Sep 17 00:00:00 2001 +From: openEuler Buildteam <buildteam@openeuler.org> +Date: Wed, 25 Aug 2021 10:00:16 +0800 +Subject: [PATCH] revert "fix(systemd-networkd): make systemd-networkd a + proper network provider" + +This reverts commit ea779750c371102c04252b48f1b7d9c7ece7cf93 to make +network-legacy to be the network provider. +--- + modules.d/01systemd-networkd/module-setup.sh | 91 ++++++++++++---------------- + modules.d/40network/module-setup.sh | 4 +- + 2 files changed, 39 insertions(+), 56 deletions(-) + +diff --git a/modules.d/01systemd-networkd/module-setup.sh b/modules.d/01systemd-networkd/module-setup.sh +index 2f1ecb8..c0a970f 100755 +--- a/modules.d/01systemd-networkd/module-setup.sh ++++ b/modules.d/01systemd-networkd/module-setup.sh +@@ -1,79 +1,64 @@ + #!/bin/bash +-# This file is part of dracut. +-# SPDX-License-Identifier: GPL-2.0-or-later + +-# Prerequisite check(s) for module. ++# called by dracut + check() { + [[ $mount_needs ]] && return 1 + +- # If the binary(s) requirements are not fulfilled the module can't be installed +- require_binaries ip networkctl \ +- "$systemdutildir"/systemd-networkd \ +- "$systemdutildir"/systemd-network-generator \ +- "$systemdutildir"/systemd-networkd-wait-online \ +- || return 1 +- +- # Return 255 to only include the module, if another module requires it. + return 255 +- + } + +-# Module dependency requirements. ++# called by dracut + depends() { ++ echo "systemd kernel-network-modules" ++} + +- # This module has external dependency on other module(s). +- echo dbus kernel-network-modules systemd-sysusers +- # Return 0 to include the dependent module(s) in the initramfs. ++installkernel() { + return 0 +- + } + +-# Install the required file(s) and directories for the module in the initramfs. ++# called by dracut + install() { +- + inst_multiple -o \ +- "$dbussystem"/org.freedesktop.network1.conf \ +- "$dbussystemservices"/org.freedesktop.network1.service \ +- "$systemdutildir"/networkd.conf \ +- "$systemdutildir/networkd.conf.d/*.conf" \ + "$systemdutildir"/systemd-networkd \ +- "$systemdutildir"/systemd-network-generator \ + "$systemdutildir"/systemd-networkd-wait-online \ +- "$systemdutildir"/network/80-container-host0.network \ +- "$systemdutildir"/network/80-container-ve.network \ +- "$systemdutildir"/network/80-container-vz.network \ +- "$systemdutildir"/network/80-vm-vt.network \ +- "$systemdutildir"/network/80-wifi-adhoc.network \ +- "$systemdutildir"/network/99-default.link \ ++ "$systemdsystemunitdir"/systemd-networkd-wait-online.service \ + "$systemdsystemunitdir"/systemd-networkd.service \ + "$systemdsystemunitdir"/systemd-networkd.socket \ +- "$systemdsystemunitdir"/systemd-network-generator.service \ +- "$systemdsystemunitdir"/systemd-networkd-wait-online.service \ +- "$systemdsystemunitdir"/systemd-network-generator.service \ ++ "$systemdutildir"/network/99-default.link \ + networkctl ip + +- # Enable systemd type units ++ #hostnamectl timedatectl ++ # $systemdutildir/systemd-timesyncd \ ++ # $systemdutildir/systemd-timedated \ ++ # $systemdutildir/systemd-hostnamed \ ++ # $systemdutildir/systemd-resolvd \ ++ # $systemdutildir/systemd-resolve-host \ ++ # $systemdsystemunitdir/systemd-resolved.service \ ++ # $systemdsystemunitdir/systemd-hostnamed.service \ ++ # $systemdsystemunitdir/systemd-timesyncd.service \ ++ # $systemdsystemunitdir/systemd-timedated.service \ ++ # $systemdsystemunitdir/time-sync.target \ ++ # /etc/systemd/resolved.conf \ ++ ++ # inst_dir /var/lib/systemd/clock ++ ++ grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd" ++ grep '^systemd-network:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group" ++ # grep '^systemd-timesync:' "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ # grep '^systemd-timesync:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group" ++ ++ _arch=${DRACUT_ARCH:-$(uname -m)} ++ inst_libdir_file \ ++ {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \ ++ {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \ ++ {"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \ ++ {"tls/$_arch/",tls/,"$_arch/",}"libnss_resolve.so.*" ++ ++ # systemd-timesyncd.service + for i in \ ++ systemd-networkd-wait-online.service \ + systemd-networkd.service \ +- systemd-networkd.socket \ +- systemd-network-generator.service \ +- systemd-networkd-wait-online.service; do ++ systemd-networkd.socket; do + $SYSTEMCTL -q --root "$initdir" enable "$i" + done +- +- # Install the hosts local user configurations if enabled. +- if [[ $hostonly ]]; then +- inst_multiple -H -o \ +- "$systemdutilconfdir"/networkd.conf \ +- "$systemdutilconfdir/networkd.conf.d/*.conf" \ +- "$systemdutilconfdir/network/*" \ +- "$systemdsystemconfdir"/systemd-networkd.service \ +- "$systemdsystemconfdir/systemd-networkd.service/*.conf" \ +- "$systemdsystemunitdir"/systemd-networkd.socket \ +- "$systemdsystemunitdir/systemd-networkd.socket/*.conf" \ +- "$systemdsystemconfdir"/systemd-network-generator.service \ +- "$systemdsystemconfdir/systemd-network-generator.service/*.conf" \ +- "$systemdsystemconfdir"/systemd-networkd-wait-online.service \ +- "$systemdsystemconfdir/systemd-networkd-wait-online.service/*.conf" +- fi + } +diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh +index 60824da..cbb5b70 100755 +--- a/modules.d/40network/module-setup.sh ++++ b/modules.d/40network/module-setup.sh +@@ -9,7 +9,7 @@ check() { + depends() { + is_qemu_virtualized && echo -n "qemu-net " + +- for module in network-wicked network-manager network-legacy systemd-networkd; do ++ for module in network-wicked network-manager network-legacy; do + if dracut_module_included "$module"; then + network_handler="$module" + break +@@ -21,8 +21,6 @@ depends() { + network_handler="network-wicked" + elif [[ -x $dracutsysrootdir/usr/libexec/nm-initrd-generator ]]; then + network_handler="network-manager" +- elif [[ -x $dracutsysrootdir$systemdutildir/systemd-networkd ]]; then +- network_handler="systemd-networkd" + else + network_handler="network-legacy" + fi +-- +1.8.3.1 + diff --git a/skip-the-broken-sd-in-initqueue.patch b/skip-the-broken-sd-in-initqueue.patch new file mode 100644 index 0000000..fa18e88 --- /dev/null +++ b/skip-the-broken-sd-in-initqueue.patch @@ -0,0 +1,48 @@ +From 816a7dbff7128b4b87ea8d6abd2caf564f8f3502 Mon Sep 17 00:00:00 2001 +From: gaoyi <gaoyi15@huawei.com> +Date: Fri, 18 Oct 2019 10:42:55 -0400 +Subject: [PATCH] skip the broken sd in initqueue + +--- + .../98dracut-systemd/dracut-initqueue.sh | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh +index 3ddc236..c7d7888 100755 +--- a/modules.d/98dracut-systemd/dracut-initqueue.sh ++++ b/modules.d/98dracut-systemd/dracut-initqueue.sh +@@ -16,6 +16,31 @@ RDRETRY=${RDRETRY:-180} + RDRETRY=$((RDRETRY * 2)) + export RDRETRY + ++if getarg 'skipbadscsi' -d 'skipbadscsi'; then ++ sd_dir=/sys/block ++ while [ "`ls $sd_dir/`" = "" ] ++ do ++ sleep 1 ++ done ++ ++ dev_num=0 ++ for _sd_device in `ls $sd_dir/` ++ do ++ blkid /dev/$_sd_device >/dev/null 2>&1 & ++ ((dev_num++)) ++ done ++ ++ sleep $dev_num ++ ++ for _sd_device in `ps -eo cmd,stat | grep -Po "(?<=blkid /dev/).*(?=D)"` ++ do ++ echo offline > $sd_dir/$_sd_device/device/state ++ echo "Dev $_sd_device maybe broken, set it offline" > /dev/kmsg ++ done ++ ++ udevadm settle --timeout=30 ++fi ++ + main_loop=0 + export main_loop + +-- +2.19.1 + @@ -0,0 +1 @@ +0931ba8ed792600ce335adb0b064fa11 dracut-055.tar.xz diff --git a/summer-ospp-replace-isomd5sum-with-isosm3sum.patch b/summer-ospp-replace-isomd5sum-with-isosm3sum.patch new file mode 100644 index 0000000..532f0c9 --- /dev/null +++ b/summer-ospp-replace-isomd5sum-with-isosm3sum.patch @@ -0,0 +1,73 @@ +From a924671594ab5026b06088f9f5edf7146d850317 Mon Sep 17 00:00:00 2001 +From: rpm-build <rpm-build> +Date: Thu, 7 Sep 2023 03:20:57 +0000 +Subject: [PATCH] summer ospp replace isomd5sum with isosm3sum + +Signed-off-by: rpm-build <rpm-build> +--- + modules.d/90dmsquash-live/checkisosm3@.service | 14 ++++++++++++++ + modules.d/90dmsquash-live/dmsquash-live-root.sh | 4 ++-- + modules.d/90dmsquash-live/module-setup.sh | 4 ++-- + 3 files changed, 18 insertions(+), 4 deletions(-) + create mode 100644 modules.d/90dmsquash-live/checkisosm3@.service + +diff --git a/modules.d/90dmsquash-live/checkisosm3@.service b/modules.d/90dmsquash-live/checkisosm3@.service +new file mode 100644 +index 0000000..8bd24e8 +--- /dev/null ++++ b/modules.d/90dmsquash-live/checkisosm3@.service +@@ -0,0 +1,14 @@ ++[Unit] ++Description=Media check on %f ++DefaultDependencies=no ++Before=shutdown.target ++ ++[Service] ++Type=oneshot ++RemainAfterExit=no ++ExecStart=/bin/checkisosm3 --verbose %f ++StandardInput=tty-force ++StandardOutput=inherit ++StandardError=inherit ++TimeoutSec=0 ++SuccessExitStatus=2 +diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh +index 0912807..6b14dc4 100755 +--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh ++++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh +@@ -43,9 +43,9 @@ if [ -n "$check" ]; then + type plymouth > /dev/null 2>&1 && plymouth --hide-splash + if [ -n "$DRACUT_SYSTEMD" ]; then + p=$(dev_unit_name "$livedev") +- systemctl start checkisomd5@"${p}".service ++ systemctl start checkisosm3@"${p}".service + else +- checkisomd5 --verbose "$livedev" ++ checkisosm3 --verbose "$livedev" + fi + if [ $? -eq 1 ]; then + die "CD check failed!" +diff --git a/modules.d/90dmsquash-live/module-setup.sh b/modules.d/90dmsquash-live/module-setup.sh +index 70be185..7e43841 100755 +--- a/modules.d/90dmsquash-live/module-setup.sh ++++ b/modules.d/90dmsquash-live/module-setup.sh +@@ -23,7 +23,7 @@ installkernel() { + # called by dracut + install() { + inst_multiple umount dmsetup blkid dd losetup blockdev find +- inst_multiple -o checkisomd5 ++ inst_multiple -o checkisosm3 + inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh" + inst_hook cmdline 31 "$moddir/parse-iso-scan.sh" + inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh" +@@ -34,6 +34,6 @@ install() { + inst_script "$moddir/dmsquash-generator.sh" "$systemdutildir"/system-generators/dracut-dmsquash-generator + # should probably just be generally included + inst_rules 60-cdrom_id.rules +- inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service" ++ inst_simple "$moddir/checkisosm3@.service" "/etc/systemd/system/checkisosm3@.service" + dracut_need_initqueue + } +-- +2.33.0 + diff --git a/use-sleep-replace-check-sys-block.patch b/use-sleep-replace-check-sys-block.patch new file mode 100644 index 0000000..c725bdd --- /dev/null +++ b/use-sleep-replace-check-sys-block.patch @@ -0,0 +1,38 @@ +From c7f23ea749a9bb41552d3e0ce4c86d7919dfc2f4 Mon Sep 17 00:00:00 2001 +From: gaoyi <gaoyi15@huawei.com> +Date: Wed, 23 Oct 2019 12:57:01 -0400 +Subject: [PATCH] use sleep replace check /sys/block + +--- + modules.d/98dracut-systemd/dracut-initqueue.sh | 14 ++++++++++---- + 2 files changed, 10 insertions(+), 4 deletions(-) + create mode 100644 .0001-delete-MACHINE_ID-to-eliminate-difference-of-vmlinuz.patch.swp + +diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh +index c7d7888..f8c7e66 100755 +--- a/modules.d/98dracut-systemd/dracut-initqueue.sh ++++ b/modules.d/98dracut-systemd/dracut-initqueue.sh +@@ -18,10 +18,16 @@ export RDRETRY + + if getarg 'skipbadscsi' -d 'skipbadscsi'; then + sd_dir=/sys/block +- while [ "`ls $sd_dir/`" = "" ] +- do +- sleep 1 +- done ++ ++ wait_time=$(getargs 'skipbadscsi=') ++ if [ x"$wait_time" = x"skipbadscsi" ]; then ++ wait_time=15 ++ fi ++ if ! isdigit $wait_time; then ++ wait_time=15 ++ fi ++ ++ sleep $wait_time + + dev_num=0 + for _sd_device in `ls $sd_dir/` +-- +2.19.1 + |