]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Merge commit 'dillow/master'
authorHarald Hoyer <harald@redhat.com>
Fri, 5 Jun 2009 06:47:51 +0000 (08:47 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 5 Jun 2009 06:47:51 +0000 (08:47 +0200)
Conflicts:
test/TEST-20-NFS/make-client-root

13 files changed:
Makefile
dracut
dracut-functions
dracut.conf [new file with mode: 0644]
dracut.spec
modules.d/50plymouth/52-plymouth-start.rules [deleted file]
modules.d/50plymouth/63-luks.rules
modules.d/50plymouth/install
modules.d/50plymouth/plymouth-newroot.sh
modules.d/50plymouth/plymouth-prep.sh [deleted file]
modules.d/50plymouth/plymouth-pretrigger.sh [new file with mode: 0755]
modules.d/99base/init
modules.d/99base/install

index 0208d6dd37d9a48c94f9aabee33dfb161795c23a..491d156857159ef9a4c484be2515c200b1ea57a8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,12 @@
-VERSION=0.0
+VERSION=0.1
 GITVERSION=$(shell [ -d .git ] && git rev-list  --abbrev-commit  -n 1 HEAD  |cut -b 1-8)
 
+prefix = /usr
+libdir = ${prefix}/lib
+pkglibdir = ${libdir}/dracut
+sysconfdir = ${prefix}/etc
+sbindir = ${prefix}/sbin
+
 modules.d/99base/switch_root: switch_root.c
        gcc -o modules.d/99base/switch_root switch_root.c       
 
@@ -9,14 +15,16 @@ all: modules.d/99base/switch_root
 .PHONY: install clean archive rpm testimage test all check
 
 install:
-       mkdir -p $(DESTDIR)/usr/lib/dracut
-       mkdir -p $(DESTDIR)/sbin
-       mkdir -p $(DESTDIR)/etc
-       mkdir -p $(DESTDIR)/usr/lib/dracut/modules.d
-       install -m 0755 dracut $(DESTDIR)/sbin/dracut
-       install -m 0644 dracut.conf $(DESTDIR)/etc/dracut.conf
-       install -m 0755 dracut-functions $(DESTDIR)/usr/lib/dracut/dracut-functions
-       cp -arx modules.d $(DESTDIR)/usr/lib/dracut/
+       mkdir -p $(DESTDIR)$(pkglibdir)
+       mkdir -p $(DESTDIR)$(sbindir)
+       mkdir -p $(DESTDIR)$(sysconfdir)
+       mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
+       install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
+       install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
+       install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
+       install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
+       cp -arx modules.d $(DESTDIR)$(pkglibdir)
+       rm $(DESTDIR)$(pkglibdir)/modules.d/99base/switch_root
 
 clean:
        rm -f *~
@@ -40,5 +48,5 @@ check: all
        make -C test check
 
 testimage: all
-       ./dracut -v -l -f test-$(shell uname -r).img $(shell uname -r)
+       ./dracut -l -f test-$(shell uname -r).img $(shell uname -r)
        @echo wrote  test-$(shell uname -r).img 
diff --git a/dracut b/dracut
index e5e7ecd7ab0cc689f512e32f71e7e774bae1490a..d9b77413ef7cc2349034c011aa4ce1fce4bd5358 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -69,8 +69,9 @@ done
 [[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
 [[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
 [[ $drivers_l ]] && drivers=$drivers_l
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
 
-[[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=/usr/lib/dracut
+[[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
 
 if [[ -f $dsrc/dracut-functions ]]; then
    . $dsrc/dracut-functions
@@ -96,7 +97,7 @@ if [[ -f $outfile && ! $force ]]; then
     exit 1
 fi
 
-hookdirs="cmdline pre-udev netroot pre-mount pre-pivot mount emergency"
+hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency"
 
 readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
 trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
index 49d18fdc71b23f4143e7688e4898e70f71b61719..7f14318697c7d498e82bf20b636fdee8129860a8 100755 (executable)
@@ -31,24 +31,25 @@ strstr() { [[ ! ${1#*$2*} = $1 ]]; }
 # Log initrd creation.
 if ! [[ $dracutlogfile ]]; then
     [[ $dsrc = /usr/lib/dracut ]] && \
-       dracutlogfile=/var/log/dracut/log || \
+       dracutlogfile=/var/log/dracut.log || \
        dracutlogfile=/tmp/dracut.log
+    [[ -w "$dracutlogfile" ]] || dracutlogfile=/tmp/dracut.log
     >"$dracutlogfile"
 fi
 
 dwarning() {
     echo "W: $@" >&2
-    echo "W: $@" >>"$dracutlogfile"
+    [[ -w "$dracutlogfile" ]] && echo "W: $@" >>"$dracutlogfile"
 }
 
 dinfo() {
     [[ $beverbose ]] && echo "I: $@" >&2
-    echo "I: $@" >>"$dracutlogfile"
+    [[ -w "$dracutlogfile" ]] && echo "I: $@" >>"$dracutlogfile"
 }
 
 derror() {
     echo "E: $@" >&2
-    echo "E: $@" >>"$dracutlogfile"
+    [[ -w "$dracutlogfile" ]] && echo "E: $@" >>"$dracutlogfile"
 }
 
 # $1 = file to copy to ramdisk
diff --git a/dracut.conf b/dracut.conf
new file mode 100644 (file)
index 0000000..8e8e90f
--- /dev/null
@@ -0,0 +1,10 @@
+# Sample dracut config file
+
+# Specific list of dracut modules to use
+#dracutmodules=""
+
+# Dracut modules to omit
+#omit_dracutmodules=""
+
+# Additional kernel modules to install
+#drivers=""
index 4b09686b1e29f453672ac20e062d60a7379685c7..b94275daf2cfb6632ba7a8d8bb1917589071f53a 100644 (file)
@@ -1,7 +1,7 @@
-# define gittag f8a22bfb
+# define gittag 2c02c831
 %define replace_mkinitrd 0
 Name: dracut
-Version: 0.0
+Version: 0.1
 %if %{defined gittag}
 Release: 1.git%{gittag}%{?dist}
 %define dashgittag -%{gittag}
@@ -11,7 +11,7 @@ Release: 1%{?dist}
 Summary: Initramfs generator using udev
 Group: System Environment/Base         
 License: GPLv2 
-URL: http://fedoraproject.org/wiki/Initrdrewrite               
+URL: http://apps.sourceforge.net/trac/dracut/wiki
 Source0: dracut-%{version}%{?dashgittag}.tar.bz2
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: udev
@@ -32,9 +32,7 @@ Provides: mkinitrd = 7.0
 %endif
 
 %description
-dracut is an attempt to build a new, event-driven initramfs infrastructure 
-based around udev.
-
+dracut is a new, event-driven initramfs infrastructure based around udev.
 
 %prep
 %setup -q -n %{name}-%{version}%{?dashgittag}
@@ -45,13 +43,16 @@ make
 
 %install
 rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin sysconfdir=/etc
 
 %if 0%{?replace_mkinitrd}
 ln -s dracut $RPM_BUILD_ROOT/sbin/mkinitrd
 ln -s dracut/dracut-functions $RPM_BUILD_ROOT/usr/libexec/initrd-functions
 %endif
 
+#mkdir -p $RPM_BUILD_ROOT/sbin
+#mv $RPM_BUILD_ROOT/%{_prefix}/lib/dracut/modules.d/99base/switch_root $RPM_BUILD_ROOT/sbin
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -59,13 +60,14 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %doc README HACKING TODO COPYING
 /sbin/dracut
+/sbin/switch_root
 %if 0%{?replace_mkinitrd}
 /sbin/mkinitrd
 /usr/libexec/initrd-functions
 %endif
-%dir /usr/lib/dracut
-/usr/lib/dracut/dracut-functions
-/usr/lib/dracut/modules.d
+%dir %{_prefix}/lib/dracut
+%{_prefix}/lib/dracut/dracut-functions
+%{_prefix}/lib/dracut/modules.d
 %config(noreplace) /etc/dracut.conf
 
 
diff --git a/modules.d/50plymouth/52-plymouth-start.rules b/modules.d/50plymouth/52-plymouth-start.rules
deleted file mode 100644 (file)
index 8fd73e9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb[0-9]*", RUN+="/bin/plymouth --show-splash"
index 893577bbc6b706b89f55da00250b1f5b935a8536..01a1b1d89221a3f1ba69d50b53fceb34b5690616 100644 (file)
@@ -8,6 +8,6 @@ SUBSYSTEM!="block", GOTO="luks_end"
 ACTION!="add|change", GOTO="luks_end"
 
 KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
 
 LABEL="luks_end"
index bfba52b52eaf4cf633537291bfcab0d126a61942..e5ba79cbb6d7fc8fdde0b8491b03b5f3fa820a5d 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 . "$moddir"/plymouth-populate-initrd
-inst_hook pre-udev 10 "$moddir"/plymouth-prep.sh
 inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
+inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
 inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
 # Include KMS capable drm drivers
@@ -10,4 +10,3 @@ for modname in `find "/lib/modules/$kernel/kernel/drivers/gpu/drm" -name '*.ko'`
     instmods $modname
   fi
 done
-inst_rules "$moddir/52-plymouth-start.rules"
index af04f3cb8258ec2a8ef327486d4933ba8485d0c7..be563cdd7a46adb7518673e66b5bc0e68ebc9a4b 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 
 if [ -x /bin/plymouth ]; then
-  /bin/plymouth --show-splash
   /bin/plymouth --newroot=$NEWROOT
 fi
diff --git a/modules.d/50plymouth/plymouth-prep.sh b/modules.d/50plymouth/plymouth-prep.sh
deleted file mode 100755 (executable)
index 3281835..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-[ -c /dev/null ] || mknod /dev/null c 1 3
-mknod /dev/zero c 1 5
-mknod /dev/systty c 4 0
-mknod /dev/tty c 5 0
-[ -c /dev/console ] || mknod /dev/console c 5 1
-[ -c /dev/ptmx ] || mknod /dev/ptmx c 5 2
-mknod /dev/fb c 29 0
-mknod /dev/tty0 c 4 0
-mknod /dev/tty1 c 4 1
-mknod /dev/tty2 c 4 2
-mknod /dev/tty3 c 4 3
-mknod /dev/tty4 c 4 4
-mknod /dev/tty5 c 4 5
-mknod /dev/tty6 c 4 6
-mknod /dev/tty7 c 4 7
-mknod /dev/tty8 c 4 8
-mknod /dev/tty9 c 4 9
-mknod /dev/tty10 c 4 10
-mknod /dev/tty11 c 4 11
-mknod /dev/tty12 c 4 12
-mknod /dev/ttyS0 c 4 64
-mknod /dev/ttyS1 c 4 65
-mknod /dev/ttyS2 c 4 66
-mknod /dev/ttyS3 c 4 67
-/lib/udev/console_init tty0
-
-[ -x /bin/plymouthd ] && /bin/plymouthd 
-
diff --git a/modules.d/50plymouth/plymouth-pretrigger.sh b/modules.d/50plymouth/plymouth-pretrigger.sh
new file mode 100755 (executable)
index 0000000..78c8c06
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# first trigger graphics subsystem
+udevadm trigger --attr-match=class=0x030000
+# first trigger graphics and tty subsystem
+udevadm trigger --subsystem-match=graphics --subsystem-match=tty >/dev/null 2>&1
+# add nomatch for full trigger
+echo " --subsystem-nomatch=graphics --subsystem-nomatch=tty " >> /tmp/udevtriggeropts
+
+udevadm settle --timeout=30 >/dev/null 2>&1
+[ -c /dev/null ] || mknod /dev/null c 1 3
+[ -c /dev/zero ] || mknod /dev/zero c 1 5
+[ -c /dev/systty ] || mknod /dev/systty c 4 0
+[ -c /dev/fb ] || mknod /dev/fb c 29 0
+[ -c /dev/hvc0 ] || mknod /dev/hvc0 c 229 0
+
+[ -x /bin/plymouthd ] && /bin/plymouthd
+
+/lib/udev/console_init tty0
+/bin/plymouth --show-splash
+
index 70c2514ee4eadc33675841e307d24502c136c758..244f80658787e096ceeedf82bbd69529498e0d57 100755 (executable)
@@ -70,7 +70,12 @@ source_all pre-udev
 udevd --daemon
 getarg rdudevinfo && udevadm control --log_priority=info
 getarg rdudevdebug && udevadm control --log_priority=debug
-udevadm trigger >/dev/null 2>&1
+
+source_all pre-trigger
+
+# then the rest
+[ -f /tmp/udevtriggeropts ] && udevtriggeropts=$(while read line; do echo $line;done < /tmp/udevtriggeropts)
+udevadm trigger $udevtriggeropts  >/dev/null 2>&1
 udevadm settle --timeout=30 >/dev/null 2>&1
 
 # pre-mount happens before we try to mount the root filesystem,
index 682004e2b227b9f0d03c2c55b14927e9514e19e5..428eaf935b01a939c5bbab6b3110be5bec9b88f0 100755 (executable)
@@ -8,9 +8,10 @@ fi
 inst "$moddir/init" "/init"
 # Bail out if switch_root does not exist
 if [ ! -x "$moddir/switch_root" ]; then
-    derror "ERROR: $moddir/switch_root does not exist."
-    exit 1
+    # assume it is installed in the standard path
+    dracut_install switch_root
+else
+    inst "$moddir/switch_root" "/sbin/switch_root"
 fi
-inst "$moddir/switch_root" "/sbin/switch_root"
 inst "$moddir/dracut-lib" "/lib/dracut-lib"
 inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"