summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>2009-02-26 16:02:47 -0800
committerHarald Hoyer <harald@redhat.com>2009-03-04 16:55:14 +0100
commit20abd914845b23f1125f94ff46a7a0717ad9494d (patch)
tree8b771f1bfaa783419b06f5663436ff6329ed12b5
parent58a797d5f93078b38d0cad739907ad538c5b41b0 (diff)
downloaddracut-20abd914845b23f1125f94ff46a7a0717ad9494d.tar.gz
dracut-20abd914845b23f1125f94ff46a7a0717ad9494d.tar.bz2
dracut-20abd914845b23f1125f94ff46a7a0717ad9494d.zip
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.
-rwxr-xr-xdracut8
-rwxr-xr-xmodules.d/00dash/install (renamed from modules/00dash.sh)0
-rwxr-xr-xmodules.d/10redhat-i18n/install (renamed from modules/10redhat-i18n.sh)0
-rw-r--r--modules.d/40network/60-net.rules (renamed from rules.d/60-net.rules)0
-rwxr-xr-xmodules.d/40network/dhclient-script (renamed from dhclient-script)0
-rwxr-xr-xmodules.d/40network/ifup (renamed from ifup)0
-rwxr-xr-xmodules.d/40network/install8
-rwxr-xr-xmodules.d/40network/kill-dhclient.sh (renamed from hooks/kill-dhclient.sh)0
-rwxr-xr-xmodules.d/40network/run-dhclient.sh (renamed from hooks/run-dhclient.sh)0
-rw-r--r--modules.d/90crypt/63-luks.rules (renamed from rules.d/63-luks.rules)0
-rwxr-xr-xmodules.d/90crypt/cryptroot.sh (renamed from hooks/cryptroot.sh)0
-rwxr-xr-xmodules.d/90crypt/install4
-rwxr-xr-xmodules.d/90kernel-modules/install (renamed from modules/90kernel-modules.sh)0
-rw-r--r--modules.d/90lvm/64-lvm.rules (renamed from rules.d/64-lvm.rules)0
-rwxr-xr-xmodules.d/90lvm/install3
-rwxr-xr-xmodules.d/95debug/install (renamed from modules/95debug.sh)0
-rwxr-xr-xmodules.d/95terminfo/install (renamed from modules/95terminfo.sh)0
-rwxr-xr-xmodules.d/95udev-rules/install (renamed from modules/95udev-rules.sh)0
-rwxr-xr-xmodules.d/99base/init (renamed from init)0
-rwxr-xr-xmodules.d/99base/install8
-rwxr-xr-xmodules.d/99base/mount-partition.sh (renamed from hooks/mount-partition.sh)0
-rwxr-xr-xmodules.d/99base/resume.sh (renamed from hooks/resume.sh)0
-rwxr-xr-xmodules.d/99base/selinux-loadpolicy.sh (renamed from hooks/selinux-loadpolicy.sh)0
-rwxr-xr-xmodules.d/99base/switch_root (renamed from switch_root)0
-rwxr-xr-xmodules/40network.sh8
-rwxr-xr-xmodules/90crypt.sh4
-rwxr-xr-xmodules/90lvm.sh3
-rwxr-xr-xmodules/99base.sh8
28 files changed, 28 insertions, 26 deletions
diff --git a/dracut b/dracut
index c00944e9..30782419 100755
--- a/dracut
+++ b/dracut
@@ -52,12 +52,14 @@ for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot dev/pts; do
done
# source all our modules
-for f in "$dsrc/modules"/*.sh; do
- mod=${f##*/}; mod=${mod#[0-9][0-9]}; mod=${mod%.sh}
+for moddir in "$dsrc/modules.d"/*; do
+ [[ -d $moddir || -L $moddir ]] || continue
+ mod=${moddir##*/}; mod=${mod#[0-9][0-9]};
if [[ $dracutmodules = all ]] || strstr "$dracutmodules" "$mod"; then
- [[ -x $f ]] && . "$f"
+ [[ -x $moddir/install ]] && . "$moddir/install"
fi
done
+unset moddir
## final stuff that has to happen
diff --git a/modules/00dash.sh b/modules.d/00dash/install
index 8af1e7c4..8af1e7c4 100755
--- a/modules/00dash.sh
+++ b/modules.d/00dash/install
diff --git a/modules/10redhat-i18n.sh b/modules.d/10redhat-i18n/install
index ae50bbc5..ae50bbc5 100755
--- a/modules/10redhat-i18n.sh
+++ b/modules.d/10redhat-i18n/install
diff --git a/rules.d/60-net.rules b/modules.d/40network/60-net.rules
index 4b030c3f..4b030c3f 100644
--- a/rules.d/60-net.rules
+++ b/modules.d/40network/60-net.rules
diff --git a/dhclient-script b/modules.d/40network/dhclient-script
index dc2d9e1e..dc2d9e1e 100755
--- a/dhclient-script
+++ b/modules.d/40network/dhclient-script
diff --git a/ifup b/modules.d/40network/ifup
index 83f65229..83f65229 100755
--- a/ifup
+++ b/modules.d/40network/ifup
diff --git a/modules.d/40network/install b/modules.d/40network/install
new file mode 100755
index 00000000..3152f0d5
--- /dev/null
+++ b/modules.d/40network/install
@@ -0,0 +1,8 @@
+#!/bin/bash
+dracut_install ip dhclient
+inst "$moddir/ifup" "/sbin/ifup"
+inst "$moddir/dhclient-script" "/sbin/dhclient-script"
+instmods =networking ecb arc4
+inst_rules "$moddir/60-net.rules"
+inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
+inst_hook pre-mount 70 "$moddir/run-dhclient.sh"
diff --git a/hooks/kill-dhclient.sh b/modules.d/40network/kill-dhclient.sh
index 3dd3b431..3dd3b431 100755
--- a/hooks/kill-dhclient.sh
+++ b/modules.d/40network/kill-dhclient.sh
diff --git a/hooks/run-dhclient.sh b/modules.d/40network/run-dhclient.sh
index afab0370..afab0370 100755
--- a/hooks/run-dhclient.sh
+++ b/modules.d/40network/run-dhclient.sh
diff --git a/rules.d/63-luks.rules b/modules.d/90crypt/63-luks.rules
index 802ea062..802ea062 100644
--- a/rules.d/63-luks.rules
+++ b/modules.d/90crypt/63-luks.rules
diff --git a/hooks/cryptroot.sh b/modules.d/90crypt/cryptroot.sh
index 1bcc68ff..1bcc68ff 100755
--- a/hooks/cryptroot.sh
+++ b/modules.d/90crypt/cryptroot.sh
diff --git a/modules.d/90crypt/install b/modules.d/90crypt/install
new file mode 100755
index 00000000..92b51699
--- /dev/null
+++ b/modules.d/90crypt/install
@@ -0,0 +1,4 @@
+#!/bin/bash
+inst cryptsetup
+inst_rules "$moddir/63-luks.rules"
+inst_hook mount 10 "$moddir/cryptroot.sh" \ No newline at end of file
diff --git a/modules/90kernel-modules.sh b/modules.d/90kernel-modules/install
index 8265b603..8265b603 100755
--- a/modules/90kernel-modules.sh
+++ b/modules.d/90kernel-modules/install
diff --git a/rules.d/64-lvm.rules b/modules.d/90lvm/64-lvm.rules
index 9f927d82..9f927d82 100644
--- a/rules.d/64-lvm.rules
+++ b/modules.d/90lvm/64-lvm.rules
diff --git a/modules.d/90lvm/install b/modules.d/90lvm/install
new file mode 100755
index 00000000..68e00560
--- /dev/null
+++ b/modules.d/90lvm/install
@@ -0,0 +1,3 @@
+#!/bin/bash
+inst lvm
+inst_rules "$moddir/64-lvm.rules" \ No newline at end of file
diff --git a/modules/95debug.sh b/modules.d/95debug/install
index 4579212f..4579212f 100755
--- a/modules/95debug.sh
+++ b/modules.d/95debug/install
diff --git a/modules/95terminfo.sh b/modules.d/95terminfo/install
index 7f14aa1c..7f14aa1c 100755
--- a/modules/95terminfo.sh
+++ b/modules.d/95terminfo/install
diff --git a/modules/95udev-rules.sh b/modules.d/95udev-rules/install
index 61125cd3..61125cd3 100755
--- a/modules/95udev-rules.sh
+++ b/modules.d/95udev-rules/install
diff --git a/init b/modules.d/99base/init
index 74b3368c..74b3368c 100755
--- a/init
+++ b/modules.d/99base/init
diff --git a/modules.d/99base/install b/modules.d/99base/install
new file mode 100755
index 00000000..f59bc439
--- /dev/null
+++ b/modules.d/99base/install
@@ -0,0 +1,8 @@
+#!/bin/bash
+dracut_install mount mknod mkdir modprobe pidof sleep chroot echo sed sh ls
+# install our scripts and hooks
+inst "$moddir/init" "/init"
+inst "$moddir/switch_root" "/sbin/switch_root"
+inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
+inst_hook mount 90 "$moddir/resume.sh"
+inst_hook mount 99 "$moddir/mount-partition.sh"
diff --git a/hooks/mount-partition.sh b/modules.d/99base/mount-partition.sh
index f554c28b..f554c28b 100755
--- a/hooks/mount-partition.sh
+++ b/modules.d/99base/mount-partition.sh
diff --git a/hooks/resume.sh b/modules.d/99base/resume.sh
index a01a6131..a01a6131 100755
--- a/hooks/resume.sh
+++ b/modules.d/99base/resume.sh
diff --git a/hooks/selinux-loadpolicy.sh b/modules.d/99base/selinux-loadpolicy.sh
index ceece632..ceece632 100755
--- a/hooks/selinux-loadpolicy.sh
+++ b/modules.d/99base/selinux-loadpolicy.sh
diff --git a/switch_root b/modules.d/99base/switch_root
index d142e97d..d142e97d 100755
--- a/switch_root
+++ b/modules.d/99base/switch_root
diff --git a/modules/40network.sh b/modules/40network.sh
deleted file mode 100755
index b477a9c4..00000000
--- a/modules/40network.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-dracut_install ip dhclient
-inst "$dsrc/ifup" "/sbin/ifup"
-inst "$dsrc/dhclient-script" "/sbin/dhclient-script"
-instmods =networking ecb arc4
-inst_rules "$dsrc/rules.d/60-net.rules"
-inst_hook pre-pivot 10 "$dsrc/hooks/kill-dhclient.sh"
-inst_hook pre-mount 70 "$dsrc/hooks/run-dhclient.sh"
diff --git a/modules/90crypt.sh b/modules/90crypt.sh
deleted file mode 100755
index 5e8f4cb4..00000000
--- a/modules/90crypt.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-inst cryptsetup
-inst_rules "$dsrc/rules.d/63-luks.rules"
-inst_hook mount 10 "$dsrc/hooks/cryptroot.sh" \ No newline at end of file
diff --git a/modules/90lvm.sh b/modules/90lvm.sh
deleted file mode 100755
index 315fbb80..00000000
--- a/modules/90lvm.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-inst lvm
-inst_rules "$dsrc/rules.d/64-lvm.rules" \ No newline at end of file
diff --git a/modules/99base.sh b/modules/99base.sh
deleted file mode 100755
index 580fb034..00000000
--- a/modules/99base.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-dracut_install mount mknod mkdir modprobe pidof sleep chroot echo sed sh ls
-# install our scripts and hooks
-inst "$initfile" "/init"
-inst "$switchroot" "/sbin/switch_root"
-inst_hook pre-pivot 50 "$dsrc/hooks/selinux-loadpolicy.sh"
-inst_hook mount 90 "$dsrc/hooks/resume.sh"
-inst_hook mount 99 "$dsrc/hooks/mount-partition.sh"