Accepting request 333165 from Base:System

1

OBS-URL: https://build.opensuse.org/request/show/333165
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dracut?expand=0&rev=77
This commit is contained in:
Dominique Leuenberger 2015-09-27 12:32:02 +00:00 committed by Git OBS Bridge
commit 5c564f8281
8 changed files with 524 additions and 0 deletions

View File

@ -0,0 +1,17 @@
Index: dracut-043/modules.d/10i18n/module-setup.sh
===================================================================
--- dracut-043.orig/modules.d/10i18n/module-setup.sh
+++ dracut-043/modules.d/10i18n/module-setup.sh
@@ -196,7 +196,11 @@ install() {
if [[ ${FONT_MAP} ]]
then
FONT_MAP=${FONT_MAP%.trans}
- inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans
+ # There are three different formats that setfont supports
+ inst_simple ${kbddir}/consoletrans/${FONT_MAP} \
+ || inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans \
+ || inst_simple ${kbddir}/consoletrans/${FONT_MAP}_to_uni.trans \
+ || dwarn "Could not find FONT_MAP ${FONT_MAP}!"
fi
if [[ ${FONT_UNIMAP} ]]

View File

@ -0,0 +1,128 @@
From 56f390967ff87515f7269f4793b9a651f0e3b87c Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.com>
Date: Mon, 21 Sep 2015 12:37:14 +0200
Subject: [PATCH] 90crypt: Don't use systemd for crypt
- rd.luks.key is not implemented (properly) if systemd is enabled,
so ignore systemd in 90crypt
- Source of this patch:
https://github.com/jsynacek/dracut/commit/058aa18e3ec2bd6b34e6afff0f2653d742dea0f5
- Fixes boo#915849
Signed-off-by: Fabian Vogt <fvogt@suse.com>
---
modules.d/90crypt/crypt-run-generator.sh | 31 -------------------------------
modules.d/90crypt/module-setup.sh | 9 ---------
modules.d/90crypt/parse-crypt.sh | 20 --------------------
3 files changed, 60 deletions(-)
delete mode 100755 modules.d/90crypt/crypt-run-generator.sh
diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh
deleted file mode 100755
index 3c5d7b1..0000000
--- a/modules.d/90crypt/crypt-run-generator.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-. /lib/dracut-lib.sh
-type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
-
-dev=$1
-luks=$2
-
-crypttab_contains "$luks" && exit 0
-
-allowdiscards="-"
-
-# parse for allow-discards
-if strstr "$(cryptsetup --help)" "allow-discards"; then
- if discarduuids=$(getargs "rd.luks.allow-discards"); then
- discarduuids=$(str_replace "$discarduuids" 'luks-' '')
- if strstr " $discarduuids " " ${luks##luks-}"; then
- allowdiscards="allow-discards"
- fi
- elif getargbool 0 rd.luks.allow-discards; then
- allowdiscards="allow-discards"
- fi
-fi
-
-echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab
-
-if command -v systemctl >/dev/null; then
- systemctl daemon-reload
- systemctl start cryptsetup.target
-fi
-exit 0
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index 721b447..a73e4ee 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -89,14 +89,5 @@ install() {
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
inst_simple "/tmp/dracut_block_uuid.map" "/usr/lib/dracut/modules.d/90crypt/block_uuid.map"
- inst_multiple -o \
- $systemdutildir/system-generators/systemd-cryptsetup-generator \
- $systemdutildir/systemd-cryptsetup \
- $systemdsystemunitdir/systemd-ask-password-console.path \
- $systemdsystemunitdir/systemd-ask-password-console.service \
- $systemdsystemunitdir/cryptsetup.target \
- $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
- systemd-ask-password systemd-tty-ask-password-agent
- inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
dracut_need_initqueue
}
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index 5bda006..d84ff62 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -25,7 +25,6 @@ else
luksid=${luksid##luks-}
- if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
@@ -33,17 +32,6 @@ else
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
- else
- if ! crypttab_contains "$luksid"; then
- {
- printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
- printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
- printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
- printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
- printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
- } >> /etc/udev/rules.d/70-luks.rules.new
- fi
- fi
uuid=$luksid
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
@@ -56,19 +44,11 @@ else
} >> $hookdir/emergency/90-crypt.sh
done
elif getargbool 0 rd.auto; then
- if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --settled --onetime --name cryptroot-ask-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
} >> /etc/udev/rules.d/70-luks.rules.new
- else
- {
- printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
- printf -- '--unique --settled --onetime --name crypt-run-generator-%%k '
- printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
- } >> /etc/udev/rules.d/70-luks.rules.new
- fi
fi
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
--
2.5.1

