diff options
author | Amadeusz Żołnowski <aidecoe@gentoo.org> | 2012-07-26 17:52:12 +0000 |
---|---|---|
committer | Amadeusz Żołnowski <aidecoe@gentoo.org> | 2012-07-26 17:52:12 +0000 |
commit | c994e8f72c4e3feabda7d48a89eaa94ef740b6fc (patch) | |
tree | cdfefd4122f48aca51025a4a0dcc41a532c8353b /sys-kernel/dracut/files | |
parent | Revision bump to create a stable candidate without rbx. (diff) | |
download | historical-c994e8f72c4e3feabda7d48a89eaa94ef740b6fc.tar.gz historical-c994e8f72c4e3feabda7d48a89eaa94ef740b6fc.tar.bz2 historical-c994e8f72c4e3feabda7d48a89eaa94ef740b6fc.zip |
Version bump to 022. 020 and 021 has been skipped.
This version is heavily patched to support /usr mounting the way OpenRC team
expects. Patches also include few more customizations and fixes for Gentoo.
Changes since 019
=================
020
~~~
- arm kernel modules added to kernel-modules
- make udevdir systemdutildir systemdsystemunitdir global vars
your distribution should ship those settings in
/etc/dracut.conf.d/01-distro.conf
see dracut.conf.d/fedora.conf.example
- kernel modules are now only handled with /sys/modules and modules.dep
- systemd fixups
- mdraid: wait for md devices to be clean, before shutdown
- ifup fixed for ipv6
- add PARTUUID as root=PARTUUID=<partition uuid> parameter
- fixed instmods() return code and set pipefail globally
- add 04watchdog dracut module
- dracut-shutdown.service: fixed ordering to be before shutdown.target
- make use of "ln -r" instead of shell functions, if new coreutils is
installed
- network: support vlan tagged bonding
- new dracut module qemu and qemu-net to install all kernel driver
- fs-lib/fs-lib.sh: removed test mounting of btrfs and xfs
- no more "mknod" in the initramfs!!
- replaced all "tr" calls with "sed"
- speedup with lazy kernel module dependency resolving
- lots of speedup optimizations
- dracut-install:
- new binary to significanlty speedup the installation process
- dracut-functions.sh makes use of it, if installed
021
~~~
- fixed systemd in the initramfs (requires systemd >= 187)
- dracut-install: massive speedup with /var on the same filesystem with COW
copy
- new options: "rd.usrmount.ro" and "rd.skipfsck"
- less mount/umount
- apply "ro" on the kernel command line also to /usr
- mount according to fstab, if neither "ro" or "rw" is specified
- skip fsck for xfs and btrfs. remount is enough
- give emergency_shell if /usr mount failed
- dracut now uses getopt:
* options can be position independent now!!
* we can now use --option=<arg>
- added option "--kver=<kernel-version>", and the image location can be
omitted
- dracut.sh: for --include copy also the symbolic links
- man pages: lsinitrd and mkinitrd added
- network: We do not support renaming in the kernel namespace anymore
(as udev does that not anymore). So, if a user wants to use ifname, he has
to rename to a custom namespace. "eth[0-9]+" is not allowed anymore. !!!!!
- resume: moved the resume process to the initqueue.
This should prevent accidently mounting the root file system.
022
~~~
- fixed host-only kernel module bug
Package-Manager: portage-2.1.11.9/cvs/Linux x86_64
Diffstat (limited to 'sys-kernel/dracut/files')
15 files changed, 784 insertions, 0 deletions
diff --git a/sys-kernel/dracut/files/022-0001-qemu-module-setup.sh-provide-alternati.patch b/sys-kernel/dracut/files/022-0001-qemu-module-setup.sh-provide-alternati.patch new file mode 100644 index 000000000000..fd8a472dd8cc --- /dev/null +++ b/sys-kernel/dracut/files/022-0001-qemu-module-setup.sh-provide-alternati.patch @@ -0,0 +1,73 @@ +From e72c3bf925e277f43d1c412f6a6bc9115a2257d5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer <harald@redhat.com> +Date: Wed, 25 Jul 2012 16:03:49 +0200 +Subject: [PATCH 01/14] qemu*/module-setup.sh: provide alternative for + systemd-detect-virt + +--- + modules.d/90qemu-net/module-setup.sh | 19 +++++++++++++++---- + modules.d/90qemu/module-setup.sh | 18 ++++++++++++++---- + 2 files changed, 29 insertions(+), 8 deletions(-) + +diff --git a/modules.d/90qemu-net/module-setup.sh b/modules.d/90qemu-net/module-setup.sh +index 35c8f0f..e617230 100755 +--- a/modules.d/90qemu-net/module-setup.sh ++++ b/modules.d/90qemu-net/module-setup.sh +@@ -3,10 +3,21 @@ + # ex: ts=8 sw=4 sts=4 et filetype=sh + + check() { +- vm=$(systemd-detect-virt --vm &>/dev/null) +- (($? != 0)) && return 255 +- [[ $vm = "qemu" ]] && return 0 +- [[ $vm = "kvm" ]] && return 0 ++ if type -P systemd-detect-virt &>/dev/null; then ++ vm=$(systemd-detect-virt --vm &>/dev/null) ++ (($? != 0)) && return 255 ++ [[ $vm = "qemu" ]] && return 0 ++ [[ $vm = "kvm" ]] && return 0 ++ [[ $vm = "bochs" ]] && return 0 ++ fi ++ ++ for i in /sys/class/dmi/id/*_vendor; do ++ [[ -f $i ]] || continue ++ read vendor < $i ++ [[ "$vendor" == "QEMU" ]] && return 0 ++ [[ "$vendor" == "Bochs" ]] && return 0 ++ done ++ + return 255 + } + +diff --git a/modules.d/90qemu/module-setup.sh b/modules.d/90qemu/module-setup.sh +index 3e55f23..fc258ac 100755 +--- a/modules.d/90qemu/module-setup.sh ++++ b/modules.d/90qemu/module-setup.sh +@@ -3,10 +3,20 @@ + # ex: ts=8 sw=4 sts=4 et filetype=sh + + check() { +- vm=$(systemd-detect-virt --vm &>/dev/null) +- (($? != 0)) && return 255 +- [[ $vm = "qemu" ]] && return 0 +- [[ $vm = "kvm" ]] && return 0 ++ if type -P systemd-detect-virt &>/dev/null; then ++ vm=$(systemd-detect-virt --vm &>/dev/null) ++ (($? != 0)) && return 255 ++ [[ $vm = "qemu" ]] && return 0 ++ [[ $vm = "kvm" ]] && return 0 ++ [[ $vm = "bochs" ]] && return 0 ++ fi ++ ++ for i in /sys/class/dmi/id/*_vendor; do ++ [[ -f $i ]] || continue ++ read vendor < $i ++ [[ "$vendor" == "QEMU" ]] && return 0 ++ [[ "$vendor" == "Bochs" ]] && return 0 ++ done + return 255 + } + +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0002-Makefile-use-implicit-rules-for-instal.patch b/sys-kernel/dracut/files/022-0002-Makefile-use-implicit-rules-for-instal.patch new file mode 100644 index 000000000000..042a6ce5ef80 --- /dev/null +++ b/sys-kernel/dracut/files/022-0002-Makefile-use-implicit-rules-for-instal.patch @@ -0,0 +1,84 @@ +From e1199b1fdcf09549cf415bb96a34d14633324719 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Wed, 25 Jul 2012 20:37:06 +0200 +Subject: [PATCH 02/14] Makefile: use implicit rules for + install/dracut-install + +Don't fail on install rule if install/dracut-install is not build - just +skip it. $(strip) is not used by install rule, because it is nowhere +set. + +Conflicts: + + Makefile +--- + Makefile | 29 ++++++++++++++--------------- + 1 files changed, 14 insertions(+), 15 deletions(-) + +diff --git a/Makefile b/Makefile +index 0b29161..e36c2c2 100644 +--- a/Makefile ++++ b/Makefile +@@ -8,6 +8,8 @@ pkglibdir ?= ${libdir}/dracut + sysconfdir ?= ${prefix}/etc + bindir ?= ${prefix}/bin + mandir ?= ${prefix}/share/man ++CFLAGS ?= -O2 -g -Wall ++CFLAGS += -std=gnu99 + + manpages = dracut.8 \ + dracut.cmdline.7 \ +@@ -18,22 +20,17 @@ manpages = dracut.8 \ + + .PHONY: install clean archive rpm testimage test all check AUTHORS doc + +-all: syncheck dracut-version.sh dracut-install ++DRACUT_INSTALL_BIN = install/dracut-install + +-DRACUT_INSTALL_SOURCE = \ +- install/dracut-install.c \ +- install/hashmap.c\ +- install/log.c \ +- install/util.c ++DRACUT_INSTALL_OBJECTS = \ ++ install/dracut-install.o \ ++ install/hashmap.o\ ++ install/log.o \ ++ install/util.o + +-DRACUT_INSTALL_HEADER = \ +- install/hashmap.h \ +- install/log.h \ +- install/macro.h \ +- install/util.h ++all: syncheck dracut-version.sh $(DRACUT_INSTALL_BIN) + +-dracut-install: $(DRACUT_INSTALL_SOURCE) $(DRACUT_INSTALL_HEADER) +- gcc -std=gnu99 -O2 -g -Wall -o dracut-install $(DRACUT_INSTALL_SOURCE) ++$(DRACUT_INSTALL_BIN): $(DRACUT_INSTALL_OBJECTS) + + indent: + indent -i8 -nut -br -linux -l120 install/dracut-install.c +@@ -88,7 +85,9 @@ install: doc dracut-version.sh + ln -s ../dracut-shutdown.service \ + $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \ + fi +- install $(strip) -m 0755 dracut-install $(DESTDIR)$(pkglibdir)/dracut-install ++ if [ -x $(DRACUT_INSTALL_BIN) ]; then \ ++ install -m 0755 $(DRACUT_INSTALL_BIN) $(DESTDIR)$(pkglibdir)/dracut-install; \ ++ fi + + dracut-version.sh: + @echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh +@@ -99,7 +98,7 @@ clean: + $(RM) */*/*~ + $(RM) test-*.img + $(RM) dracut-*.rpm dracut-*.tar.bz2 +- $(RM) dracut-install ++ $(RM) $(DRACUT_INSTALL_BIN) $(DRACUT_INSTALL_OBJECTS) + $(RM) $(manpages) dracut.html + $(MAKE) -C test clean + +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0003-kernel-modules-module-setup.sh-just-op.patch b/sys-kernel/dracut/files/022-0003-kernel-modules-module-setup.sh-just-op.patch new file mode 100644 index 000000000000..be8670c10535 --- /dev/null +++ b/sys-kernel/dracut/files/022-0003-kernel-modules-module-setup.sh-just-op.patch @@ -0,0 +1,29 @@ +From 418f79110e8df91cec5bdc23dd123555515c3e86 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer <harald@redhat.com> +Date: Mon, 23 Jul 2012 15:40:20 +0200 +Subject: [PATCH 03/14] kernel-modules/module-setup.sh: just optionally + install all modprobe.d + +Conflicts: + + modules.d/90kernel-modules/module-setup.sh +--- + modules.d/90kernel-modules/module-setup.sh | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index f309de8..1632367 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -77,7 +77,7 @@ installkernel() { + install() { + local _f i + [ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf +- dracut_install $(find -L /{etc,lib}/modprobe.d/ -maxdepth 1 -type f -name '*.conf') ++ dracut_install -o /{etc,lib}/modprobe.d/*.conf + inst_hook cmdline 01 "$moddir/parse-kernel.sh" + inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh + } +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0004-90multipath-added-kpartx.rules-multipa.patch b/sys-kernel/dracut/files/022-0004-90multipath-added-kpartx.rules-multipa.patch new file mode 100644 index 000000000000..04a0d079c03e --- /dev/null +++ b/sys-kernel/dracut/files/022-0004-90multipath-added-kpartx.rules-multipa.patch @@ -0,0 +1,25 @@ +From 2a45f1926adebc78940358d323d85ce89499eb0f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Sat, 9 Jun 2012 14:18:56 +0200 +Subject: [PATCH 04/14] 90multipath: added kpartx.rules; multipath.rules - + different prefix + +--- + modules.d/90multipath/module-setup.sh | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh +index 5944d25..69c4441 100755 +--- a/modules.d/90multipath/module-setup.sh ++++ b/modules.d/90multipath/module-setup.sh +@@ -85,6 +85,6 @@ install() { + + inst_hook pre-trigger 02 "$moddir/multipathd.sh" + inst_hook cleanup 02 "$moddir/multipathd-stop.sh" +- inst_rules 40-multipath.rules ++ inst_rules 40-multipath.rules 65-multipath.rules 66-kpartx.rules + } + +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0005-gentoo.conf-set-udevdir.patch b/sys-kernel/dracut/files/022-0005-gentoo.conf-set-udevdir.patch new file mode 100644 index 000000000000..787824783ed8 --- /dev/null +++ b/sys-kernel/dracut/files/022-0005-gentoo.conf-set-udevdir.patch @@ -0,0 +1,25 @@ +From 58eb0686d99510c2b7c5e1296c8487de83ab6d5b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 09:35:58 +0200 +Subject: [PATCH 05/14] gentoo.conf: set udevdir + +--- + dracut.conf.d/gentoo.conf.example | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/dracut.conf.d/gentoo.conf.example b/dracut.conf.d/gentoo.conf.example +index a40b746..6e4d89f 100644 +--- a/dracut.conf.d/gentoo.conf.example ++++ b/dracut.conf.d/gentoo.conf.example +@@ -1,6 +1,8 @@ + # /etc/dracut.conf.d/gentoo.conf + # Dracut config file customized for Gentoo Base System release 1 + ++udevdir=/lib/udev ++ + # + # Modules + # +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0006-Config-file-for-systemd-on-Gentoo.patch b/sys-kernel/dracut/files/022-0006-Config-file-for-systemd-on-Gentoo.patch new file mode 100644 index 000000000000..cba84af218a3 --- /dev/null +++ b/sys-kernel/dracut/files/022-0006-Config-file-for-systemd-on-Gentoo.patch @@ -0,0 +1,24 @@ +From 6046e77c8d71663a0cbe643d6410c3115c502256 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 09:35:57 +0200 +Subject: [PATCH 06/14] Config file for systemd on Gentoo. + +--- + dracut.conf.d/gentoo-systemd.conf.example | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + create mode 100644 dracut.conf.d/gentoo-systemd.conf.example + +diff --git a/dracut.conf.d/gentoo-systemd.conf.example b/dracut.conf.d/gentoo-systemd.conf.example +new file mode 100644 +index 0000000..00af70b +--- /dev/null ++++ b/dracut.conf.d/gentoo-systemd.conf.example +@@ -0,0 +1,5 @@ ++# /etc/dracut.conf.d/gentoo-systemd.conf ++ ++# Paths of systemd dirs on Gentoo ++systemdutildir=/usr/lib/systemd ++systemdsystemunitdir=/usr/lib/systemd/system +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0007-Remove-obsolete-gentoo-conf-file.patch b/sys-kernel/dracut/files/022-0007-Remove-obsolete-gentoo-conf-file.patch new file mode 100644 index 000000000000..60fd03c71209 --- /dev/null +++ b/sys-kernel/dracut/files/022-0007-Remove-obsolete-gentoo-conf-file.patch @@ -0,0 +1,47 @@ +From f4b47f9394194140a6703b4ace34b81637fe69dc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 09:35:56 +0200 +Subject: [PATCH 07/14] Remove obsolete gentoo conf file. + +--- + dracut.conf.d/gentoo-openrc.conf.example | 9 --------- + dracut.conf.d/gentoo.conf.example | 6 +++--- + 2 files changed, 3 insertions(+), 12 deletions(-) + delete mode 100644 dracut.conf.d/gentoo-openrc.conf.example + +diff --git a/dracut.conf.d/gentoo-openrc.conf.example b/dracut.conf.d/gentoo-openrc.conf.example +deleted file mode 100644 +index f5aa8ed..0000000 +--- a/dracut.conf.d/gentoo-openrc.conf.example ++++ /dev/null +@@ -1,9 +0,0 @@ +-# /etc/dracut.conf.d/gentoo-openrc.conf +-# Dracut config file customized for Gentoo Base System release 2 +- +-# +-# Modules +-# +- +-# i18n +-i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE" +diff --git a/dracut.conf.d/gentoo.conf.example b/dracut.conf.d/gentoo.conf.example +index 6e4d89f..411f9a0 100644 +--- a/dracut.conf.d/gentoo.conf.example ++++ b/dracut.conf.d/gentoo.conf.example +@@ -1,5 +1,5 @@ +-# /etc/dracut.conf.d/gentoo.conf +-# Dracut config file customized for Gentoo Base System release 1 ++# /etc/dracut.conf.d/gentoo-openrc.conf ++# Dracut config file customized for Gentoo Base System release 2 + + udevdir=/lib/udev + +@@ -8,4 +8,4 @@ udevdir=/lib/udev + # + + # i18n +-i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE" ++i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE" +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0008-95rootfs-block-fix-left-fsck-rel.-chec.patch b/sys-kernel/dracut/files/022-0008-95rootfs-block-fix-left-fsck-rel.-chec.patch new file mode 100644 index 000000000000..5af026b822ff --- /dev/null +++ b/sys-kernel/dracut/files/022-0008-95rootfs-block-fix-left-fsck-rel.-chec.patch @@ -0,0 +1,45 @@ +From 5f2516a386ee422e75ec567f7af6abba84e06083 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 11:32:13 +0200 +Subject: [PATCH 08/14] 95rootfs-block: fix left fsck rel. checks + +--- + modules.d/95rootfs-block/mount-root.sh | 14 ++++++++------ + 1 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh +index e61b0e8..8259ff9 100755 +--- a/modules.d/95rootfs-block/mount-root.sh ++++ b/modules.d/95rootfs-block/mount-root.sh +@@ -52,11 +52,11 @@ mount_root() { + fastboot=yes + fi + +- if [ -f "$NEWROOT"/fsckoptions ]; then +- fsckoptions=$(cat "$NEWROOT"/fsckoptions) +- fi +- + if ! getargbool 0 rd.skipfsck; then ++ if [ -f "$NEWROOT"/fsckoptions ]; then ++ fsckoptions=$(cat "$NEWROOT"/fsckoptions) ++ fi ++ + if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then + fsckoptions="-f $fsckoptions" + elif [ -f "$NEWROOT"/.autofsck ]; then +@@ -130,8 +130,10 @@ mount_root() { + mount -o remount "$NEWROOT" 2>&1 | vinfo + fi + +- [ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null +- [ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null ++ if ! getargbool 0 rd.skipfsck; then ++ [ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null ++ [ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null ++ fi + } + + if [ -n "$root" -a -z "${root%%block:*}" ]; then +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0009-98usrmount-use-rw-and-ro-options-inste.patch b/sys-kernel/dracut/files/022-0009-98usrmount-use-rw-and-ro-options-inste.patch new file mode 100644 index 000000000000..565b24100952 --- /dev/null +++ b/sys-kernel/dracut/files/022-0009-98usrmount-use-rw-and-ro-options-inste.patch @@ -0,0 +1,82 @@ +From ff628b5614be607925fddd22c591ab9eda9c33c8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 12:31:30 +0200 +Subject: [PATCH 09/14] 98usrmount: use rw and ro options instead of + rd.usrmount.ro + +In result /usr is forced to be mounted ro or rw along with /. +--- + dracut.cmdline.7.asc | 12 ++++++++---- + modules.d/98usrmount/mount-usr.sh | 18 +++++++++--------- + 2 files changed, 17 insertions(+), 13 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index 755d641..8f642f3 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -61,6 +61,14 @@ rootfstype=ext3 + _/etc/fstab_ of the real root will be parsed for special mount options and + mounted accordingly. + ++**ro**:: ++ force mounting _/_ and _/usr_ (if it is a separate device) read-only. If ++ none of ro and rw is present, both are mounted according to _/etc/fstab_. ++ ++**rw**:: ++ force mounting _/_ and _/usr_ (if it is a separate device) read-write. ++ See also ro option. ++ + **rd.fstab=0**:: + do not honor special mount options for the root filesystem found in + _/etc/fstab_ of the real root. +@@ -81,10 +89,6 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7 + the init system performs fsck before remount, you might want to use this + option to avoid duplication. + +-**rd.usrmount.ro**: +- force mounting _/usr_ read-only. Use this option if your init system +- performs remount of _/usr_ the same as it does with rootfs. +- + + Misc + ~~~~ +diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh +index c277d74..98e08e3 100755 +--- a/modules.d/98usrmount/mount-usr.sh ++++ b/modules.d/98usrmount/mount-usr.sh +@@ -57,9 +57,12 @@ mount_usr() + [ -n "$rflags" ]; then + # for btrfs subvolumes we have to mount /usr with the same rflags + _opts="${_opts:+${_opts},}${rflags}" +- elif getarg ro; then +- # if "ro" is specified, we want /usr to be readonly, too ++ elif getargbool 0 ro; then ++ # if "ro" is specified, we want /usr to be mounted read-only + _opts="${_opts:+${_opts},}ro" ++ elif getargbool 0 rw; then ++ # if "rw" is specified, we want /usr to be mounted read-write ++ _opts="${_opts:+${_opts},}rw" + fi + echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_freq $_passno" + _usr_found="1" +@@ -77,13 +80,10 @@ mount_usr() + [ $_fsck_ret -ne 255 ] && echo $_fsck_ret >/run/initramfs/usr-fsck + fi + fi +- if getargbool 0 rd.usrmount.ro; then +- info "Mounting /usr (read-only forced)" +- mount -r "$NEWROOT/usr" 2>&1 | vinfo +- else +- info "Mounting /usr" +- mount "$NEWROOT/usr" 2>&1 | vinfo +- fi ++ ++ info "Mounting /usr" ++ mount "$NEWROOT/usr" 2>&1 | vinfo ++ + if ! ismounted "$NEWROOT/usr"; then + warn "Mounting /usr to $NEWROOT/usr failed" + warn "*** Dropping you to a shell; the system will continue" +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0010-98usrmount-print-mount-options.patch b/sys-kernel/dracut/files/022-0010-98usrmount-print-mount-options.patch new file mode 100644 index 000000000000..f45e7f76504d --- /dev/null +++ b/sys-kernel/dracut/files/022-0010-98usrmount-print-mount-options.patch @@ -0,0 +1,25 @@ +From d5ed8b1f8b1240f31953a45992cbc92ee23601bc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 14:54:19 +0200 +Subject: [PATCH 10/14] 98usrmount: print mount options + +--- + modules.d/98usrmount/mount-usr.sh | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/modules.d/98usrmount/mount-usr.sh b/modules.d/98usrmount/mount-usr.sh +index 98e08e3..f4d59b3 100755 +--- a/modules.d/98usrmount/mount-usr.sh ++++ b/modules.d/98usrmount/mount-usr.sh +@@ -81,7 +81,7 @@ mount_usr() + fi + fi + +- info "Mounting /usr" ++ info "Mounting /usr with -o $_opts" + mount "$NEWROOT/usr" 2>&1 | vinfo + + if ! ismounted "$NEWROOT/usr"; then +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0011-dracut-lib-new-functions-listlist-and-.patch b/sys-kernel/dracut/files/022-0011-dracut-lib-new-functions-listlist-and-.patch new file mode 100644 index 000000000000..2228d9814877 --- /dev/null +++ b/sys-kernel/dracut/files/022-0011-dracut-lib-new-functions-listlist-and-.patch @@ -0,0 +1,60 @@ +From c01f9b4827a50f8cc3e0a4832e70616c8faf990f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Sat, 30 Jun 2012 18:11:11 +0200 +Subject: [PATCH 11/14] dracut-lib: new functions: listlist and are_lists_eq + +listlist is like strstr for lists with specified separator and +are_lists_eq uses listlist to check equality of specified lists. +--- + modules.d/99base/dracut-lib.sh | 38 ++++++++++++++++++++++++++++++++++++++ + 1 files changed, 38 insertions(+), 0 deletions(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 1ee671e..ba94b81 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -878,3 +878,41 @@ export_n() + [ -n "$val" ] && eval $var=\"$val\" + done + } ++ ++# returns OK if list1 contains all elements of list2, i.e. checks if list2 is a ++# sublist of list1. An order and a duplication doesn't matter. ++# ++# $1 = separator ++# $2 = list1 ++# $3 = list2 ++# $4 = ignore values, separated by $1 ++listlist() { ++ local _sep="$1" ++ local _list="${_sep}${2}${_sep}" ++ local _sublist="$3" ++ [ -n "$4" ] && local _iglist="${_sep}${4}${_sep}" ++ local IFS="$_sep" ++ local _v ++ ++ [ "$_list" = "$_sublist" ] && return 0 ++ ++ for _v in $_sublist; do ++ if [ -n "$_v" ] && ! ( [ -n "$_iglist" ] && strstr "$_iglist" "$_v" ) ++ then ++ strstr "$_list" "$_v" || return 1 ++ fi ++ done ++ ++ return 0 ++} ++ ++# returns OK if both lists contain the same values. An order and a duplication ++# doesn't matter. ++# ++# $1 = separator ++# $2 = list1 ++# $3 = list2 ++# $4 = ignore values, separated by $1 ++are_lists_eq() { ++ listlist "$1" "$2" "$3" "$4" && listlist "$1" "$3" "$2" "$4" ++} +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0012-apply-ro-and-rw-options-from-cmdline-t.patch b/sys-kernel/dracut/files/022-0012-apply-ro-and-rw-options-from-cmdline-t.patch new file mode 100644 index 000000000000..ca2d26af3084 --- /dev/null +++ b/sys-kernel/dracut/files/022-0012-apply-ro-and-rw-options-from-cmdline-t.patch @@ -0,0 +1,111 @@ +From 6e9f7b09e4316b1337642f876092dcc429efaa52 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 13:17:05 +0200 +Subject: [PATCH 12/14] apply "ro" and "rw" options from cmdline to / mount + +rflags is no longer guaranteed to be non empty. / is mounted according +to rootflags parameter but forced ro at first. Later it is remounted +according to /etc/fstab + rootflags parameter and "ro"/"rw". If +parameters are still the same as for first mount, / isn't remounted. + +Conflicts: + + modules.d/95rootfs-block/mount-root.sh + modules.d/99base/parse-root-opts.sh +--- + modules.d/95rootfs-block/mount-root.sh | 35 +++++++------------------------ + modules.d/99base/parse-root-opts.sh | 11 +++------ + 2 files changed, 12 insertions(+), 34 deletions(-) + +diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh +index 8259ff9..b5d45c4 100755 +--- a/modules.d/95rootfs-block/mount-root.sh ++++ b/modules.d/95rootfs-block/mount-root.sh +@@ -5,32 +5,13 @@ + type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh + +-filter_rootopts() { +- rootopts=$1 +- # strip ro and rw options +- local OLDIFS="$IFS" +- IFS=, +- set -- $rootopts +- IFS="$OLDIFS" +- local v +- while [ $# -gt 0 ]; do +- case $1 in +- defaults);; +- *) +- v="$v,${1}";; +- esac +- shift +- done +- rootopts=${v#,} +- echo $rootopts +-} +- + mount_root() { + local _ret ++ local _rflags_ro="$rflags,ro" + # sanity - determine/fix fstype + rootfs=$(det_fs "${root#block:}" "$fstype") +- while ! mount -t ${rootfs} -o "$rflags",ro "${root#block:}" "$NEWROOT"; do +- warn "Failed to mount -t ${rootfs} -o $rflags,ro ${root#block:} $NEWROOT" ++ while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do ++ warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT" + fsck_ask_err + done + +@@ -96,13 +77,13 @@ mount_root() { + break + fi + done < "$NEWROOT/etc/fstab" +- +- rootopts=$(filter_rootopts $rootopts) + fi + + # we want rootflags (rflags) to take precedence so prepend rootopts to +- # them; rflags is guaranteed to not be empty +- rflags="${rootopts:+${rootopts},}${rflags}" ++ # them ++ rflags="${rootopts},${rflags}" ++ rflags="${rflags#,}" ++ rflags="${rflags%,}" + + # backslashes are treated as escape character in fstab + # esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g') +@@ -125,7 +106,7 @@ mount_root() { + if ! ismounted "$NEWROOT"; then + info "Mounting ${root#block:} with -o ${rflags}" + mount "$NEWROOT" 2>&1 | vinfo +- else ++ elif ! are_lists_eq , "$rflags" "$_rflags_ro" defaults; then + info "Remounting ${root#block:} with -o ${rflags}" + mount -o remount "$NEWROOT" 2>&1 | vinfo + fi +diff --git a/modules.d/99base/parse-root-opts.sh b/modules.d/99base/parse-root-opts.sh +index 44dcc09..7b0b758 100755 +--- a/modules.d/99base/parse-root-opts.sh ++++ b/modules.d/99base/parse-root-opts.sh +@@ -4,13 +4,10 @@ + + root=$(getarg root=) + +-if rflags="$(getarg rootflags=)"; then +- getarg rw && rflags="${rflags},rw" +- getarg ro && rflags="${rflags},ro" +-else +- getarg rw && rflags=rw +- getarg ro && rflags=ro +-fi ++rflags="$(getarg rootflags=)" ++getargbool 0 rw && rflags="${rflags},rw" ++getargbool 0 ro && rflags="${rflags},ro" ++rflags="${rflags#,}" + + fstype="$(getarg rootfstype=)" + if [ -z "$fstype" ]; then +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0013-ro_mnt-option-at-build-time-to-force-r.patch b/sys-kernel/dracut/files/022-0013-ro_mnt-option-at-build-time-to-force-r.patch new file mode 100644 index 000000000000..429883c64e48 --- /dev/null +++ b/sys-kernel/dracut/files/022-0013-ro_mnt-option-at-build-time-to-force-r.patch @@ -0,0 +1,103 @@ +From 9e32e0e7e1f8daee9f8ae2912ece8b7789f31e87 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 16:44:09 +0200 +Subject: [PATCH 13/14] ro_mnt - option at build time to force ro mount of / + and /usr + +--- + dracut.conf | 3 +++ + dracut.conf.5.asc | 3 +++ + dracut.sh | 6 +++++- + modules.d/99base/module-setup.sh | 3 +++ + 4 files changed, 14 insertions(+), 1 deletions(-) + +diff --git a/dracut.conf b/dracut.conf +index f47d571..f912acc 100644 +--- a/dracut.conf ++++ b/dracut.conf +@@ -43,6 +43,9 @@ lvmconf="yes" + # inhibit installation of any fsck tools + #nofscks="yes" + ++# mount / and /usr read-only by default ++#ro_mnt="no" ++ + # set the directory for temporary files + # default: /var/tmp + #tmpdir=/tmp +diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc +index d17477d..89bbf61 100644 +--- a/dracut.conf.5.asc ++++ b/dracut.conf.5.asc +@@ -97,6 +97,9 @@ If chrooted to another root other than the real root device, use --fstab and pro + *nofscks=*"__{yes|no}__":: + If specified, inhibit installation of any fsck tools. + ++*ro_mnt* ++ Mount _/_ and _/usr_ read-only by default. ++ + *kernel_only=*"__{yes|no}__":: + Only install kernel drivers and firmware files. (default=no) + +diff --git a/dracut.sh b/dracut.sh +index ffdcbcc..107fc27 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -101,6 +101,7 @@ Creates initial ramdisk images for preloading modules + --nolvmconf Do not include local /etc/lvm/lvm.conf + --fscks [LIST] Add a space-separated list of fsck helpers. + --nofscks Inhibit installation of any fsck helpers. ++ --ro-mnt Mount / and /usr read-only by default. + -h, --help This message + --debug Output debug information of the build process + --profile Output profile information of the build process +@@ -261,6 +262,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ + --long add-fstab: \ + --long mount: \ + --long nofscks: \ ++ --long ro-mnt \ + --long kmoddir: \ + --long conf: \ + --long confdir: \ +@@ -326,6 +328,7 @@ while :; do + --add-fstab) push add_fstab_l "$2"; shift;; + --mount) push fstab_lines "$2"; shift;; + --nofscks) nofscks_l="yes";; ++ --ro-mnt) ro_mnt_l="yes";; + -k|--kmoddir) drivers_dir_l="$2"; shift;; + -c|--conf) conffile="$2"; shift;; + --confdir) confdir="$2"; shift;; +@@ -558,6 +561,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) + [[ $compress_l ]] && compress=$compress_l + [[ $show_modules_l ]] && show_modules=$show_modules_l + [[ $nofscks_l ]] && nofscks="yes" ++[[ $ro_mnt_l ]] && ro_mnt="yes" + # eliminate IFS hackery when messing with fw_dir + fw_dir=${fw_dir//:/ } + +@@ -779,7 +783,7 @@ fi + export initdir dracutbasedir dracutmodules drivers \ + fw_dir drivers_dir debug no_kernel kernel_only \ + add_drivers omit_drivers mdadmconf lvmconf filesystems \ +- use_fstab fstab_lines libdirs fscks nofscks \ ++ use_fstab fstab_lines libdirs fscks nofscks ro_mnt \ + stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \ + debug host_fs_types host_devs sshkey add_fstab \ + DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir \ +diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh +index f20ca1a..dde1285 100755 +--- a/modules.d/99base/module-setup.sh ++++ b/modules.d/99base/module-setup.sh +@@ -50,6 +50,9 @@ install() { + fi + + ln -fs /proc/self/mounts "$initdir/etc/mtab" ++ if [[ $ro_mnt = yes ]]; then ++ echo ro >> "${initdir}/etc/cmdline.d/base.conf" ++ fi + + if [ -e /etc/os-release ]; then + . /etc/os-release +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0014-parse-root-opts-first-check-for-ro-lat.patch b/sys-kernel/dracut/files/022-0014-parse-root-opts-first-check-for-ro-lat.patch new file mode 100644 index 000000000000..7895815b555e --- /dev/null +++ b/sys-kernel/dracut/files/022-0014-parse-root-opts-first-check-for-ro-lat.patch @@ -0,0 +1,27 @@ +From e061c0f683d4c9504ed16284fd46e8fce3845c2e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 15:58:27 +0200 +Subject: [PATCH 14/14] parse-root-opts: first check for ro, later for rw + +This order is already in 98usrmount. +--- + modules.d/99base/parse-root-opts.sh | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/modules.d/99base/parse-root-opts.sh b/modules.d/99base/parse-root-opts.sh +index 7b0b758..b74eeb3 100755 +--- a/modules.d/99base/parse-root-opts.sh ++++ b/modules.d/99base/parse-root-opts.sh +@@ -5,8 +5,8 @@ + root=$(getarg root=) + + rflags="$(getarg rootflags=)" +-getargbool 0 rw && rflags="${rflags},rw" + getargbool 0 ro && rflags="${rflags},ro" ++getargbool 0 rw && rflags="${rflags},rw" + rflags="${rflags#,}" + + fstype="$(getarg rootfstype=)" +-- +1.7.8.6 + diff --git a/sys-kernel/dracut/files/022-0015-gentoo.conf-enable-ro_mnt.patch b/sys-kernel/dracut/files/022-0015-gentoo.conf-enable-ro_mnt.patch new file mode 100644 index 000000000000..546a6d020efa --- /dev/null +++ b/sys-kernel/dracut/files/022-0015-gentoo.conf-enable-ro_mnt.patch @@ -0,0 +1,24 @@ +From 5ee9d6bad16c18d17cea4a9ca737bc5583209fa0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 26 Jul 2012 19:04:30 +0200 +Subject: [PATCH 15/15] gentoo.conf: enable ro_mnt + +--- + dracut.conf.d/gentoo.conf.example | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/dracut.conf.d/gentoo.conf.example b/dracut.conf.d/gentoo.conf.example +index 411f9a0..6b74954 100644 +--- a/dracut.conf.d/gentoo.conf.example ++++ b/dracut.conf.d/gentoo.conf.example +@@ -2,6 +2,7 @@ + # Dracut config file customized for Gentoo Base System release 2 + + udevdir=/lib/udev ++ro_mnt=yes + + # + # Modules +-- +1.7.8.6 + |