Modify hook loading to make it slightly easier to script.
PATCH 49/50 Modify hook loading to make it slightly easier to script.
Gitweb: http://git.kernel.org/?p=linux/kernel/git/davej/dracut.git;a=commit;h=53f954561afdb87a67e0f943556095f0eb7cbbc0 Commit: 53f954561afdb87a67e0f943556095f0eb7cbbc0 Parent: f04dc5f31235a440c745836118697223f6f3d3f1 Author: Victor Lowther <[email protected]> AuthorDate: Fri Feb 13 04:43:29 2009 -0800 Committer: Dave Jones <[email protected]> CommitDate: Mon Feb 16 13:56:51 2009 -0500
[PATCH 49/50] Modify hook loading to make it slightly easier to script.
Modules are now responsible for loading their hooks into the initrd.
This should be all the structure we need to make it easy for things to integrate with dracut -- now to document and test it all.
--- Makefile | 8 ++++---- dracut-functions | 16 ++++++++++++++++ pre-mount/50cryptroot => hooks/cryptroot | 0 pre-mount/99resume => hooks/resume | 0 .../selinux-loadpolicy | 0 modules/90crypt | 3 ++- modules/99base | 7 ++----- 7 files changed, 24 insertions(+), 10 deletions(-)
Makefile +4 -4
@@ -4,16 +4,16 @@ all: install: mkdir -p $(DESTDIR)/usr/libexec/dracut mkdir -p $(DESTDIR)/sbin - mkdir -p $(DESTDIR)/usr/libexec/dracut/pre-mount - mkdir -p $(DESTDIR)/usr/libexec/dracut/pre-udev - mkdir -p $(DESTDIR)/usr/libexec/dracut/pre-pivot + mkdir -p $(DESTDIR)/usr/libexec/dracut/hooks + mkdir -p $(DESTDIR)/usr/libexec/dracut/modules install -m 0755 dracut $(DESTDIR)/sbin/dracut install -m 0755 init $(DESTDIR)/usr/libexec/dracut/init install -m 0755 switch_root $(DESTDIR)/usr/libexec/dracut/switch_root install -m 0755 dracut-functions $(DESTDIR)/usr/libexec/dracut/functions mkdir $(DESTDIR)/usr/libexec/dracut/rules.d for rule in rules.d/*.rules ; do install -m 0644 $$rule $(DESTDIR)/usr/libexec/dracut ; done - for hooks in pre-*/* ; do install -m 0755 $$hook $(DESTDIR/usr/libexec/dracut ; done + for hooks in hooks/* ; do install -m 0755 $$hook $(DESTDIR)/usr/libexec/dracut ; done + for module in modules/*; do install -m 0755 $$module $(DESTDIR)/usr/libexec/dracut ; done clean: rm -f *~
dracut-functions +16 -0
@@ -145,6 +145,22 @@ inst() { return 1 } +# install function specialized for hooks +# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook +# All hooks should be POSIX/SuS compliant, they will be sourced by init. +inst_hook() { + [[ -f $3 ]] || { + echo "Cannot install a hook ($3) that does not exist." >&2 + echo "Aborting initrd creation." >&2 + exit 1 + } + strstr "$hookdirs" "$1" || { + echo "No such hook type $1. Aborting initrd creation." >&2 + exit 1 + } + inst_simple "$3" "/${1}/${2}${3##*/}" +} + dracut_install() { while (($# > 0)); do inst "$1" && shift
hooks/cryptroot renamed from pre-mount/50cryptroot +0 -0
hooks/resume renamed from pre-mount/99resume +0 -0
hooks/selinux-loadpolicy renamed from pre-pivot/50selinux-loadpolicy +0 -0
modules/90crypt +2 -1
@@ -1,3 +1,4 @@ #!/bin/bash inst cryptsetup -inst_rules "$dsrc/rules.d/63-luks.rules" +inst_rules "$dsrc/rules.d/63-luks.rules" +inst_hook pre-mount 50 "$dsrc/hooks/cryptroot"
modules/99base +2 -5
@@ -4,9 +4,6 @@ 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" -for hookdir in $hookdirs; do - for hook in "$dsrc/$hookdir"/*; do - [[ -f $hook ]] && inst "$hook" "/$hookdir/${hook##*/}" - done -done +inst_hook pre-pivot 50 "$dsrc/hooks/selinux-loadpolicy" +inst_hook pre-mount 99 "$dsrc/hooks/resume"
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 200902161907.n1GJ7Mrh029004-Dj75qbTlC0E76Z2rM5mHXA@public.gmane.org
Pazartesi 16 Şubat 2009 tarihinde şunları yazmıştınız:
Quoted 2 lines
- for hooks in pre-*/* ; do install -m 0755 $$hook $(DESTDIR/usr/libexec/dracut ; done + for hooks in hooks/* ; do install -m 0755 $$hook $(DESTDIR)/usr/libexec/dracut ; done
Typo here. Must be
for hook in hooks/*