View File

@ -0,0 +1,41 @@
From 11d6560d7bbd8a4c4610a39c0985e50d728920fb Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.com>
Date: Mon, 21 Sep 2015 15:15:07 +0200
Subject: [PATCH] Fix parsing of "-i" and "--include"
- dracut replaced every instance of "-i" in the cmdline,
even if it was part of a kernel image name, e.g. "vmlinuz-i"
- Fixes boo#908452
Signed-off-by: Fabian Vogt <fvogt@suse.com>
---
dracut.sh | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Index: dracut-043/dracut.sh
===================================================================
--- dracut-043.orig/dracut.sh
+++ dracut-043/dracut.sh
@@ -310,11 +310,17 @@ dropindirs_sort()
rearrange_params()
{
# Workaround -i, --include taking 2 arguments
- set -- "${@/--include/++include}"
-
- # This prevents any long argument ending with "-i"
- # -i, like --opt-i but I think we can just prevent that
- set -- "${@/%-i/++include}"
+ newat=()
+ for i in "$@"; do
+ if [[ $i =~ ^-i(.*) ]]; then
+ newat+=("++include" "${BASH_REMATCH[1]}") # Replace -i by ++include
+ elif [[ $i == "--include" ]]; then
+ newat+=("++include") # Replace --include by ++include
+ else
+ newat+=("$i")
+ fi
+ done
+ set -- "${newat[@]}" # Set new $@
TEMP=$(unset POSIXLY_CORRECT; getopt \
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \

View File

@ -0,0 +1,28 @@
From d774a6f49771b9f55de2956c3c0038a7655b6e94 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.com>
Date: Wed, 23 Sep 2015 12:12:08 +0200
Subject: [PATCH] Fix possible hang in dracut
- Caused by add_drivers+=" " in dracut.conf (bsc#923116)
Signed-off-by: Fabian Vogt <fvogt@suse.com>
---
dracut.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut.sh b/dracut.sh
index 44b8a3d..11a4a2e 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1501,7 +1501,7 @@ if [[ $no_kernel != yes ]]; then
hostonly='' instmods $drivers
fi
- if [[ $add_drivers ]]; then
+ if [[ -n "${add_drivers// }" ]]; then
hostonly='' instmods -c $add_drivers
fi
if [[ $force_drivers ]]; then
--
2.5.1

View File

@ -0,0 +1,185 @@
From: Fabian Vogt <fvogt@suse.com>
Subject: Use /etc/fstab for /sysroot instead of custom sysroot.mount
systemd-fstab-generator is capable of mounting /sysroot itself,
looking at /proc/cmdline if root= is set.
Index: dracut-043/modules.d/00systemd/module-setup.sh
===================================================================
--- dracut-043.orig/modules.d/00systemd/module-setup.sh
+++ dracut-043/modules.d/00systemd/module-setup.sh
@@ -14,7 +14,7 @@ check() {
# called by dracut
depends() {
- return 0
+ echo fs-lib
}
installkernel() {
@@ -22,6 +22,23 @@ installkernel() {
instmods -s efivarfs
}
+fstab_sysroot() {
+ local _dev=/dev/block/$(find_root_block_device)
+ local _fstype _flags _subvol
+ if [ -e $_dev ]; then
+ _dev=$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")
+ _fstype="$(find_mp_fstype /)"
+ _flags="$(find_mp_fsopts /)"
+
+ if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then
+ _subvol=$(findmnt -e -v -n -o FSROOT --target /) \
+ && _subvol=${_subvol#/}
+ _flags="$_flags,${_subvol:+subvol=$_subvol}"
+ fi
+ printf "%s /sysroot %s %s 1 1\n" "$_dev" "$_fstype" "${_flags#,}"
+ fi
+}
+
# called by dracut
install() {
local _mods
@@ -216,5 +233,8 @@ install() {
} >> "$initdir/etc/systemd/journald.conf"
ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"
+
+ # Add entry for /sysroot to /etc/fstab
+ fstab_sysroot >> "$initdir/etc/fstab"
}
Index: dracut-043/modules.d/95rootfs-block/module-setup.sh
===================================================================
--- dracut-043.orig/modules.d/95rootfs-block/module-setup.sh
+++ dracut-043/modules.d/95rootfs-block/module-setup.sh
@@ -48,22 +48,25 @@ cmdline_rootfs() {
# called by dracut
cmdline() {
- cmdline_rootfs
- cmdline_journal
+ # When using systemd, we're storing the root device in /etc/fstab instead.
+ if ! dracut_module_included "systemd"; then
+ cmdline_rootfs
+ cmdline_journal
+ fi
}
# called by dracut
install() {
- if [[ $hostonly_cmdline == "yes" ]]; then
- local _journaldev=$(cmdline_journal)
- [[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
- local _rootdev=$(cmdline_rootfs)
- [[ $_rootdev ]] && printf "%s\n" "$_rootdev" >> "${initdir}/etc/cmdline.d/95root-dev.conf"
- fi
-
inst_multiple umount
inst_multiple tr
if ! dracut_module_included "systemd"; then
+ if [[ $hostonly_cmdline == "yes" ]]; then
+ local _journaldev=$(cmdline_journal)
+ [[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
+ local _rootdev=$(cmdline_rootfs)
+ [[ $_rootdev ]] && printf "%s\n" "$_rootdev" >> "${initdir}/etc/cmdline.d/95root-dev.conf"
+ fi
+
inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
Index: dracut-043/modules.d/98dracut-systemd/dracut-cmdline.sh
===================================================================
--- dracut-043.orig/modules.d/98dracut-systemd/dracut-cmdline.sh
+++ dracut-043/modules.d/98dracut-systemd/dracut-cmdline.sh
@@ -68,8 +68,12 @@ case "$root" in
rootok=1 ;;
esac
-[ -z "$root" ] && die "No or empty root= argument"
-[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
+if [ -z "$root" ]; then
+ root=$(findmnt --fstab -n --output source --target /sysroot)
+ [ -z "$root" ] && die "No or empty root= argument and not in fstab"
+elif [ -z "$rootok" ]; then
+ die "Don't know how to handle 'root=$root'"
+fi
export root rflags fstype netroot NEWROOT
Index: dracut-043/modules.d/98dracut-systemd/rootfs-generator.sh
===================================================================
--- dracut-043.orig/modules.d/98dracut-systemd/rootfs-generator.sh
+++ dracut-043/modules.d/98dracut-systemd/rootfs-generator.sh
@@ -36,35 +36,6 @@ generator_wait_for_dev()
fi
}
-generator_mount_rootfs()
-{
- local _type=$2
- local _flags=$3
- local _name
-
- [ -z "$1" ] && return 0
-
- _name=$(dev_unit_name "$1")
- [ -d "$GENERATOR_DIR" ] || mkdir -p "$GENERATOR_DIR"
- if ! [ -f "$GENERATOR_DIR"/sysroot.mount ]; then
- {
- echo "[Unit]"
- echo "Before=initrd-root-fs.target"
- echo "RequiresOverridable=systemd-fsck@${_name}.service"
- echo "After=systemd-fsck@${_name}.service"
- echo "[Mount]"
- echo "Where=/sysroot"
- echo "What=$1"
- echo "Options=${_flags}"
- echo "Type=${_type}"
- } > "$GENERATOR_DIR"/sysroot.mount
- fi
- if ! [ -L "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount ]; then
- [ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires
- ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
- fi
-}
-
generator_fsck_after_pre_mount()
{
local _name
@@ -111,9 +82,12 @@ esac
GENERATOR_DIR="$1"
if [ "${root%%:*}" = "block" ]; then
- generator_wait_for_dev "${root#block:}" "$RDRETRY"
- generator_fsck_after_pre_mount "${root#block:}"
- strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
+ generator_wait_for_dev "${root#block:}" "$RDRETRY"
+ generator_fsck_after_pre_mount "${root#block:}"
+ if ! [ -L "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount ]; then
+ [ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires
+ ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
+ fi
fi
exit 0
Index: dracut-043/modules.d/99base/init.sh
===================================================================
--- dracut-043.orig/modules.d/99base/init.sh
+++ dracut-043/modules.d/99base/init.sh
@@ -128,8 +128,12 @@ make_trace_mem "hook cmdline" '1+:mem' '
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline
-[ -z "$root" ] && die "No or empty root= argument"
-[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
+if [ -z "$root" ]; then
+ root=$(findmnt --fstab -n --output source --target /sysroot)
+ [ -z "$root" ] && die "No or empty root= argument and not in fstab"
+elif [ -z "$rootok" ]; then
+ die "Don't know how to handle 'root=$root'"
+fi
export root rflags fstype netroot NEWROOT

View File

@ -0,0 +1,57 @@
From: Fabian Vogt <fvogt@suse.com>
Subject: dracut.sh: Support --mount with just mountpoint as parameter
Right now the --mount parameter of dracut expects a rather long fstab-like
line. This makes it possible to invoke dracut with e.g. --mount /boot.
Index: dracut-043/dracut.8.asc
===================================================================
--- dracut-043.orig/dracut.8.asc
+++ dracut-043/dracut.8.asc
@@ -338,6 +338,10 @@ provide a valid _/etc/fstab_.
The default _<dump frequency>_ is "0".
the default _<fsck order>_ is "2".
+**--mount** "_<mountpoint>_"::
+ Like above, but _<device>_, _<filesystem type>_ and _<filesystem options>_
+ are determined by looking at the current mounts.
+
**--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
Index: dracut-043/dracut.sh
===================================================================
--- dracut-043.orig/dracut.sh
+++ dracut-043/dracut.sh
@@ -152,6 +152,8 @@ Creates initial ramdisk images for prelo
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
Mount device [DEV] on mountpoint [MP] with filesystem
[FSTYPE] and options [FSOPTS] in the initramfs
+ --mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are
+ determined by looking at the current mounts.
--add-device "[DEV]" Bring up [DEV] in initramfs
-i, --include [SOURCE] [TARGET]
Include the files in the SOURCE directory into the
@@ -1536,9 +1538,21 @@ if [[ $kernel_only != yes ]]; then
while pop fstab_lines line; do
line=($line)
- [ -z "${line[3]}" ] && line[3]="defaults"
+
+ if [ -z "${line[1]}" ]; then
+ # Determine device and mount options from current system
+ mountpoint -q "${line[0]}" || derror "${line[0]} is not a mount point!"
+ line=($(findmnt --raw -n --target "${line[0]}" --output=source,target,fstype,options))
+ dinfo "Line for ${line[1]}: ${line[@]}"
+ else
+ # Use default options
+ [ -z "${line[3]}" ] && line[3]="defaults"
+ fi
+
+ # Default options for freq and passno
[ -z "${line[4]}" ] && line[4]="0"
[ -z "${line[5]}" ] && line[5]="2"
+
strstr "${line[2]}" "nfs" && line[5]="0"
echo "${line[@]}" >> "${initdir}/etc/fstab"
done

View File

@ -1,3 +1,57 @@
-------------------------------------------------------------------
Wed Sep 23 11:26:05 UTC 2015 - fvogt@suse.com
- Fix 0182-fix-include-parsing.patch
- Didn't parse arguments with spaces correctly
-------------------------------------------------------------------
Wed Sep 23 10:16:47 UTC 2015 - fvogt@suse.com
- Add patch 0183-fix_add_drivers_hang.patch:
- Fix possible hang in dracut
caused by add_drivers+=" " in dracut.conf (bsc#923116)
-------------------------------------------------------------------
Mon Sep 21 13:18:43 UTC 2015 - fvogt@suse.com
- Add patch 0182-fix-include-parsing.patch:
- Fix parsing of "-i" and "--include"
- Fixes boo#908452
-------------------------------------------------------------------
Mon Sep 21 10:45:14 UTC 2015 - fvogt@suse.com
- Add patch 0181-no_systemd_cryptsetup.patch:
- rd.luks.key is not implemented (properly) if systemd is enabled,
so ignore systemd in 90crypt
- Fixes boo#915849
-------------------------------------------------------------------
Wed Sep 16 12:12:12 UTC 2015 - fvogt@suse.com
- Fix systemd-vconsole-error properly (bsc#943312 and bsc#932981)
Rewrite 0180-dracut-add-trivial-vconsole-fontmap.patch
as 0180-i18n_add_correct_fontmaps.patch
-------------------------------------------------------------------
Mon Sep 14 11:33:51 UTC 2015 - thomas.blume@suse.com
- fix systemd-vconsole-error in initrd (bsc#943312)
Add 0180-dracut-add-trivial-vconsole-fontmap.patch
-------------------------------------------------------------------
Fri Sep 11 11:06:46 UTC 2015 - fvogt@suse.com
- Add 0401-mount_option_mountpoint.patch:
Make it possible to use a mountpoint as --mount parameter
-------------------------------------------------------------------
Fri Sep 11 10:56:42 UTC 2015 - fvogt@suse.com
- Add experimental 0400-use_fstab_systemd.patch:
Add entry for /sysroot in /etc/fstab instead of relying
on root= and rootflags=
-------------------------------------------------------------------
Sun Aug 23 19:14:15 UTC 2015 - seife+obs@b1-systems.com

View File

@ -101,6 +101,10 @@ Patch163: 0163-Install-etc-sysconfig-console-to-see-specific-fonts.patch
Patch164: 0164-Fix-initramfs-ver.img-vs-initrd-ver-in-dracut-initra.patch
Patch165: 0165-Order-root-fsck-after-pre-mount.patch
Patch168: 0168-remove_plymouth_logo_file.patch
Patch180: 0180-i18n_add_correct_fontmaps.patch
Patch181: 0181-no_systemd_cryptsetup.patch
Patch182: 0182-fix-include-parsing.patch
Patch183: 0183-fix_add_drivers_hang.patch
# Still needed
Patch133: 0133-Allow-multiple-configurations-per-network-interface-.patch
@ -116,6 +120,9 @@ Patch202: dracut_dmraid_use_udev.patch
## fix for SUSE systems which have dpkg installed anyway
Patch300: dracut_dont_use_dpkg_defaults_on_SUSE.patch
Patch400: 0400-use_fstab_systemd.patch
Patch401: 0401-mount_option_mountpoint.patch
BuildRequires: asciidoc
BuildRequires: bash
BuildRequires: docbook-xsl-stylesheets
@ -238,6 +245,10 @@ and its cryptography during startup.
%patch164 -p1
%patch165 -p1
%patch168 -p1
%patch180 -p1
%patch181 -p1
%patch182 -p1
%patch183 -p1
%patch200 -p1
%patch201 -p1
@ -245,6 +256,9 @@ and its cryptography during startup.
%patch300 -p1
%patch400 -p1
%patch401 -p1
%build
%configure\
--systemdsystemunitdir=%{_unitdir}\