There are several snippits of shell code that are useful to multiple
scripts. Start by moving getarg() into the library.
Signed-off-by: David Dillow <dave@thedillows.org>
--- /dev/null
+#!/bin/sh
+#
+# Licensed under the GPLv2
+#
+# Copyright 2008, Red Hat, Inc.
+# Jeremy Katz <katzj@redhat.com>
+
+getarg() {
+ local o line
+ [ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
+ for o in $CMDLINE; do
+ [ "$o" = "$1" ] && return 0
+ [ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
+ done
+ return 1
+}
sh -i
}
-getarg() {
- local o line
- for o in $CMDLINE; do
- [ "$o" = "$1" ] && return 0
- [ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
- done
- return 1
-}
-
source_all() {
local f
[ "$1" ] && [ -d "/$1" ] || return
trap "emergency_shell" 0
+. /lib/dracut-lib
+
mknod /dev/null c 1 3
# mount some important things
mount -t sysfs /sys /sys >/dev/null 2>&1
mount -t tmpfs -omode=0755 udev /dev >/dev/null 2>&1
-read CMDLINE </proc/cmdline;
getarg ramfsdebug && set -x
# Make some basic devices first, let udev handle the rest
mknod /dev/null c 1 3
exit 1
fi
inst "$moddir/switch_root" "/sbin/switch_root"
+inst "$moddir/dracut-lib" "/lib/dracut-lib"
inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"