diff options
author | Harald Hoyer <harald@redhat.com> | 2012-06-18 12:52:39 +0200 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2012-06-18 13:26:37 +0200 |
commit | 8d95b8b338d65188c517b3bda8a4697867c6ef01 (patch) | |
tree | 5a204e1b5e471111cbb0fb2217a410c2d44c095a /dracut-functions.sh | |
parent | 7abd426438984f9c3112fd409e9c019408fe85a4 (diff) | |
download | dracut-8d95b8b338d65188c517b3bda8a4697867c6ef01.tar.gz dracut-8d95b8b338d65188c517b3bda8a4697867c6ef01.tar.bz2 dracut-8d95b8b338d65188c517b3bda8a4697867c6ef01.zip |
Set some global variables in dracut-functions.sh
Diffstat (limited to 'dracut-functions.sh')
-rwxr-xr-x | dracut-functions.sh | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/dracut-functions.sh b/dracut-functions.sh index 68c81f2a..11379195 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -20,6 +20,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # +# Generic substring function. If $2 is in $1, return 0. +strstr() { [ "${1#*$2*}" != "$1" ]; } + if ! [[ $dracutbasedir ]]; then dracutbasedir=${BASH_SOURCE[0]%/*} [[ $dracutbasedir = "dracut-functions" ]] && dracutbasedir="." @@ -27,6 +30,34 @@ if ! [[ $dracutbasedir ]]; then dracutbasedir="$(readlink -f $dracutbasedir)" fi +# Detect lib paths +if ! [[ $libdirs ]] ; then + if strstr "$(ldd /bin/sh)" "/lib64/" &>/dev/null \ + && [[ -d /lib64 ]]; then + libdirs+=" /lib64" + [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64" + else + libdirs+=" /lib" + [[ -d /usr/lib ]] && libdirs+=" /usr/lib" + fi + export libdirs +fi + +if ! [[ $kernel ]]; then + kernel=$(uname -r) + export kernel +fi + +srcmods="/lib/modules/$kernel/" +[[ $drivers_dir ]] && { + if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then + dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.' + exit 1 + fi + srcmods="$drivers_dir" +} +export srcmods + if ! type dinfo >/dev/null 2>&1; then . "$dracutbasedir/dracut-logger.sh" dlog_init @@ -41,9 +72,6 @@ fi export hookdirs } -# Generic substring function. If $2 is in $1, return 0. -strstr() { [ "${1#*$2*}" != "$1" ]; } - # Create all subdirectories for given path without creating the last element. # $1 = path mksubdirs() { mkdir -m 0755 -p ${1%/*}; } |