|
Harald Hoyer |
d1bf89 |
From 8d95b8b338d65188c517b3bda8a4697867c6ef01 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
d1bf89 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
d1bf89 |
Date: Mon, 18 Jun 2012 12:52:39 +0200
|
|
Harald Hoyer |
d1bf89 |
Subject: [PATCH] Set some global variables in dracut-functions.sh
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
---
|
|
Harald Hoyer |
d1bf89 |
dracut-functions.sh | 34 +++++++++++++++++++++++++++++++---
|
|
Harald Hoyer |
d1bf89 |
dracut.sh | 22 ----------------------
|
|
Harald Hoyer |
d1bf89 |
2 files changed, 31 insertions(+), 25 deletions(-)
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
|
Harald Hoyer |
d1bf89 |
index 68c81f2..1137919 100755
|
|
Harald Hoyer |
d1bf89 |
--- a/dracut-functions.sh
|
|
Harald Hoyer |
d1bf89 |
+++ b/dracut-functions.sh
|
|
Harald Hoyer |
d1bf89 |
@@ -20,6 +20,9 @@
|
|
Harald Hoyer |
d1bf89 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Harald Hoyer |
d1bf89 |
#
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
+# Generic substring function. If $2 is in $1, return 0.
|
|
Harald Hoyer |
d1bf89 |
+strstr() { [ "${1#*$2*}" != "$1" ]; }
|
|
Harald Hoyer |
d1bf89 |
+
|
|
Harald Hoyer |
d1bf89 |
if ! [[ $dracutbasedir ]]; then
|
|
Harald Hoyer |
d1bf89 |
dracutbasedir=${BASH_SOURCE[0]%/*}
|
|
Harald Hoyer |
d1bf89 |
[[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="."
|
|
Harald Hoyer |
d1bf89 |
@@ -27,6 +30,34 @@ if ! [[ $dracutbasedir ]]; then
|
|
Harald Hoyer |
d1bf89 |
dracutbasedir="$(readlink -f $dracutbasedir)"
|
|
Harald Hoyer |
d1bf89 |
fi
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
+# Detect lib paths
|
|
Harald Hoyer |
d1bf89 |
+if ! [[ $libdirs ]] ; then
|
|
Harald Hoyer |
d1bf89 |
+ if strstr "$(ldd /bin/sh)" "/lib64/" &>/dev/null \
|
|
Harald Hoyer |
d1bf89 |
+ && [[ -d /lib64 ]]; then
|
|
Harald Hoyer |
d1bf89 |
+ libdirs+=" /lib64"
|
|
Harald Hoyer |
d1bf89 |
+ [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
|
|
Harald Hoyer |
d1bf89 |
+ else
|
|
Harald Hoyer |
d1bf89 |
+ libdirs+=" /lib"
|
|
Harald Hoyer |
d1bf89 |
+ [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
|
|
Harald Hoyer |
d1bf89 |
+ fi
|
|
Harald Hoyer |
d1bf89 |
+ export libdirs
|
|
Harald Hoyer |
d1bf89 |
+fi
|
|
Harald Hoyer |
d1bf89 |
+
|
|
Harald Hoyer |
d1bf89 |
+if ! [[ $kernel ]]; then
|
|
Harald Hoyer |
d1bf89 |
+ kernel=$(uname -r)
|
|
Harald Hoyer |
d1bf89 |
+ export kernel
|
|
Harald Hoyer |
d1bf89 |
+fi
|
|
Harald Hoyer |
d1bf89 |
+
|
|
Harald Hoyer |
d1bf89 |
+srcmods="/lib/modules/$kernel/"
|
|
Harald Hoyer |
d1bf89 |
+[[ $drivers_dir ]] && {
|
|
Harald Hoyer |
d1bf89 |
+ if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then
|
|
Harald Hoyer |
d1bf89 |
+ dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
|
|
Harald Hoyer |
d1bf89 |
+ exit 1
|
|
Harald Hoyer |
d1bf89 |
+ fi
|
|
Harald Hoyer |
d1bf89 |
+ srcmods="$drivers_dir"
|
|
Harald Hoyer |
d1bf89 |
+}
|
|
Harald Hoyer |
d1bf89 |
+export srcmods
|
|
Harald Hoyer |
d1bf89 |
+
|
|
Harald Hoyer |
d1bf89 |
if ! type dinfo >/dev/null 2>&1; then
|
|
Harald Hoyer |
d1bf89 |
. "$dracutbasedir/dracut-logger.sh"
|
|
Harald Hoyer |
d1bf89 |
dlog_init
|
|
Harald Hoyer |
d1bf89 |
@@ -41,9 +72,6 @@ fi
|
|
Harald Hoyer |
d1bf89 |
export hookdirs
|
|
Harald Hoyer |
d1bf89 |
}
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
-# Generic substring function. If $2 is in $1, return 0.
|
|
Harald Hoyer |
d1bf89 |
-strstr() { [ "${1#*$2*}" != "$1" ]; }
|
|
Harald Hoyer |
d1bf89 |
-
|
|
Harald Hoyer |
d1bf89 |
# Create all subdirectories for given path without creating the last element.
|
|
Harald Hoyer |
d1bf89 |
# $1 = path
|
|
Harald Hoyer |
d1bf89 |
mksubdirs() { mkdir -m 0755 -p ${1%/*}; }
|
|
Harald Hoyer |
d1bf89 |
diff --git a/dracut.sh b/dracut.sh
|
|
Harald Hoyer |
d1bf89 |
index 919f78e..5600ec0 100755
|
|
Harald Hoyer |
d1bf89 |
--- a/dracut.sh
|
|
Harald Hoyer |
d1bf89 |
+++ b/dracut.sh
|
|
Harald Hoyer |
d1bf89 |
@@ -531,18 +531,6 @@ ddebug "Executing $0 $dracut_args"
|
|
Harald Hoyer |
d1bf89 |
exit 0
|
|
Harald Hoyer |
d1bf89 |
}
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
-# Detect lib paths
|
|
Harald Hoyer |
d1bf89 |
-if ! [[ $libdirs ]] ; then
|
|
Harald Hoyer |
d1bf89 |
- if strstr "$(ldd /bin/sh)" "/lib64/" &>/dev/null \
|
|
Harald Hoyer |
d1bf89 |
- && [[ -d /lib64 ]]; then
|
|
Harald Hoyer |
d1bf89 |
- libdirs+=" /lib64"
|
|
Harald Hoyer |
d1bf89 |
- [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
|
|
Harald Hoyer |
d1bf89 |
- else
|
|
Harald Hoyer |
d1bf89 |
- libdirs+=" /lib"
|
|
Harald Hoyer |
d1bf89 |
- [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
|
|
Harald Hoyer |
d1bf89 |
- fi
|
|
Harald Hoyer |
d1bf89 |
-fi
|
|
Harald Hoyer |
d1bf89 |
-
|
|
Harald Hoyer |
d1bf89 |
# This is kinda legacy -- eventually it should go away.
|
|
Harald Hoyer |
d1bf89 |
case $dracutmodules in
|
|
Harald Hoyer |
d1bf89 |
""|auto) dracutmodules="all" ;;
|
|
Harald Hoyer |
d1bf89 |
@@ -550,16 +538,6 @@ esac
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
|
Harald Hoyer |
d1bf89 |
|
|
Harald Hoyer |
d1bf89 |
-srcmods="/lib/modules/$kernel/"
|
|
Harald Hoyer |
d1bf89 |
-[[ $drivers_dir ]] && {
|
|
Harald Hoyer |
d1bf89 |
- if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then
|
|
Harald Hoyer |
d1bf89 |
- dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
|
|
Harald Hoyer |
d1bf89 |
- exit 1
|
|
Harald Hoyer |
d1bf89 |
- fi
|
|
Harald Hoyer |
d1bf89 |
- srcmods="$drivers_dir"
|
|
Harald Hoyer |
d1bf89 |
-}
|
|
Harald Hoyer |
d1bf89 |
-export srcmods
|
|
Harald Hoyer |
d1bf89 |
-
|
|
Harald Hoyer |
d1bf89 |
[[ -f $srcmods/modules.dep ]] || {
|
|
Harald Hoyer |
d1bf89 |
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
|
|
Harald Hoyer |
d1bf89 |
exit 1
|