Harald Hoyer [Wed, 4 Mar 2009 12:54:55 +0000 (13:54 +0100)]
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" 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.
Victor Lowther [Wed, 4 Mar 2009 00:21:17 +0000 (16:21 -0800)]
Steal rules we need from the latest udev package.
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.
Victor Lowther [Wed, 4 Mar 2009 00:21:10 +0000 (16:21 -0800)]
Modify instmods to not rely on the existence of modules.* files
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.
Seewer Philippe [Fri, 27 Feb 2009 14:16:36 +0000 (15:16 +0100)]
Make bash regexes behave
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 ''.
Seewer Philippe [Fri, 27 Feb 2009 12:25:38 +0000 (13:25 +0100)]
Fix instmods recursing indefinitely
the instmod function inside dracut-functions starts to recurses indefinitely
if modprobe --show-depends is used and the output contains module options.
Victor Lowther [Fri, 27 Feb 2009 00:02:47 +0000 (16:02 -0800)]
Create a self-contained structure for dracut modules
All modules now live in a subdirectory /modules.d. Each module is
self-contained -- it should contain everything that it will install
on the initrd. All modules must include a script named install, which
will be sourced by dracut. This script should do the actual file installation
using inst methods. The moddir variable will point to the full path to the
module dracut is currently working on.
As usual, this patch series applies on top of my previous patch series,
and is available as normalize-modules from http://git.fnordovax.org/dracut.
Victor Lowther [Thu, 26 Feb 2009 02:42:11 +0000 (18:42 -0800)]
Move running dhclient on DHCP interfaces into a pre-mount hook.
Static interfaces are still configured on the fly as we add them, but
discussions on the mailing list have suggested that we need to have finer
control over bringing up dhcp interfaces.
The default hook just runs all the requested dhclients in parallel and waits
for them to all return. If you need something more complicated than this, or
need to have more control over bringing interfaces up, you will probably need
to override some stuff in the 40network hook.
Victor Lowther [Thu, 26 Feb 2009 02:42:05 +0000 (18:42 -0800)]
We now know how to configure the network interfaces.
Provided that you are configuring them via DHCP. RARP, BOOTP, and static
configuration are not written yet.
Also, adding nic drivers really bloats the initrd.
I am looking for feedback on these patches from people who actually implement
booting over the network. This patch series does not include support for that
yet -- you will not find nfsroot= handling, or booting to a fs supplied by
dhcp yet. I do want to make it as easy as possible to add support for booting
over the network, as well as making it easy for people to customize things to
meet their site requirements.
This patch series is also available as the network-configurability branch at
http://git.fnordovax.org/dracut. It may be rebased without warning to keep
it in sync with the rest of dracut.
Victor Lowther [Thu, 26 Feb 2009 02:32:40 +0000 (18:32 -0800)]
Modify getarg to be slightly more useful.
If the last character in the argument to search for is "=", then
getarg will echo all the text after the = as well as returning 0 or 1 depending
on whether or not the arg is found.
Otherwise, getarg will jsut return 0 if the exact test of the argument is found,
1 otherwise.
Victor Lowther [Sun, 22 Feb 2009 06:22:36 +0000 (00:22 -0600)]
cryptsetup does not like running in a while read loop.
Add some additional manglage to ensure that stdin/stdout is always pointing
the right thing. A more elegant way of doing this would be much appreciated
Victor Lowther [Tue, 17 Feb 2009 03:16:31 +0000 (19:16 -0800)]
Goodbye, nash. We won't miss you.
This supercedes my previous switch_root patches, and applies on top of davej's
repo at git.kernel.org.
Nash is gone. In its place we have a reasonable switch_root implementation.
Of course, this switch_root is written in some rather hideous shell script,
and relies on some rather dodgy hacks. Rewriting in C would help things out.
However, it should be distro-independent, and it gets the job done.
Victor Lowther [Fri, 13 Feb 2009 12:42:48 +0000 (04:42 -0800)]
[PATCH 32/50] Created pre-mount hook directory
This is for tasks that should run after device discovery, but before
mounting the new rootfs. Things like cryptoroot and resume from hibernate
should go here.
Hooks are sourced, not executed as separate scripts.
Victor Lowther [Fri, 13 Feb 2009 12:41:32 +0000 (04:41 -0800)]
[PATCH 02/50] Add a simple getarg function.
If we ever need to get more than one kernel command line argument, this
function will pay for itself. It relies on a feature of the way bash
handles string comparisons in [[ ]] statements -- the RHS is matched
according to globbing rules, and is not a straight string match.