The switch_root shell script did not work with bash-4.0-2, because
"exec" gets the real path of the executable which is then
"/sysroot/lib/ld-linux.so.2" instread of "./lib/ld-linux.so.2".
Also the required chroot binary might live in /usr/bin, which can
be mounted later.
Here is the switch_root code from nash, which can be stripped down
further, but which works.
>From f1b1e4f8694104f007e4483c36b0bf40a5760167 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Date: Wed, 4 Mar 2009 13:41:07 +0100
Subject: [PATCH] replace switch_root shell script with binary
The switch_root shell script did not work with bash-4.0-2, because
"exec" gets the real path of the executable which is then
"/sysroot/lib/ld-linux.so.2" instead of "./lib/ld-linux.so.2".
Also the required chroot binary might live in /usr/bin, which can
be mounted later.
Here is the switch_root code from nash, which can be stripped down
further, but which works.
This should arguably be done by importing the udev git repo as a submodule,
but I am too lazy to figure out how to do that right now.
I suppose this could also be done by rewriting the 95udev-rules.sh module
for each distribution, but that is something best left to the distro
maintainers once we acheive some sort of widespread adoption. Until then,
stealing rules from upstream udev seems like the most portable solution.
They are not needed to boot with dracut, so away they go.
Also rewrite inst_rules to automatically search likely rule locations when
installing udev rules.
This patch series aims to make dracut more distro-independent. It includes
some of the functionality that Seewer Philippe posted to the list to make
dracut work on Ubuntu.
depmod does not create these files on all distros (Debian, specifically),
so modify instmods to use pathname components and find to do what we want.
As a bonus, this removes the special-case for =ata.
When handling links sometimes one readlink isn't enough. Dracut doesn't
need to clone a whole link series, so just use readlink -f
--
dracut-functions | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
On some systems with newer or unpatched bash versions the whole right
portion of =~ is considered part of the regex. Means we need to get rid
of enclosing ''.
This patch fixes this.
--
dracut-functions | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)