reformat source code

removed tabs and set indention to 4 spaces
added emacs and vi format headers
master
Harald Hoyer 2010-09-10 15:23:06 +02:00
parent d95d2f3b44
commit cc02093d69
173 changed files with 1835 additions and 1448 deletions

178
dracut
View File

@ -1,11 +1,13 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
# of the various mkinitrd implementations out there
#

# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -24,7 +26,8 @@

usage() {
# 80x25 linebreak here ^
echo "Usage: $0 [OPTION]... <initramfs> <kernel-version>
cat << EOF
Usage: $0 [OPTION]... <initramfs> <kernel-version>
Creates initial ramdisk images for preloading modules

-f, --force Overwrite existing initramfs file.
@ -48,21 +51,21 @@ Creates initial ramdisk images for preloading modules
--no-kernel Do not install kernel drivers and firmware files
--ignore-kernel-modules
Don't try to load modules. It automatically implies
'--no-kernel'. It's assumed that everything needed
is built into kernel.
'--no-kernel'. It's assumed that everything needed
is built into kernel.
--strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs (default)
--mdadmconf Include local /etc/mdadm.conf
--nomdadmconf Do not include local /etc/mdadm.conf
--lvmconf Include local /etc/lvm/lvm.conf
--nolvmconf Do not include local /etc/lvm/lvm.conf
--nolvmconf Do not include local /etc/lvm/lvm.conf
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
-c, --conf [FILE] Specify configuration file to use.
Default: /etc/dracut.conf
--confdir [DIR] Specify configuration directory to use *.conf files from.
Default: /etc/dracut.conf.d
--confdir [DIR] Specify configuration directory to use *.conf files
from. Default: /etc/dracut.conf.d
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
/usr/share/dracut/modules.d.
@ -76,17 +79,17 @@ Creates initial ramdisk images for preloading modules
-I, --install [LIST] Install the space separated list of files into the
initramfs.
--gzip Compress the generated initramfs using gzip.
This will be done by default, unless another
compression option or --no-compress is passed.
This will be done by default, unless another
compression option or --no-compress is passed.
--bzip2 Compress the generated initramfs using bzip2.
Make sure your kernel has bzip2 decompression support
compiled in, otherwise you will not be able to boot.
--lzma Compress the generated initramfs using lzma.
Make sure your kernel has lzma support compiled in,
otherwise you will not be able to boot.
Make sure your kernel has bzip2 decompression support
compiled in, otherwise you will not be able to boot.
--lzma Compress the generated initramfs using lzma.
Make sure your kernel has lzma support compiled in,
otherwise you will not be able to boot.
--no-compress Do not compress the generated initramfs. This will
override any other compression options.
"
override any other compression options.
EOF
}

# Little helper function for reading args from the commandline.
@ -98,44 +101,44 @@ read_arg() {
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
read "$1" <<< "${BASH_REMATCH[1]}"
else
read "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
read "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}

while (($# > 0)); do
case ${1%%=*} in
-m|--modules) read_arg dracutmodules_l "$@" || shift;;
-o|--omit) read_arg omit_dracutmodules_l "$@" || shift;;
-a|--add) read_arg add_dracutmodules_l "$@" || shift;;
-d|--drivers) read_arg drivers_l "$@" || shift;;
--add-drivers) read_arg add_drivers_l "$@" || shift;;
--filesystems) read_arg filesystems_l "$@" || shift;;
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
-c|--conf) read_arg conffile "$@" || shift;;
--confdir) read_arg confdir "$@" || shift;;
-I|--install) read_arg install_items "$@" || shift;;
--fwdir) read_arg fw_dir_l "$@" || shift;;
-f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
-m|--modules) read_arg dracutmodules_l "$@" || shift;;
-o|--omit) read_arg omit_dracutmodules_l "$@" || shift;;
-a|--add) read_arg add_dracutmodules_l "$@" || shift;;
-d|--drivers) read_arg drivers_l "$@" || shift;;
--add-drivers) read_arg add_drivers_l "$@" || shift;;
--filesystems) read_arg filesystems_l "$@" || shift;;
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
-c|--conf) read_arg conffile "$@" || shift;;
--confdir) read_arg confdir "$@" || shift;;
-I|--install) read_arg install_items "$@" || shift;;
--fwdir) read_arg fw_dir_l "$@" || shift;;
-f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
--mdadmconf) mdadmconf_l="yes";;
--nomdadmconf) mdadmconf_l="no";;
--lvmconf) lvmconf_l="yes";;
--nolvmconf) lvmconf_l="no";;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-l|--local) allowlocal="yes" ;;
-H|--hostonly) hostonly_l="yes" ;;
--fstab) use_fstab_l="yes" ;;
-h|--help) usage; exit 1 ;;
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-l|--local) allowlocal="yes" ;;
-H|--hostonly) hostonly_l="yes" ;;
--fstab) use_fstab_l="yes" ;;
-h|--help) usage; exit 1 ;;
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
--bzip2) [[ $compress != cat ]] && compress="bzip2 -9";;
--lzma) [[ $compress != cat ]] && compress="lzma -9";;
--no-compress) compress="cat";;
@ -147,8 +150,8 @@ while (($# > 0)); do
ignore_kmodules="yes"
omit_dracutmodules_l+=\ kernel-modules
;;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
esac
shift
done
@ -163,7 +166,8 @@ export PATH

[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut

[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && dracutbasedir="${0%/*}"
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
dracutbasedir="${0%/*}"

# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
@ -182,7 +186,7 @@ fi
# source our config dir
if [[ $confdir && -d $confdir ]]; then
for f in "$confdir"/*.conf; do
[[ -e $f ]] && . "$f"
[[ -e $f ]] && . "$f"
done
fi

@ -213,11 +217,12 @@ fw_dir=${fw_dir//:/ }
[[ $compress ]] || compress="gzip -9"

if [[ -f $dracutbasedir/dracut-functions ]]; then
. $dracutbasedir/dracut-functions
. $dracutbasedir/dracut-functions
else
echo "Cannot find $dracutbasedir/dracut-functions. Are you running from a git checkout?"
echo "Try passing -l as an argument to $0"
exit 1
echo "Cannot find $dracutbasedir/dracut-functions."
echo "Are you running from a git checkout?"
echo "Try passing -l as an argument to $0"
exit 1
fi

dracutfunctions=$dracutbasedir/dracut-functions
@ -270,13 +275,16 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
exit 1
fi

hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency"
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount"
hookdirs+=" pre-pivot mount emergency"

[[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)

trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT # clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT # clean up after ourselves no matter how we die.
# clean up after ourselves no matter how we die.
trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT

# Need to be able to have non-root users read stuff (rpcbind etc)
chmod 755 "$initdir"
@ -288,29 +296,30 @@ export initdir hookdirs dracutbasedir dracutmodules drivers \

if [[ $kernel_only != yes ]]; then
# Create some directory structure first
for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/run; do
inst_dir "/$d";
for d in bin sbin usr/bin usr/sbin usr/lib etc \
proc sys sysroot tmp dev/pts var/run; do
inst_dir "/$d";
done
fi

# check all our modules to see if they should be sourced.
# This builds a list of modules that we will install next.
check_modules

# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
if strstr "$mods_to_load" " $mod "; then
dinfo "*** Sourcing module $mod"
if [[ $kernel_only = yes ]]; then
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
else
. "$moddir/install"
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
. "$moddir/installkernel"
fi
fi
mods_to_load=${mods_to_load// $mod /}
dinfo "*** Sourcing module $mod"
if [[ $kernel_only = yes ]]; then
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
else
. "$moddir/install"
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
. "$moddir/installkernel"
fi
fi
mods_to_load=${mods_to_load// $mod /}
fi
done
unset moddir
@ -330,45 +339,38 @@ if [[ $include_src && $include_target ]]; then
fi

for item in $install_items; do
dracut_install "$item"
dracut_install "$item"
done
unset item

# make sure that library links are correct and up to date
cp -ar /etc/ld.so.conf* "$initdir"/etc
ldconfig -r "$initdir" || [[ $UID != "0" ]] && dinfo "ldconfig might need uid=0 (root) for chroot()"
ldconfig -r "$initdir" || [[ $UID != "0" ]] && \
dinfo "ldconfig might need uid=0 (root) for chroot()"

[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)

# strip binaries
if [[ $do_strip = yes ]] ; then
for p in strip grep find; do
if ! type -P $p >/dev/null; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
fi
if ! type -P $p >/dev/null; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
fi
done
fi

if [[ $do_strip = yes ]] ; then
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -path '*/lib/modules/*.ko' \) ); do
dinfo "Stripping $f"
strip -g "$f" 2>/dev/null|| :
#
# FIXME: only strip -g for now
#
#strip -g --strip-unneeded "$f" || :
#note="-R .note"
#if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
# grep -q ALLOC; then
# note=
#fi
#strip -R .comment $note "$f" || :
for f in $(find "$initdir" -type f \
\( -perm -0100 -or -perm -0010 -or -perm -0001 \
-or -path '*/lib/modules/*.ko' \) ); do
dinfo "Stripping $f"
strip -g "$f" 2>/dev/null|| :
done
fi

type hardlink &>/dev/null && {
hardlink "$initdir" 2>&1
hardlink "$initdir" 2>&1
}

if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \

View File

@ -1,5 +1,7 @@
#!/bin/bash --norc

# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
@ -31,7 +33,8 @@ derror() {

usage() {
# 80x25 linebreak here ^
echo "Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
cat << EOF
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
Creates initial ramdisk image by concatenating several images from the command
line and /boot/dracut/

@ -45,7 +48,7 @@ line and /boot/dracut/
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
"
EOF
}


@ -54,16 +57,16 @@ overlay=/var/lib/dracut/overlay

while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
esac
shift
done
@ -108,7 +111,7 @@ fi

if [[ ! $no_imagedir ]]; then
for i in "$imagedir/"*.img; do
[[ -f $i ]] && images+=("$i")
[[ -f $i ]] && images+=("$i")
done
fi


View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# functions used by dracut and other tools.
#
@ -58,8 +60,8 @@ vercmp() {
# Log initrd creation.
if ! [[ $dracutlogfile ]]; then
[[ $dracutbasedir = /usr/share/dracut ]] && \
dracutlogfile=/var/log/dracut.log || \
dracutlogfile=/tmp/dracut.log
dracutlogfile=/var/log/dracut.log || \
dracutlogfile=/tmp/dracut.log
# [[ -w $dracutlogfile ]] || dracutlogfile=/tmp/dracut.log
if [[ -w $dracutlogfile ]]; then
>"$dracutlogfile"
@ -99,21 +101,21 @@ get_fs_env() {
[[ $ID_FS_TYPE ]] && return

if [[ -x /lib/udev/vol_id ]]; then
eval $(/lib/udev/vol_id --export $1)
eval $(/lib/udev/vol_id --export $1)
elif find_binary blkid >/dev/null; then
eval $(blkid -o udev $1)
eval $(blkid -o udev $1)
else
return 1
return 1
fi
}

get_fs_type() (
[[ $1 ]] || return
if [[ $1 != ${1#/dev/block/nfs:} ]] \
|| [[ $1 != ${1#/dev/block/nfs3:} ]] \
|| [[ $1 != ${1#/dev/block/nfs4:} ]]; then
echo "nfs"
return
|| [[ $1 != ${1#/dev/block/nfs3:} ]] \
|| [[ $1 != ${1#/dev/block/nfs4:} ]]; then
echo "nfs"
return
fi
get_fs_env $1 || return
echo $ID_FS_TYPE
@ -127,32 +129,32 @@ get_fs_uuid() (
# finds the major:minor of the block device backing the root filesystem.
find_block_device() {
local x mpt majmin dev fs misc maj min
if [[ $use_fstab != yes ]]; then
while read x x majmin x mpt x x fs misc; do
if [[ $use_fstab != yes ]]; then
while read x x majmin x mpt x x fs misc; do
[[ $fs = nfs ]] && { echo $dev; return 0;}
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then
echo $majmin;
return 0 # we have a winner!
fi
done < /proc/self/mountinfo
if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then
echo $majmin;
return 0 # we have a winner!
fi
done < /proc/self/mountinfo
fi
# fall back to /etc/fstab
while read dev mpt fs misc; do
if [[ $mpt = $1 ]]; then
if [[ $mpt = $1 ]]; then
[[ $fs = nfs ]] && { echo $dev; return 0;}
[[ $fs = nfs3 ]] && { echo $dev; return 0;}
[[ $fs = nfs4 ]] && { echo $dev; return 0;}
[[ $dev != ${dev#UUID=} ]] && dev=/dev/disk/by-uuid/${dev#UUID=}
[[ $dev != ${dev#LABEL=} ]] && dev=/dev/disk/by-label/${dev#LABEL=}
[[ -b $dev ]] || return 1 # oops, not a block device.
ls -nLl "$dev" | {
read x x x x maj min x;
maj=${maj//,/};
echo $maj:$min;
} && return 0
fi
[[ -b $dev ]] || return 1 # oops, not a block device.
ls -nLl "$dev" | {
read x x x x maj min x;
maj=${maj//,/};
echo $maj:$min;
} && return 0
fi
done < /etc/fstab
return 1;
}
@ -169,12 +171,12 @@ check_block_and_slaves() {
"$1" $2 && return
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $x ]] || continue
check_block_and_slaves $1 $(cat "$x") && return 0
check_block_and_slaves $1 $(cat "$x") && return 0
done
return 1
}
@ -191,19 +193,19 @@ get_numeric_dev() {
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
for i in /dev/mapper/*; do
lv=$(get_numeric_dev $i)
if [[ $lv = $2 ]]; then
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
vg=$(echo $vg)
if [[ $vg ]]; then
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null); \
do
check_block_and_slaves $1 $(get_numeric_dev $pv) \
&& return 0
done
fi
fi
lv=$(get_numeric_dev $i)
if [[ $lv = $2 ]]; then
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
vg=$(echo $vg)
if [[ $vg ]]; then
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null); \
do
check_block_and_slaves $1 $(get_numeric_dev $pv) \
&& return 0
done
fi
fi
done
return 1
}
@ -286,13 +288,13 @@ inst_library() {
local src=$1 dest=${2:-$1} lib reallib symlink
[[ -e $initdir$dest ]] && return 0
if [[ -L $src ]]; then
reallib=$(readlink -f "$src")
lib=${src##*/}
inst_simple "$reallib" "$reallib"
inst_dir "${dest%/*}"
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
reallib=$(readlink -f "$src")
lib=${src##*/}
inst_simple "$reallib" "$reallib"
inst_dir "${dest%/*}"
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
else
inst_simple "$src" "$dest"
inst_simple "$src" "$dest"
fi

# Create additional symlinks. See rev_symlinks description.
@ -310,7 +312,7 @@ find_binary() {
local binpath="/bin /sbin /usr/bin /usr/sbin" p
[[ -z ${1##/*} && -x $1 ]] && { echo $1; return 0; }
for p in $binpath; do
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
done
return 1
}
@ -326,33 +328,33 @@ inst_binary() {
[[ -e $initdir$target ]] && return 0
# I love bash!
LC_ALL=C ldd $bin 2>/dev/null | while read line; do
[[ $line = 'not a dynamic executable' ]] && return 1
if [[ $line =~ not\ found ]]; then
derror "Missing a shared library required by $bin."
derror "Run \"ldd $bin\" to find out what it is."
derror "dracut cannot create an initrd."
exit 1
fi
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
[[ $line =~ $so_regex ]] || continue
FILE=${BASH_REMATCH[1]}
[[ -e ${initdir}$FILE ]] && continue
# see if we are loading an optimized version of a shared lib.
lib_regex='^(/lib[^/]*).*'
if [[ $FILE =~ $lib_regex ]]; then
[[ $line = 'not a dynamic executable' ]] && return 1
if [[ $line =~ not\ found ]]; then
derror "Missing a shared library required by $bin."
derror "Run \"ldd $bin\" to find out what it is."
derror "dracut cannot create an initrd."
exit 1
fi
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
[[ $line =~ $so_regex ]] || continue
FILE=${BASH_REMATCH[1]}
[[ -e ${initdir}$FILE ]] && continue
# see if we are loading an optimized version of a shared lib.
lib_regex='^(/lib[^/]*).*'
if [[ $FILE =~ $lib_regex ]]; then
TLIBDIR=${BASH_REMATCH[1]}
BASE=${FILE##*/}
# prefer nosegneg libs, then unoptimized ones.
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
[[ -e $f/$BASE ]] || continue
FILE=$f/$BASE
break
done
inst_library "$FILE" "$TLIBDIR/$BASE"
# prefer nosegneg libs, then unoptimized ones.
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
[[ -e $f/$BASE ]] || continue
FILE=$f/$BASE
break
done
inst_library "$FILE" "$TLIBDIR/$BASE"
IF_dynamic=yes
continue
fi
inst_library "$FILE"
continue
fi
inst_library "$FILE"
done
inst_simple "$bin" "$target"
}
@ -384,7 +386,7 @@ inst_symlink() {
find_rule() {
[[ -f $1 ]] && { echo "$1"; return 0; }
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
done
return 1
}
@ -409,14 +411,14 @@ inst() {
case $# in
1) ;;
2) [[ ! $initdir && -d $2 ]] && export initdir=$2
[[ $initdir = $2 ]] && set $1;;
[[ $initdir = $2 ]] && set $1;;
3) [[ -z $initdir ]] && export initdir=$2
set $1 $3;;
set $1 $3;;
*) derror "inst only takes 1 or 2 or 3 arguments"
exit 1;;
exit 1;;
esac
for x in inst_symlink inst_script inst_binary inst_simple; do
$x "$@" && return 0
$x "$@" && return 0
done
return 1
}
@ -426,31 +428,31 @@ inst() {
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
inst_hook() {
if ! [[ -f $3 ]]; then
derror "Cannot install a hook ($3) that does not exist."
derror "Aborting initrd creation."
exit 1
derror "Cannot install a hook ($3) that does not exist."
derror "Aborting initrd creation."
exit 1
elif ! strstr "$hookdirs" "$1"; then
derror "No such hook type $1. Aborting initrd creation."
exit 1
derror "No such hook type $1. Aborting initrd creation."
exit 1
fi
inst_simple "$3" "/${1}/${2}${3##*/}"
}

dracut_install() {
if [[ $1 = '-o' ]]; then
local optional=yes
shift
local optional=yes
shift
fi
while (($# > 0)); do
if ! inst "$1" ; then
if [[ $optional = yes ]]; then
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
else
derror "Failed to install $1"
exit 1
if ! inst "$1" ; then
if [[ $optional = yes ]]; then
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
else
derror "Failed to install $1"
exit 1
fi
fi
shift
fi
shift
done
}

@ -511,15 +513,15 @@ check_module_deps() {
[[ -d $moddir && -x $moddir/install ]] || return 1
# if we do not have a check script, we are unconditionally included
if [[ -x $moddir/check ]]; then
"$moddir/check"
"$moddir/check"
ret=$?
# a return value of 255 = load module only as a dependency.
((ret==0||ret==255)) || return 1
for dep in $("$moddir/check" -d); do
check_module_deps "$dep" && continue
dwarning "Dependency $mod failed."
return 1
done
# a return value of 255 = load module only as a dependency.
((ret==0||ret==255)) || return 1
for dep in $("$moddir/check" -d); do
check_module_deps "$dep" && continue
dwarning "Dependency $mod failed."
return 1
done
fi
mods_to_load+=" $1 "
}
@ -535,9 +537,9 @@ should_source_module() {
[[ -x $1/check ]] || return 0
"$1/check" $hostonly || continue
for dep in $("$1/check" -d); do
check_module_deps "$dep" && continue
dwarning "Cannot load dracut module \"$mod\", dependencies failed."
return 1
check_module_deps "$dep" && continue
dwarning "Cannot load dracut module \"$mod\", dependencies failed."
return 1
done
}

@ -545,33 +547,33 @@ check_modules() {
local modcheck;
local mod;
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
# If we are already scheduled to be loaded, no need to check again.
strstr " $mods_to_load " " $mod " && continue
# This should never happen, but...
[[ -d $moddir ]] || continue
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
# If we are already scheduled to be loaded, no need to check again.
strstr " $mods_to_load " " $mod " && continue
# This should never happen, but...
[[ -d $moddir ]] || continue
strstr " $omit_dracutmodules " " $mod " && continue

if ! strstr " $dracutmodules $add_dracutmodules " " $mod "; then
# module not in our list
if [[ $dracutmodules = all ]]; then
if [[ $dracutmodules = all ]]; then
# check, if we can install this module
should_source_module "$moddir" || continue
should_source_module "$moddir" || continue
else
# skip this module
continue
fi
else
if [ -x "$moddir/check" ] \
else
if [ -x "$moddir/check" ] \
&& "$moddir/check" -d > /dev/null 2>&1; then
check_module_deps "$mod" || {
dwarning "Cannot load dracut module \"$mod\", dependencies failed."
check_module_deps "$mod" || {
dwarning "Cannot load dracut module \"$mod\", dependencies failed."
continue
}
fi
fi

mods_to_load+=" $mod "
mods_to_load+=" $mod "
done

modcheck=$add_dracutmodules
@ -589,18 +591,18 @@ install_kmod_with_fw() {
local modname=${1##*/} fwdir found
modname=${modname%.ko*}
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \
return 0 # no need to go further if the module is already installed
return 0 # no need to go further if the module is already installed
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
found=''
for fwdir in $fw_dir; do
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
found=yes
fi
done
if [[ $found != yes ]]; then
dinfo "Possible missing firmware \"${fw}\" for kernel module \"${mod}.ko\""
fi
found=''
for fwdir in $fw_dir; do
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
found=yes
fi
done
if [[ $found != yes ]]; then
dinfo "Possible missing firmware \"${fw}\" for kernel module \"${mod}.ko\""
fi
done
}

@ -614,9 +616,9 @@ for_each_kmod_dep() {
local func=$1 kmod=$2 cmd modpapth options
shift 2
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | \
while read cmd modpath options; do
[[ $cmd = insmod ]] || continue
$func $modpath
while read cmd modpath options; do
[[ $cmd = insmod ]] || continue
$func $modpath
done
}

@ -630,16 +632,16 @@ for_each_kmod_dep() {
# This function returns the full filenames of modules that match $1
filter_kernel_modules () (
if ! [[ $hostonly ]]; then
filtercmd='find "$srcmods/kernel/drivers" -name "*.ko" -o -name "*.ko.gz"'
filtercmd='find "$srcmods/kernel/drivers" -name "*.ko" -o -name "*.ko.gz"'
else
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
fi
for modname in $(eval $filtercmd); do
case $modname in
*.ko) "$1" "$modname" && echo "$modname";;
*.ko.gz) gzip -dc "$modname" > $initdir/$$.ko
$1 $initdir/$$.ko && echo "$modname"
rm -f $initdir/$$.ko;;
$1 $initdir/$$.ko && echo "$modname"
rm -f $initdir/$$.ko;;
esac
done
)
@ -649,46 +651,46 @@ instmods() {
[[ $no_kernel = yes ]] && return
local mod mpargs modpath modname cmd moddirname
while (($# > 0)); do
mod=${1%.ko*}
case $mod in
=*) # This introduces 2 incompatible meanings for =* arguments
mod=${1%.ko*}
case $mod in
=*)
# This introduces 2 incompatible meanings for =* arguments
# to instmods. We need to decide which one to keep.
if [[ $mod = =ata && -f $srcmods/modules.block ]] ; then
instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.block")
elif [ -f $srcmods/modules.${mod#=} ]; then
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
else
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
fi
;;
--*) mod=${mod##*/}
mpargs+=" $mod";;
if [[ $mod = =ata && -f $srcmods/modules.block ]] ; then
instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.block")
elif [ -f $srcmods/modules.${mod#=} ]; then
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
else
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
fi
;;
--*)
mod=${mod##*/}
mpargs+=" $mod";;
i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
*) mod=${mod##*/}
*) mod=${mod##*/}
# if we are already installed, skip this module and go on
# to the next one.
[[ -f $initdir/$1 ]] && { shift; continue; }
# If we are building a host-specific initramfs and this
# module is not already loaded, move on to the next one.
[[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules && \
! echo $add_drivers | grep -qe "\<${mod}\>" && {
shift; continue;
}
# to the next one.
[[ -f $initdir/$1 ]] && { shift; continue; }
# If we are building a host-specific initramfs and this
# module is not already loaded, move on to the next one.
[[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules && \
! echo $add_drivers | grep -qe "\<${mod}\>" && {
shift; continue;
}

# We use '-d' option in modprobe only if modules prefix path
# differs from default '/'. This allows us to use Dracut with
# old version of modprobe which doesn't have '-d' option.
moddirname=${srcmods%%/lib/modules/*}
[[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"
# We use '-d' option in modprobe only if modules prefix path
# differs from default '/'. This allows us to use Dracut with
# old version of modprobe which doesn't have '-d' option.
moddirname=${srcmods%%/lib/modules/*}
[[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"

# ok, load the module, all its dependencies, and any firmware
# it may require
for_each_kmod_dep install_kmod_with_fw $mod \
--set-version $kernel ${moddirname}
;;
esac
shift
# ok, load the module, all its dependencies, and any firmware
# it may require
for_each_kmod_dep install_kmod_with_fw $mod \
--set-version $kernel ${moddirname}
;;
esac
shift
done
}

# vim:ts=8:sw=4:sts=4:et
}

View File

@ -1,4 +1,6 @@
#!/bin/bash --norc
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
@ -43,13 +45,13 @@ function get_verbose() {


function get_numeric_dev() {
(
fmt="%d:%d"
if [ "$1" == "hex" ]; then
fmt="%x:%x"
fi
ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }'
) 2>/dev/null
(
fmt="%d:%d"
if [ "$1" == "hex" ]; then
fmt="%x:%x"
fi
ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }'
) 2>/dev/null
}


@ -173,7 +175,7 @@ finddevnoinsys() {
majmin="$1"
if [ -n "$majmin" ]; then
dev=$(for x in /sys/block/* ; do find $x/ -name dev ; done | while read device ; do \
echo "$majmin" | cmp -s $device && echo $device ; done)
echo "$majmin" | cmp -s $device && echo $device ; done)
if [ -n "$dev" ]; then
dev=${dev%%/dev}
dev=${dev%%/}
@ -309,7 +311,7 @@ iscsi_set_parameters() {
iscsi_get_rec_val $tmpfile "node.session.auth.password"
chap_pw="-w ${result}"
else
chap=""
chap=""
fi

iscsi_get_rec_val $tmpfile "node.session.auth.username_in"
@ -319,7 +321,7 @@ iscsi_set_parameters() {
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
chap_in_pw="-W ${result}"
else
chap_in=""
chap_in=""
fi

rm $tmpfile
@ -395,29 +397,29 @@ handledm() {
done << EOF
$(dmsetup table -j $major -m $minor 2>/dev/null)
EOF
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
local vg=$(lvshow "/dev/mapper/$name")
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
*" $vg "*) ;;
*) vg_list="$vg_list $vg"
[ -z "$nolvm" ] && find_base_dm_mods
;;
esac
fi
for raid in $raids ; do
if [ "$raid" == "$name" ]; then
case " $DMRAIDS " in
*" $raid "*) ;;
*) DMRAIDS="$DMRAIDS $raid"
[ -z "$nodmraid" ] && find_base_dm_mods
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
local vg=$(lvshow "/dev/mapper/$name")
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
*" $vg "*) ;;
*) vg_list="$vg_list $vg"
[ -z "$nolvm" ] && find_base_dm_mods
;;
esac
break
fi
done
for raid in $raids ; do
if [ "$raid" == "$name" ]; then
case " $DMRAIDS " in
*" $raid "*) ;;
*) DMRAIDS="$DMRAIDS $raid"
[ -z "$nodmraid" ] && find_base_dm_mods
;;
esac
break
fi
done
}

handleiscsi() {
@ -440,25 +442,25 @@ handleraid() {
return 0
fi

levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)
levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)

for level in $levels ; do
case $level in
linear)
start=1
;;
multipath)
start=1
;;
raid[01] | raid10)
start=1
;;
raid[456])
start=1
;;
*)
error "raid level $level (in /proc/mdstat) not recognized"
;;
linear)
start=1
;;
multipath)
start=1
;;
raid[01] | raid10)
start=1
;;
raid[456])
start=1
;;
*)
error "raid level $level (in /proc/mdstat) not recognized"
;;
esac
done
if [ "$start" = 1 ]; then
@ -474,7 +476,7 @@ lvshow() {

vgdisplay() {
lvm vgdisplay --ignorelockingfailure -v $1 2>/dev/null |
sed -n 's/PV Name//p'
sed -n 's/PV Name//p'
}

dmmods_found="n"
@ -508,78 +510,78 @@ while [ $# -gt 0 ]; do
shift
fi
;;
--rootdev*)
--rootdev*)
if [ "$1" != "${1##--rootdev=}" ]; then
rootdev="${1##--rootdev=}"
else
rootdev="$2"
shift
fi
;;
--thawdev*)
;;
--thawdev*)
if [ "$1" != "${1##--thawdev=}" ]; then
thawdev="${1##--thawdev=}"
else
thawdev="$2"
shift
fi
;;
--rootfs*)
;;
--rootfs*)
if [ "$1" != "${1##--rootfs=}" ]; then
rootfs="${1##--rootfs=}"
else
rootfs="$2"
shift
fi
;;
--rootopts*)
;;
--rootopts*)
if [ "$1" != "${1##--rootopts=}" ]; then
rootopts="${1##--rootopts=}"
else
rootopts="$2"
shift
fi
;;
--root*)
;;
--root*)
if [ "$1" != "${1##--root=}" ]; then
root="${1##--root=}"
else
root="$2"
shift
fi
;;
--loopdev*)
;;
--loopdev*)
if [ "$1" != "${1##--loopdev=}" ]; then
loopdev="${1##--loopdev=}"
else
loopdev="$2"
shift
fi
;;
--loopfs*)
;;
--loopfs*)
if [ "$1" != "${1##--loopfs=}" ]; then
loopfs="${1##--loopfs=}"
else
loopfs="$2"
shift
fi
;;
--loopopts*)
;;
--loopopts*)
if [ "$1" != "${1##--loopopts=}" ]; then
loopopts="${1##--loopopts=}"
else
loopopts="$2"
shift
fi
;;
--looppath*)
;;
--looppath*)
if [ "$1" != "${1##--looppath=}" ]; then
looppath="${1##--looppath=}"
else
looppath="$2"
shift
fi
;;
;;
--help)
usage -n
;;
@ -597,33 +599,33 @@ while [ $# -gt 0 ]; do
shift
done

[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
[ -z "$rootopts" ] && rootopts="defaults"
[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
[ -z "$rootopts" ] && rootopts="defaults"


[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
# check if it's nfsroot
physdev=""
if [ "$rootfs" == "nfs" ]; then
if [ "x$net_list" == "x" ]; then
handlenfs $rootdev
fi
else
# check if it's root by label
rdev=$rootdev
rdev=$(resolve_device_name "$rdev")
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
findstoragedriver "$rdev"
physdev=""
if [ "$rootfs" == "nfs" ]; then
if [ "x$net_list" == "x" ]; then
handlenfs $rootdev
fi
else
# check if it's root by label
rdev=$rootdev
rdev=$(resolve_device_name "$rdev")
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
findstoragedriver "$rdev"
fi

# find the first swap dev which would get used for swsusp
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
swsuspdev="$thawdev"
if [ -n "$swsuspdev" ]; then
swsuspdev=$(resolve_device_name "$swsuspdev")
findstoragedriver "$swsuspdev"
fi
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
swsuspdev="$thawdev"
if [ -n "$swsuspdev" ]; then
swsuspdev=$(resolve_device_name "$swsuspdev")
findstoragedriver "$swsuspdev"
fi


cemit()
@ -678,7 +680,7 @@ fi

if [ -z "$nolvm" -a -n "$vg_list" ]; then
for vg in $vg_list; do
echo -n "rd_LVM_VG=$vg "
echo -n "rd_LVM_VG=$vg "
done
else
echo -n "rd_NO_LVM "
@ -712,4 +714,3 @@ if [ -n "$rootdev" ]; then
fi

echo
# vim:ts=8:sw=4:sts=4:et

View File

@ -1,4 +1,6 @@
#!/bin/sh
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

STATEDIR=/var/lib/dracut
BOOTDIR=/boot
@ -11,23 +13,23 @@ version=""
set -e

if $USETRIGGERS \
&& [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
&& [ $# = 1 ] \
&& [ x"$1" = x-u ] \
&& dpkg-trigger --check-supported 2>/dev/null
&& [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
&& [ $# = 1 ] \
&& [ x"$1" = x-u ] \
&& dpkg-trigger --check-supported 2>/dev/null
then
if dpkg-trigger --no-await update-initramfs; then
echo "dracut-update-initramfs: deferring update (trigger activated)"
exit 0
fi
if dpkg-trigger --no-await update-initramfs; then
echo "dracut-update-initramfs: deferring update (trigger activated)"
exit 0
fi
fi

usage()
{
if [ -n "${1}" ]; then
printf "${@}\n\n" >&2
fi
cat >&2 << EOF
if [ -n "${1}" ]; then
printf "${@}\n\n" >&2
fi
cat >&2 << EOF
Usage: ${0} [OPTION]...

Options:
@ -41,422 +43,422 @@ Options:
-h This message

EOF
exit 1
exit 1
}

# chroot check
chrooted()
{
# borrowed from udev's postinst
if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
# the devicenumber/inode pair of / is the same as that of
# /sbin/init's root, so we're *not* in a chroot and hence
# return false.
return 1
fi
return 0
return 1
fi
return 0
}

mild_panic()
{
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 0
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 0
}

panic()
{
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 1
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 1
}

verbose()
{
if [ "${verbose}" = 1 ]; then
printf "${@}\n"
fi
if [ "${verbose}" = 1 ]; then
printf "${@}\n"
fi
}

version_exists()
{
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
return $?
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
return $?
}

set_initramfs()
{
initramfs="${BOOTDIR}/dracut.img-${version}"
initramfs="${BOOTDIR}/dracut.img-${version}"
}


# backup initramfs while running
backup_initramfs()
{
[ ! -r "${initramfs}" ] && return 0
initramfs_bak="${initramfs}.dpkg-bak"
[ -r "${initramfs_bak}" ] && rm -f "${initramfs_bak}"
ln -f "${initramfs}" "${initramfs_bak}" \
|| cp -a "${initramfs}" "${initramfs_bak}"
verbose "Keeping ${initramfs_bak}"
[ ! -r "${initramfs}" ] && return 0
initramfs_bak="${initramfs}.dpkg-bak"
[ -r "${initramfs_bak}" ] && rm -f "${initramfs_bak}"
ln -f "${initramfs}" "${initramfs_bak}" \
|| cp -a "${initramfs}" "${initramfs_bak}"
verbose "Keeping ${initramfs_bak}"
}

# keep booted initramfs
backup_booted_initramfs()
{
initramfs_bak="${initramfs}.dpkg-bak"
initramfs_bak="${initramfs}.dpkg-bak"

# first time run thus no backup
[ ! -r "${initramfs_bak}" ] && return 0
[ ! -r "${initramfs_bak}" ] && return 0

# chroot with no /proc
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0

# no kept backup wanted
[ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0
[ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0

# no backup yet
if [ ! -r "${initramfs}.bak" ]; then
mv -f ${initramfs_bak} "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
if [ ! -r "${initramfs}.bak" ]; then
mv -f ${initramfs_bak} "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi

# keep booted initramfs
uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime)
if [ -n "$uptime_days" ]; then
boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days})
fi
if [ -n "${boot_initramfs}" ]; then
mv -f "${initramfs_bak}" "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
verbose "Removing current backup ${initramfs_bak}"
rm -f ${initramfs_bak}
uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime)
if [ -n "$uptime_days" ]; then
boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days})
fi
if [ -n "${boot_initramfs}" ]; then
mv -f "${initramfs_bak}" "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
verbose "Removing current backup ${initramfs_bak}"
rm -f ${initramfs_bak}
}

# nuke generated copy
remove_initramfs()
{
[ -z "${initramfs_bak}" ] && return 0
rm -f "${initramfs_bak}"
verbose "Removing ${initramfs_bak}"
[ -z "${initramfs_bak}" ] && return 0
rm -f "${initramfs_bak}"
verbose "Removing ${initramfs_bak}"
}


generate_initramfs()
{
echo "dracut-update-initramfs: Generating ${initramfs}"
OPTS=""
if [ "${verbose}" = 1 ]; then
OPTS="-v ${OPTS}"
fi
echo "dracut-update-initramfs: Generating ${initramfs}"
OPTS=""
if [ "${verbose}" = 1 ]; then
OPTS="-v ${OPTS}"
fi
##WORK HERE!
if dracut ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
set_sha1
else
mkinitramfs_return="$?"
remove_initramfs
rm -f "${initramfs}.new"
if [ "$mkinitramfs_return" = "2" ]; then
if dracut ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
set_sha1
else
mkinitramfs_return="$?"
remove_initramfs
rm -f "${initramfs}.new"
if [ "$mkinitramfs_return" = "2" ]; then
# minversion wasn't met, exit 0
exit 0
fi
echo "update-initramfs: failed for ${initramfs}"
exit $mkinitramfs_return
fi
exit 0
fi
echo "update-initramfs: failed for ${initramfs}"
exit $mkinitramfs_return
fi
}

# lilo call
run_lilo()
{
# show lilo errors on failure
if ! lilo -t > /dev/null 2>&1 ; then
echo "ERROR lilo fails for new ${initramfs}:"
echo
lilo -t
fi
lilo
if ! lilo -t > /dev/null 2>&1 ; then
echo "ERROR lilo fails for new ${initramfs}:"
echo
lilo -t
fi
lilo
}

# check if lilo is on mbr
mbr_check()
{
# try to discover grub|grub2 and be happy
[ -r /boot/grub/grub.cfg ] \
&& groot=$(awk '/^set root=/{print substr($2, 7, 3); exit}' \
/boot/grub/grub.cfg)
[ -r /boot/grub/menu.lst ] \
&& groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \
/boot/grub/menu.lst)
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
[ -n "${dev}" ] && [ -r ${dev} ] \
&& dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \
| grep -q GRUB && return 0
[ -r /boot/grub/grub.cfg ] \
&& groot=$(awk '/^set root=/{print substr($2, 7, 3); exit}' \
/boot/grub/grub.cfg)
[ -r /boot/grub/menu.lst ] \
&& groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \
/boot/grub/menu.lst)
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
[ -n "${dev}" ] && [ -r ${dev} ] \
&& dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \
| grep -q GRUB && return 0

# check out lilo.conf for validity
boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf)
[ -z "${boot}" ] && return 0
case ${boot} in
/dev/md/*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/md/}
boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
/dev/md*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/}
boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
esac
[ ! -r "${boot}" ] && return 0
dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \
&& run_lilo && return 0
boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf)
[ -z "${boot}" ] && return 0
case ${boot} in
/dev/md/*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/md/}
boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
/dev/md*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/}
boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
esac
[ ! -r "${boot}" ] && return 0
dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \
&& run_lilo && return 0

# no idea which bootloader is used
echo
echo "WARNING: grub and lilo installed."
echo "If you use grub as bootloader everything is fine."
echo "If you use lilo as bootloader you must run lilo!"
echo
echo
echo "WARNING: grub and lilo installed."
echo "If you use grub as bootloader everything is fine."
echo "If you use lilo as bootloader you must run lilo!"
echo
}

# Invoke bootloader
run_bootloader()
{
# if both lilo and grub around, figure out if lilo needs to be run
if ( command -v update-grub >/dev/null 2>&1 \
|| [ -e /boot/grub/menu.lst ] || [ -e /boot/grub/grub.cfg ] ) \
&& ( [ -e /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1 ); then
[ -r "${KPKGCONF}" ] && \
do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}")
if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \
|| [ "${do_b}" = "YES" ]; then
run_lilo
return 0
elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \
|| [ "${do_b}" = "NO" ]; then
return 0
fi
if ( command -v update-grub >/dev/null 2>&1 \
|| [ -e /boot/grub/menu.lst ] || [ -e /boot/grub/grub.cfg ] ) \
&& ( [ -e /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1 ); then
[ -r "${KPKGCONF}" ] && \
do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}")
if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \
|| [ "${do_b}" = "YES" ]; then
run_lilo
return 0
elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \
|| [ "${do_b}" = "NO" ]; then
return 0
fi

# do_bootloader unconfigured
mbr_check
return 0
fi
if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then
run_lilo
return 0
fi
if command -v elilo >/dev/null 2>&1; then
elilo
return 0
fi
if [ -r /etc/zipl.conf ]; then
zipl
fi
if flash-kernel --supported >/dev/null 2>&1; then
flash-kernel ${version}
fi
mbr_check
return 0
fi
if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then
run_lilo
return 0
fi
if command -v elilo >/dev/null 2>&1; then
elilo
return 0
fi
if [ -r /etc/zipl.conf ]; then
zipl
fi
if flash-kernel --supported >/dev/null 2>&1; then
flash-kernel ${version}
fi
}

compare_sha1()
{
sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1
return $?
sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1
return $?
}

# Note that this must overwrite so that updates work.
set_sha1()
{
sha1sum "${initramfs}" > "${STATEDIR}/${version}"
sha1sum "${initramfs}" > "${STATEDIR}/${version}"
}

delete_sha1()
{
rm -f "${STATEDIR}/${version}"
rm -f "${STATEDIR}/${version}"
}

# ro /boot is not modified
ro_boot_check()
{
# check irrelevant inside of a chroot
if [ ! -r /proc/mounts ] || chrooted; then
return 0
fi
if [ ! -r /proc/mounts ] || chrooted; then
return 0
fi

boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \
&& $2 == "/boot") print "ro"}' /proc/mounts)
if [ -n "${boot_opts}" ]; then
echo "WARNING: /boot is ro mounted."
echo "update-initramfs: Not updating ${initramfs}"
exit 0
fi
boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \
&& $2 == "/boot") print "ro"}' /proc/mounts)
if [ -n "${boot_opts}" ]; then
echo "WARNING: /boot is ro mounted."
echo "update-initramfs: Not updating ${initramfs}"
exit 0
fi
}

get_sorted_versions()
{
version_list=""
version_list=""

for gsv_x in "${STATEDIR}"/*; do
gsv_x="$(basename "${gsv_x}")"
if [ "${gsv_x}" = '*' ]; then
return 0
fi
worklist=""
for gsv_i in $version_list; do
if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then
worklist="${worklist} ${gsv_x} ${gsv_i}"
gsv_x=""
else
worklist="${worklist} ${gsv_i}"
fi
done
if [ "${gsv_x}" != "" ]; then
worklist="${worklist} ${gsv_x}"
fi
version_list="${worklist}"
done
for gsv_x in "${STATEDIR}"/*; do
gsv_x="$(basename "${gsv_x}")"
if [ "${gsv_x}" = '*' ]; then
return 0
fi
worklist=""
for gsv_i in $version_list; do
if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then
worklist="${worklist} ${gsv_x} ${gsv_i}"
gsv_x=""
else
worklist="${worklist} ${gsv_i}"
fi
done
if [ "${gsv_x}" != "" ]; then
worklist="${worklist} ${gsv_x}"
fi
version_list="${worklist}"
done

verbose "Available versions: ${version_list}"
verbose "Available versions: ${version_list}"
}

set_current_version()
{
if [ -f /boot/dracut.img-`uname -r` ]; then
version=`uname -r`
fi
if [ -f /boot/dracut.img-`uname -r` ]; then
version=`uname -r`
fi
}

set_linked_version()
{
if [ -e /initrd.img ] && [ -L /initrd.img ]; then
linktarget="$(basename "$(readlink /initrd.img)")"
fi
if [ -e /initrd.img ] && [ -L /initrd.img ]; then
linktarget="$(basename "$(readlink /initrd.img)")"
fi

if [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then
linktarget="$(basename "$(readlink /boot/initrd.img)")"
fi
if [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then
linktarget="$(basename "$(readlink /boot/initrd.img)")"
fi

if [ -z "${linktarget}" ]; then
return
fi
if [ -z "${linktarget}" ]; then
return
fi

version="${linktarget##*img-}"
version="${linktarget##*img-}"
}

set_highest_version()
{
get_sorted_versions
set -- ${version_list}
version=${1}
get_sorted_versions
set -- ${version_list}
version=${1}
}

create()
{
if [ -z "${version}" ]; then
usage "Create mode requires a version argument"
fi
if [ -z "${version}" ]; then
usage "Create mode requires a version argument"
fi

set_initramfs
set_initramfs

if [ "${takeover}" = 0 ]; then
if version_exists "${version}"; then
panic "Cannot create version ${version}: already exists"
fi
if [ "${takeover}" = 0 ]; then
if version_exists "${version}"; then
panic "Cannot create version ${version}: already exists"
fi

if [ -e "${initramfs}" ]; then
panic "${initramfs} already exists, cannot create."
fi
fi
if [ -e "${initramfs}" ]; then
panic "${initramfs} already exists, cannot create."
fi
fi

generate_initramfs
generate_initramfs
}

update()
{
if [ "${update_initramfs}" = "no" ]; then
echo "update-initramfs: Not updating initramfs."
exit 0
fi
if [ "${update_initramfs}" = "no" ]; then
echo "update-initramfs: Not updating initramfs."
exit 0
fi

if [ -z "${version}" ]; then
set_highest_version
fi
if [ -z "${version}" ]; then
set_highest_version
fi

if [ -z "${version}" ]; then
set_linked_version
fi
if [ -z "${version}" ]; then
set_linked_version
fi

if [ -z "${version}" ]; then
set_current_version
fi
if [ -z "${version}" ]; then
set_current_version
fi

if [ -z "${version}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi
if [ -z "${version}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi

set_initramfs
set_initramfs

ro_boot_check
ro_boot_check

altered_check
altered_check

backup_initramfs
backup_initramfs

generate_initramfs
generate_initramfs

run_bootloader
run_bootloader

backup_booted_initramfs
backup_booted_initramfs
}

delete()
{
if [ -z "${version}" ]; then
usage "Delete mode requires a version argument"
fi
if [ -z "${version}" ]; then
usage "Delete mode requires a version argument"
fi

set_initramfs
set_initramfs

if [ ! -e "${initramfs}" ]; then
panic "Cannot delete ${initramfs}, doesn't exist."
fi
if [ ! -e "${initramfs}" ]; then
panic "Cannot delete ${initramfs}, doesn't exist."
fi

if ! version_exists "${version}"; then
panic "Cannot delete version ${version}: Not created by this utility."
fi
if ! version_exists "${version}"; then
panic "Cannot delete version ${version}: Not created by this utility."
fi

altered_check
altered_check

echo "update-initramfs: Deleting ${initramfs}"
echo "update-initramfs: Deleting ${initramfs}"

delete_sha1
delete_sha1

rm -f "${initramfs}"
rm -f "${initramfs}"
}

# Check for update mode on existing and modified initramfs
altered_check()
{
# No check on takeover
[ "${takeover}" = 1 ] && return 0
if [ ! -e "${initramfs}" ]; then
mild_panic "${initramfs} does not exist. Cannot update."
fi
if ! compare_sha1; then
echo "update-initramfs: ${initramfs} has been altered." >&2
mild_panic "update-initramfs: Cannot update. Override with -t option."
fi
[ "${takeover}" = 1 ] && return 0
if [ ! -e "${initramfs}" ]; then
mild_panic "${initramfs} does not exist. Cannot update."
fi
if ! compare_sha1; then
echo "update-initramfs: ${initramfs} has been altered." >&2
mild_panic "update-initramfs: Cannot update. Override with -t option."
fi
}

# Defaults
@ -468,91 +470,91 @@ takeover=0
##

while getopts "k:cudyvtb:h?" flag; do
case "${flag}" in
k)
version="${OPTARG}"
;;
c)
mode="c"
;;
d)
mode="d"
;;
u)
mode="u"
;;
v)
verbose="1"
;;
y)
yes="1"
;;
t)
takeover="1"
;;
b)
BOOTDIR="${OPTARG}"
if [ ! -d "${BOOTDIR}" ]; then
echo "Error: ${BOOTDIR} is not a directory."
exit 1
fi
;;
h|?)
usage
;;
esac
case "${flag}" in
k)
version="${OPTARG}"
;;
c)
mode="c"
;;
d)
mode="d"
;;
u)
mode="u"
;;
v)
verbose="1"
;;
y)
yes="1"
;;
t)
takeover="1"
;;
b)
BOOTDIR="${OPTARG}"
if [ ! -d "${BOOTDIR}" ]; then
echo "Error: ${BOOTDIR} is not a directory."
exit 1
fi
;;
h|?)
usage
;;
esac
done

shift $((${OPTIND} - 1))

if [ $# -ne 0 ]; then
echo "Invalid argument for option -k."
usage
echo "Invalid argument for option -k."
usage
fi

# Validate arguments
if [ -z "${mode}" ]; then
usage "You must specify at least one of -c, -u, or -d."
usage "You must specify at least one of -c, -u, or -d."
fi

if [ "${version}" = "all" ] \
|| ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then
: FIXME check for --yes, and if not ask are you sure
get_sorted_versions
if [ -z "${version_list}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi
|| ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then
: FIXME check for --yes, and if not ask are you sure
get_sorted_versions
if [ -z "${version_list}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi

OPTS="-b ${BOOTDIR}"
if [ "${verbose}" = "1" ]; then
OPTS="${OPTS} -v"
fi
if [ "${takeover}" = "1" ]; then
OPTS="${OPTS} -t"
fi
if [ "${yes}" = "1" ]; then
OPTS="${OPTS} -y"
fi
for u_version in ${version_list}; do
OPTS="-b ${BOOTDIR}"
if [ "${verbose}" = "1" ]; then
OPTS="${OPTS} -v"
fi
if [ "${takeover}" = "1" ]; then
OPTS="${OPTS} -t"
fi
if [ "${yes}" = "1" ]; then
OPTS="${OPTS} -y"
fi
for u_version in ${version_list}; do
# Don't stop if one version doesn't work.
set +e
verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
"${0}" -${mode} -k "${u_version}" ${OPTS}
set -e
done
exit 0
set +e
verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
"${0}" -${mode} -k "${u_version}" ${OPTS}
set -e
done
exit 0
fi


case "${mode}" in
c)
create
;;
d)
delete
;;
u)
update
;;
c)
create
;;
d)
delete
;;
u)
update
;;
esac

View File

@ -1,4 +1,23 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

[[ $# -eq 1 ]] || { echo "Usage: $(basename $0) <initramfs file>" ; exit 1 ; }
[[ -f $1 ]] || { echo "$1 does not exist" ; exit 1 ; }

View File

@ -98,5 +98,3 @@ if [[ $basicmodules ]]; then
else
dracut $dracut_args "$target" "$kernel"
fi

# vim:ts=8:sw=4:sts=4:et

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -x /sbin/bootchartd ] || exit 1

# do not enable bootchartd by default

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

inst /sbin/bootchartd
inst /bin/bash

View File

@ -1,2 +1,4 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -x /bin/dash ]

View File

@ -1,4 +1,7 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# If another shell is already installed, do not use dash
[[ -x $initdir/bin/sh ]] && return


View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

[[ $1 = -d ]] && exit 0
exit 255

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
do_fips()
{
FIPSMODULES=$(cat /etc/fipsmodules)
@ -6,21 +8,21 @@ do_fips()
KERNEL=$(uname -r)
udevadm trigger --action=add >/dev/null 2>&1
case "$boot" in
block:LABEL=*|LABEL=*)
boot="${boot#block:}"
boot="$(echo $boot | sed 's,/,\\x2f,g')"
boot="/dev/disk/by-label/${boot#LABEL=}"
bootok=1 ;;
block:UUID=*|UUID=*)
boot="${boot#block:}"
boot="/dev/disk/by-uuid/${root#UUID=}"
bootok=1 ;;
/dev/*)
bootok=1 ;;
block:LABEL=*|LABEL=*)
boot="${boot#block:}"
boot="$(echo $boot | sed 's,/,\\x2f,g')"
boot="/dev/disk/by-label/${boot#LABEL=}"
bootok=1 ;;
block:UUID=*|UUID=*)
boot="${boot#block:}"
boot="/dev/disk/by-uuid/${root#UUID=}"
bootok=1 ;;
/dev/*)
bootok=1 ;;
esac

[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)

if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$boot
else
@ -66,5 +68,3 @@ else
do_fips || die "FIPS integrity test failed"
set +e
fi

# vim:ts=8:sw=4:sts=4:et

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

inst_hook pre-trigger 01 "$moddir/fips.sh"
dracut_install sha512hmac rmmod insmod mount uname umount
@ -6,10 +8,8 @@ dracut_install sha512hmac rmmod insmod mount uname umount
for dir in "$usrlibdir" "$libdir"; do
[[ -e $dir/libsoftokn3.so ]] && \
dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \
$dir/libfreebl3.so $dir/libfreebl3.chk && \
break
$dir/libfreebl3.so $dir/libfreebl3.chk && \
break
done

dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac

# vim:ts=8:sw=4:sts=4:et

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

FIPSMODULES="aead aes_generic aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512"
@ -12,5 +14,3 @@ for mod in $FIPSMODULES; do
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done

# vim:ts=8:sw=4:sts=4:et

View File

@ -1,3 +1,5 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

exit 0

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

[ -e /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
[ -e /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
@ -58,7 +60,7 @@ dev_open() {
local dev=$1

exec 6<${dev} && \
exec 7>>${dev}
exec 7>>${dev}
}



View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
DEFAULT_SYSFONT=LatArCyrHeb-16
@ -10,7 +12,7 @@ KEYBOARD_CONF="${initdir}/etc/sysconfig/keyboard"
findkeymap () {
local MAP=$1
[[ ! -f $MAP ]] && \
MAP=$(find ${kbddir}/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1)
MAP=$(find ${kbddir}/keymaps -type f -name $MAP -o -name $MAP.\* | head -n1)
[[ " $KEYMAPS " = *" $MAP "* ]] && return
KEYMAPS="$KEYMAPS $MAP"
case $MAP in
@ -161,12 +163,12 @@ checks() {
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share
do
[[ -d "${kbddir}" ]] && \
for dir in ${KBDSUBDIRS//,/ }
do
[[ -d "${kbddir}/${dir}" ]] && continue
false
done && break
kbddir=''
for dir in ${KBDSUBDIRS//,/ }
do
[[ -d "${kbddir}/${dir}" ]] && continue
false
done && break
kbddir=''
done

[[ ${kbddir} ]] || {

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

inst_key_val() {
local value

View File

@ -1,3 +1,5 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -f /etc/redhat-release ]


View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [ -e "$moddir/dracut-version" ]; then
dracut_rpm_version=$(cat "$moddir/dracut-version")

View File

@ -1,3 +1,5 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
for i in dracut-*; do
if [ -f $i ]; then
vinfo < $i

View File

@ -1,22 +1,24 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [[ $1 = -d ]]; then
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
exit 0
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
exit 0
fi

. $dracutfunctions

for program in ip arping; do
if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" required by network."
exit 1
fi
if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" required by network."
exit 1
fi
done
for program in dhclient brctl; do
if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" it might be required by network."
fi
if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" it might be required by network."
fi
done

exit 255

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

setup_interface() {
ip=$new_ip_address
@ -20,12 +22,12 @@ setup_interface() {
# disallow MTUs from 576 and below by default, so that broken
# MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
if [ -n "$mtu" ] && [ $mtu -gt 576 ] ; then
echo "if ! ip link set $netif mtu $mtu ; then"
echo "ip link set $netif down"
echo "ip link set $netif mtu $mtu"
echo "ip link set $netif up"
echo wait_for_if_up $netif
echo "fi"
echo "if ! ip link set $netif mtu $mtu ; then"
echo "ip link set $netif down"
echo "ip link set $netif mtu $mtu"
echo "ip link set $netif up"
echo wait_for_if_up $netif
echo "fi"
fi > /tmp/net.$netif.up

echo ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif >> /tmp/net.$netif.up
@ -34,9 +36,9 @@ setup_interface() {

[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf

[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
@ -56,24 +58,24 @@ netif=$interface

case $reason in
PREINIT)
echo "dhcp: PREINIT $netif up"
ip link set $netif up
wait_for_if_up $netif
;;
echo "dhcp: PREINIT $netif up"
ip link set $netif up
wait_for_if_up $netif
;;
BOUND)
echo "dhcp: BOND setting $netif"
if ! arping -q -D -c 2 -I $netif $new_ip_address ; then
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
exit 1
fi
setup_interface
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
;;
echo "dhcp: BOND setting $netif"
if ! arping -q -D -c 2 -I $netif $new_ip_address ; then
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
exit 1
fi
setup_interface
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
;;
*) echo "dhcp: $reason";;
esac


View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# Don't continue if root is ok
[ -n "$rootok" ] && return
@ -14,7 +16,7 @@ if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; th
# Done, all good!
rootok=1
if [ "$netroot" != "dhcp" ] ; then
netroot=$root
netroot=$root
fi

# Shut up init error check

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# if there are no ifname parameters, just use NAME=KERNEL
if ! getarg ifname= >/dev/null ; then
@ -8,12 +10,12 @@ fi
{
for p in $(getargs ifname=); do
parse_ifname_opts $p
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
done

# Rename non named interfaces out of the way for named ones.
for p in $(getargs ifname=); do
parse_ifname_opts $p
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
done
} > /etc/udev/rules.d/50-ifname.rules

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# We don't need to check for ip= errors here, that is handled by the
# cmdline parser script
@ -14,16 +16,16 @@ do_dhcp() {
# XXX add -V vendor class and option parsing per kernel
echo "Starting dhcp for interface $netif"
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|| echo "dhcp failed"
|| echo "dhcp failed"
}

load_ipv6() {
modprobe ipv6
i=0
while [ ! -d /proc/sys/net/ipv6 ]; do
i=$(($i+1))
[ $i -gt 10 ] && break
sleep 0.1
i=$(($i+1))
[ $i -gt 10 ] && break
sleep 0.1
done
}

@ -33,17 +35,17 @@ do_ipv6auto() {
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
echo ip link set $netif up
echo wait_for_if_up $netif
echo ip link set $netif up
echo wait_for_if_up $netif
} > /tmp/net.$netif.up

[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname

namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf


@ -56,12 +58,12 @@ do_static() {
strstr $ip '*:*:*' && load_ipv6

{
echo ip link set $netif up
echo wait_for_if_up $netif
# do not flush addr for ipv6
strstr $ip '*:*:*' || \
echo ip addr flush dev $netif
echo ip addr add $ip/$mask dev $netif
echo ip link set $netif up
echo wait_for_if_up $netif
# do not flush addr for ipv6
strstr $ip '*:*:*' || \
echo ip addr flush dev $netif
echo ip addr add $ip/$mask dev $netif
} > /tmp/net.$netif.up

[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
@ -69,9 +71,9 @@ do_static() {

namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf

echo online > /sys/class/net/$netif/uevent
@ -130,9 +132,9 @@ ip=$(getarg ip)

if [ -z "$ip" ]; then
if [ "$netroot" = "dhcp6" ]; then
do_dhcp -6
do_dhcp -6
else
do_dhcp -4
do_dhcp -4
fi
fi

@ -140,24 +142,24 @@ fi
# looking for ip= lines
for p in $(getargs ip=); do
ip_to_var $p
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue

# Store config for later use
for i in ip srv gw mask hostname; do
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
done > /tmp/net.$netif.override

case $autoconf in
dhcp|on|any)
do_dhcp -4 ;;
dhcp6)
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
dhcp|on|any)
do_dhcp -4 ;;
dhcp6)
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
*)
do_static ;;
do_static ;;
esac
break
done

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
dracut_install ip dhclient brctl arping
inst "$moddir/ifup" "/sbin/ifup"
inst "$moddir/netroot" "/sbin/netroot"
@ -15,7 +17,7 @@ inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
arch=$(uname -m)

for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \
"$usrlibdir" "$libdir"; do
"$usrlibdir" "$libdir"; do
for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do
[ -e "$i" ] && dracut_install "$i"
done

View File

@ -1,16 +1,19 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# Include wired net drivers, excluding wireless

net_module_test() {
local net_drivers='eth_type_trans|register_virtio_device'
local unwanted_drivers='/(wireless|isdn|uwb)/'
egrep -q $net_drivers "$1" && \
egrep -qv 'iw_handler_get_spy' "$1" && \
[[ ! $1 =~ $unwanted_drivers ]]
egrep -qv 'iw_handler_get_spy' "$1" && \
[[ ! $1 =~ $unwanted_drivers ]]
}

instmods $(filter_kernel_modules net_module_test)

instmods ecb arc4
# bridge modules
instmods bridge stp llc

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

for f in /tmp/dhclient.*.pid; do
[ -e $f ] || continue

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# pxelinux provides macaddr '-' separated, but we need ':'
fix_bootif() {
@ -25,18 +27,18 @@ fix_bootif() {
# BOOTIF says everything, use only that one
BOOTIF=$(getarg 'BOOTIF=')
if [ -n "$BOOTIF" ] ; then
BOOTIF=$(fix_bootif "$BOOTIF")
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
BOOTIF=$(fix_bootif "$BOOTIF")
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"

# If we have to handle multiple interfaces, handle only them.
elif [ -n "$IFACES" ] ; then
for iface in $IFACES ; do
printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
done
for iface in $IFACES ; do
printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
done

# Default: We don't know the interface to use, handle all
else
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
fi

} > /etc/udev/rules.d/60-net.rules

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

PATH=$PATH:/sbin:/usr/sbin

@ -41,16 +43,16 @@ if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
# If we have a specific bootdev with no dhcpoptions or empty root-path,
# we die. Otherwise we just warn
if [ -z "$new_root_path" ] ; then
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
exit 1
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
exit 1
fi

# Set netroot to new_root_path, so cmdline parsers don't call
netroot=$new_root_path

for f in ./cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
[ -f "$f" ] && . "$f";
done
else
rootok="1"
@ -93,7 +95,7 @@ if [ -z "$dest" ] ; then
dummy=${netroot#*:}
dummy=${dummy%%:*}
case "$dummy" in
[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) dest=$dummy;;
[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) dest=$dummy;;
esac
fi
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
@ -108,8 +110,8 @@ source_all netroot
if $handler $netif $netroot $NEWROOT; then
# Network rootfs mount successful
for iface in $IFACES ; do
[ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
[ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
[ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
[ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
done

# Save used netif for later use
@ -119,9 +121,9 @@ else
# If we're trying with multiple interfaces, put that one down.
# ip down/flush ensures that routeing info goes away as well
if [ -z "$BOOTDEV" ] ; then
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
ip link set $netif down
ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf
fi
fi
exit 0

View File

@ -1,9 +1,11 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# bridge=<bridgename>:<ethname>
# bridge=<bridgename>:<ethname>
#
# bridge without parameters assumes bridge=br0:eth0
# bridge without parameters assumes bridge=br0:eth0
#

# return if bridge already parsed
@ -12,7 +14,7 @@
# Check if bridge parameter is valid
if getarg bridge= >/dev/null ; then
if [ -z "$netroot" ] ; then
die "No netboot configured, bridge is invalid"
die "No netboot configured, bridge is invalid"
fi
fi

@ -26,10 +28,10 @@ parsebridge() {

unset bridgename ethname
case $# in
0) bridgename=br0; ethname=eth0 ;;
1) die "bridge= requires two parameters" ;;
2) bridgename=$1; ethname=$2 ;;
*) die "bridge= requires two parameters" ;;
0) bridgename=br0; ethname=eth0 ;;
1) die "bridge= requires two parameters" ;;
2) bridgename=$1; ethname=$2 ;;
*) die "bridge= requires two parameters" ;;
esac
}


View File

@ -1,7 +1,9 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# ifname=<interface>:<mac>
# ifname=<interface>:<mac>
#
# Note letters in the macaddress must be lowercase!
#

View File

@ -1,11 +1,13 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Format:
# ip=[dhcp|on|any]
# ip=[dhcp|on|any]
#
# ip=<interface>:[dhcp|on|any]
# ip=<interface>:[dhcp|on|any]
#
# ip=<client-IP-number>:<server-id>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
# ip=<client-IP-number>:<server-id>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
#
# When supplying more than only ip= line, <interface> is mandatory and
# bootdev= must contain the name of the primary interface to use for
@ -17,8 +19,8 @@
# Check if ip= lines should be used
if getarg ip= >/dev/null ; then
if [ -z "$netroot" ] ; then
echo "Warning: No netboot configured, ignoring ip= lines"
return;
echo "Warning: No netboot configured, ignoring ip= lines"
return;
fi
fi

@ -38,7 +40,7 @@ fi
if [ -z "$NEEDBOOTDEV" ] ; then
local count=0
for p in $(getargs ip=); do
count=$(( $count + 1 ))
count=$(( $count + 1 ))
done
[ $count -gt 1 ] && NEEDBOOTDEV=1
fi
@ -59,39 +61,39 @@ for p in $(getargs ip=); do

# Empty autoconf defaults to 'dhcp'
if [ -z "$autoconf" ] ; then
warn "Empty autoconf values default to dhcp"
autoconf="dhcp"
warn "Empty autoconf values default to dhcp"
autoconf="dhcp"
fi

# Error checking for autoconf in combination with other values
case $autoconf in
error) die "Error parsing option 'ip=$p'";;
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
none|off) \
[ -z "$ip" ] && \
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
[ -z "$mask" ] && \
die "Sorry, automatic calculation of netmask is not yet supported"
;;
auto6);;
dhcp|dhcp6|on|any) \
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
[ -n "$ip" ] && \
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
;;
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
error) die "Error parsing option 'ip=$p'";;
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
none|off) \
[ -z "$ip" ] && \
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
[ -z "$mask" ] && \
die "Sorry, automatic calculation of netmask is not yet supported"
;;
auto6);;
dhcp|dhcp6|on|any) \
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
[ -n "$ip" ] && \
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
;;
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
esac

if [ -n "$dev" ] ; then
# We don't like duplicate device configs
if [ -n "$IFACES" ] ; then
for i in $IFACES ; do
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
done
fi
# IFACES list for later use
IFACES="$IFACES $dev"
if [ -n "$IFACES" ] ; then
for i in $IFACES ; do
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
done
fi
# IFACES list for later use
IFACES="$IFACES $dev"
fi

# Small optimization for udev rules
@ -99,15 +101,15 @@ for p in $(getargs ip=); do

# Do we need to check for specific options?
if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
# Correct device? (Empty is ok as well)
[ "$dev" = "$BOOTDEV" ] || continue
# Server-ip is there?
[ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
# dhcp? (It's simpler to check for a set ip. Checks above ensure that if
# ip is there, we're static
[ -z "$ip" ] && continue
# Not good!
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
# Correct device? (Empty is ok as well)
[ "$dev" = "$BOOTDEV" ] || continue
# Server-ip is there?
[ -n "$DHCPORSERVER" ] && [ -n "$srv" ] && continue
# dhcp? (It's simpler to check for a set ip. Checks above ensure that if
# ip is there, we're static
[ -z "$ip" ] && continue
# Not good!
die "Server-ip or dhcp for netboot needed, but current arguments say otherwise"
fi

done

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# ifcfg is required by network
#[[ $1 = -d ]] && echo network

View File

@ -1,2 +1,4 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# NFS root might have reached here before /tmp/net.ifaces was written
udevadm settle --timeout=30
@ -16,40 +18,40 @@ for netif in $IFACES ; do
fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
{
echo "# Generated by dracut initrd"
echo "DEVICE=$netif"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
if [ -f /tmp/net.$netif.lease ]; then
strstr "$ip" '*:*:*' &&
echo "DHCPV6C=yes"
echo "BOOTPROTO=dhcp"
else
echo "BOOTPROTO=none"
echo "# Generated by dracut initrd"
echo "DEVICE=$netif"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
if [ -f /tmp/net.$netif.lease ]; then
strstr "$ip" '*:*:*' &&
echo "DHCPV6C=yes"
echo "BOOTPROTO=dhcp"
else
echo "BOOTPROTO=none"
# If we've booted with static ip= lines, the override file is there
. /tmp/net.$netif.override
echo "IPADDR=$ip"
echo "NETMASK=$mask"
[ -n "$gw" ] && echo "GATEWAY=$gw"
fi
. /tmp/net.$netif.override
echo "IPADDR=$ip"
echo "NETMASK=$mask"
[ -n "$gw" ] && echo "GATEWAY=$gw"
fi
} > /tmp/ifcfg/ifcfg-$netif

# bridge needs different things written to ifcfg
if [ -z "$bridge" ]; then
# standard interface
{
{
echo "HWADDR=$(cat /sys/class/net/$netif/address)"
echo "TYPE=Ethernet"
echo "NAME=\"Boot Disk\""
} >> /tmp/ifcfg/ifcfg-$netif
} >> /tmp/ifcfg/ifcfg-$netif
else
# bridge
{
echo "TYPE=Bridge"
{
echo "TYPE=Bridge"
echo "NAME=\"Boot Disk\""
} >> /tmp/ifcfg/ifcfg-$netif
} >> /tmp/ifcfg/ifcfg-$netif
# write separate ifcfg file for the raw eth interface
{
{
echo "DEVICE=$ethname"
echo "TYPE=Ethernet"
echo "ONBOOT=yes"
@ -57,7 +59,7 @@ for netif in $IFACES ; do
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
echo "BRIDGE=$netif"
echo "NAME=$ethname"
} >> /tmp/ifcfg/ifcfg-$ethname
} >> /tmp/ifcfg/ifcfg-$ethname
fi
done


View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# TODO: splash_geninitramfs
# TODO: /usr/share/splashutils/initrd.splash

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

CDROOT=0
. /lib/gensplash-lib.sh

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

CDROOT=0
. /lib/gensplash-lib.sh

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if ! getarg rd_NO_SPLASH; then
[ -c /dev/null ] || mknod /dev/null c 1 3

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

call_splash_geninitramfs() {
local out ret

View File

@ -1,3 +1,5 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[[ $1 = -d ]] && type -P cryptsetup >/dev/null && echo crypt
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]

View File

@ -1,8 +1,10 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
|| ! grep -q PLYMOUTH_POPULATE_SOURCE_FUNCTIONS /usr/libexec/plymouth/plymouth-populate-initrd \
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
. "$moddir"/plymouth-populate-initrd
else
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# Include KMS capable drm drivers
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" -name '*.ko' 2>/dev/null); do
grep -q drm_crtc_init $modname && instmods $modname

View File

@ -1 +1,3 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash

View File

@ -1,5 +1,7 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [ -x /bin/plymouth ]; then
/bin/plymouth --newroot=$NEWROOT
/bin/plymouth --newroot=$NEWROOT
fi

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
PLYMOUTH_THEME=$(plymouth-set-default-theme)

@ -11,28 +13,28 @@ mkdir -p "${initdir}/usr/share/plymouth"

if [[ $hostonly ]]; then
dracut_install "${usrlibdir}/plymouth/text.so" \
"${usrlibdir}/plymouth/details.so" \
"/usr/share/plymouth/themes/details/details.plymouth" \
"/usr/share/plymouth/themes/text/text.plymouth" \
"${usrlibdir}/plymouth/details.so" \
"/usr/share/plymouth/themes/details/details.plymouth" \
"/usr/share/plymouth/themes/text/text.plymouth" \

if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
[[ -f "$x" ]] || break
inst $x
done
done
fi

if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
inst /usr/share/plymouth/themes/default.plymouth
inst /usr/share/plymouth/themes/default.plymouth
# Install plugin for this theme
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
inst "${usrlibdir}/plymouth/${PLYMOUTH_PLUGIN}.so"
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
inst "${usrlibdir}/plymouth/${PLYMOUTH_PLUGIN}.so"
fi
else
for x in /usr/share/plymouth/themes/{text,details}/* ; do
[[ -f "$x" ]] || continue
THEME_DIR=$(dirname "$x")
mkdir -p "${initdir}/$THEME_DIR"
THEME_DIR=$(dirname "$x")
mkdir -p "${initdir}/$THEME_DIR"
dracut_install "$x"
done
for x in "${usrlibdir}"/plymouth/{text,details}.so ; do
@ -41,9 +43,7 @@ else
dracut_install "$x"
done
(
cd ${initdir}/usr/share/plymouth/themes;
ln -s text/text.plymouth default.plymouth 2>&1;
cd ${initdir}/usr/share/plymouth/themes;
ln -s text/text.plymouth default.plymouth 2>&1;
)
fi

# vim:ts=8:sw=4:sts=4:et

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if ! getarg rd_NO_PLYMOUTH; then
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
@ -19,6 +21,3 @@ if ! getarg rd_NO_PLYMOUTH; then
/lib/udev/console_init tty0
/bin/plymouth --show-splash 2>&1 | vinfo
fi


# vim:ts=8:sw=4:sts=4:et

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# No Xen-detect? Boo!!
if ! hash xen-detect 2>/dev/null; then

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
hash xen-detect 2>/dev/null || \
hash -p /usr/lib/xen-default/bin/xen-detect xen-detect
inst "$(hash -t xen-detect)" /sbin/xen-detect

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

for i in \
xenbus_probe_frontend xen-pcifront \

View File

@ -1,10 +1,12 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
xen-detect
RC=$?
if [ "$RC" = "1" ] ; then
modprobe xenbus_probe_frontend
modprobe xen-kbdfront
modprobe xen-fbfront
modprobe xen-blkfront
modprobe xen-netfront
modprobe xen-pcifront
modprobe xenbus_probe_frontend
modprobe xen-kbdfront
modprobe xen-fbfront
modprobe xen-blkfront
modprobe xen-netfront
modprobe xen-pcifront
fi

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# We depend on udev-rules being loaded
[[ "$1" = "-d" ]] && exit 0
@ -15,7 +17,7 @@ is_btrfs() { get_fs_type /dev/block/$1 |grep -q btrfs; }
if [[ "$1" = "-h" ]]; then
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
is_btrfs "$rootdev" || exit 1
is_btrfs "$rootdev" || exit 1
fi
fi


View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

inst_rules "$moddir/40-btrfs.rules"
dracut_install btrfsctl

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# if cryptsetup is not installed, then we cannot support encrypted devices.
type -P cryptsetup >/dev/null || exit 1
@ -12,12 +14,12 @@ is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_crypt "$rootdev" || exit 1
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_crypt "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q crypto\?_LUKS || exit 1
# root is not on a block device, use the shotgun approach
blkid | grep -q crypto\?_LUKS || exit 1
fi
}


View File

@ -1,11 +1,13 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# close everything which is not busy
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1

while true; do
local do_break="y"
for i in /dev/mapper/luks-*; do
cryptsetup luksClose $i >/dev/null 2>&1 && do_break=n
done
[ "$do_break" = "y" ] && break
local do_break="y"
for i in /dev/mapper/luks-*; do
cryptsetup luksClose $i >/dev/null 2>&1 && do_break=n
done
[ "$do_break" = "y" ] && break
done

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# do not ask, if we already have root
[ -f /sysroot/proc ] && exit 0
@ -37,7 +39,7 @@ if [ -f /etc/crypttab ] && ! getarg rd_NO_CRYPTTAB; then
luksname="$name"
break
fi
# path used in crypttab
else
cdev=$(readlink -f $dev)
@ -88,12 +90,12 @@ unset keydev_uuid keypath
if [ -n "$keypaths" ]; then
keydev_uuids="$(getargs rd_LUKS_KEYDEV_UUID)"
[ -n "$keydev_uuids" ] || {
warn 'No UUID of device storing LUKS key specified.'
warn 'It is recommended to set rd_LUKS_KEYDEV_UUID.'
warn 'Performing scan of *all* devices accessible by UUID...'
warn 'No UUID of device storing LUKS key specified.'
warn 'It is recommended to set rd_LUKS_KEYDEV_UUID.'
warn 'Performing scan of *all* devices accessible by UUID...'
}
tmp=$(foreach_uuid_until "probe_keydev \$full_uuid $keypaths" \
$keydev_uuids) && {
$keydev_uuids) && {
keydev_uuid="${tmp%% *}"
keypath="${tmp#* }"
} || {
@ -129,20 +131,20 @@ else
prompt="Password for $device ($sluksname...)"
fi
# flock against other interactive activities
# flock against other interactive activities
{ flock -s 9;
/bin/plymouth ask-for-password \
--prompt "$prompt" \
--command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
--prompt "$prompt" \
--command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
} 9>/.console.lock
unset sluksname prompt
unset sluksname prompt
else
# flock against other interactive activities
{ flock -s 9;
echo "$device ($luksname) is password protected"
cryptsetup luksOpen -T5 $device $luksname
echo "$device ($luksname) is password protected"
cryptsetup luksOpen -T5 $device $luksname
} 9>/.console.lock
fi
fi
@ -155,4 +157,3 @@ unset device luksname
udevsettle

exit 0
# vim:ts=8:sw=4:sts=4:et

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
inst cryptsetup
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
inst_hook cmdline 30 "$moddir/parse-crypt.sh"

View File

@ -1,3 +1,5 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
instmods dm_crypt cbc sha256 xts aes aes_generic aesni-intel aes-x86_64 fpu


View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getarg rd_NO_LUKS; then
info "rd_NO_LUKS: removing cryptoluks activation"
rm -f /etc/udev/rules.d/70-luks.rules
@ -11,8 +13,8 @@ else
LUKS=$(getargs rd_LUKS_UUID)
unset settled
[ -n "$(getargs rd_LUKS_KEYPATH)" ] && \
[ -z "$(getargs rd_LUKS_KEYDEV_UUID)" ] && \
settled='--settled'
[ -z "$(getargs rd_LUKS_KEYDEV_UUID)" ] && \
settled='--settled'

if [ -n "$LUKS" ]; then
for luksid in $LUKS; do
@ -26,7 +28,7 @@ else
} >> /etc/udev/rules.d/70-luks.rules

printf '[ -e /dev/disk/by-uuid/*%s* ] || exit 1\n' $luksid \
>> /initqueue-finished/crypt.sh
>> /initqueue-finished/crypt.sh
{
printf '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
@ -34,9 +36,9 @@ else
done
else
echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue' $settled \
'--unique --onetime --name cryptroot-ask-%k' \
'/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"' \
>> /etc/udev/rules.d/70-luks.rules
'--unique --onetime --name cryptroot-ask-%k' \
'/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"' \
>> /etc/udev/rules.d/70-luks.rules
fi

echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

exit 255


View File

@ -1 +1,3 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

modinfo -k $kernel dm_mod >/dev/null 2>&1 && \
inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

instmods =drivers/md


View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# We depend on dm_mod being loaded
[ "$1" = "-d" ] && echo dm
@ -16,12 +18,12 @@ is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_dmraid "$rootdev" || exit 1
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_dmraid "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
dmraid -r | grep -q ok || exit 1
# root is not on a block device, use the shotgun approach
dmraid -r | grep -q ok || exit 1
fi
}


View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

. /lib/dracut-lib.sh

@ -20,19 +22,19 @@ echo $SETS|vinfo
if [ -n "$DM_RAIDS" ]; then
# only activate specified DM RAIDS
for r in $DM_RAIDS; do
for s in $SETS; do
if [ "${s##$r}" != "$s" ]; then
info "Activating $s"
for s in $SETS; do
if [ "${s##$r}" != "$s" ]; then
info "Activating $s"
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
udevsettle
fi
done
fi
done
done
else
# scan and activate all DM RAIDS
for s in $SETS; do
info "Activating $s"
info "Activating $s"
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
done

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
dracut_install dmraid partx kpartx

inst dmeventd

View File

@ -1,3 +1,5 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# nodmraid for anaconda / rc.sysinit compatibility
if getarg rd_NO_DM || getarg nodmraid; then
info "rd_NO_DM: removing DM RAID activation"

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# if dmsetup is not installed, then we cannot support fedora/red hat
# style live images

View File

@ -1,15 +1,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if [ "${root%%:*}" = "live" ]; then
{
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
${root#live:/dev/}
} >> /dev/.udev/rules.d/99-live-mount.rules
{
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
} >> /etc/udev/rules.d/99-live-squash.rules
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
fi

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

. /lib/dracut-lib.sh
[ -f /tmp/root.info ] && . /tmp/root.info
@ -32,8 +34,8 @@ getarg check || check=""
if [ -n "$check" ]; then
checkisomd5 --verbose $livedev || :
if [ $? -ne 0 ]; then
die "CD check failed!"
exit 1
die "CD check failed!"
exit 1
fi
fi

@ -79,7 +81,7 @@ do_live_overlay() {
if [ -f /overlayfs$pathspec -a -w /overlayfs$pathspec ]; then
losetup $OVERLAY_LOOPDEV /overlayfs$pathspec
if [ -n "$reset_overlay" ]; then
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
fi
setup="yes"
fi
@ -88,8 +90,8 @@ do_live_overlay() {

if [ -z "$setup" ]; then
if [ -n "$devspec" -a -n "$pathspec" ]; then
warn "Unable to find persistent overlay; using temporary"
sleep 5
warn "Unable to find persistent overlay; using temporary"
sleep 5
fi

dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
@ -124,7 +126,7 @@ fi

# we might have just an embedded ext3 to use as rootfs (uncompressed live)
if [ -e /dev/.initramfs/live/${live_dir}/ext3fs.img ]; then
EXT3FS="/dev/.initramfs/live/${live_dir}/ext3fs.img"
EXT3FS="/dev/.initramfs/live/${live_dir}/ext3fs.img"
fi

if [ -n "$EXT3FS" ] ; then
@ -136,7 +138,7 @@ fi

# we might have an embedded ext3 on squashfs to use as rootfs (compressed live)
if [ -e /dev/.initramfs/live/${live_dir}/squashfs.img ]; then
SQUASHED="/dev/.initramfs/live/${live_dir}/squashfs.img"
SQUASHED="/dev/.initramfs/live/${live_dir}/squashfs.img"
fi

if [ -e "$SQUASHED" ] ; then

View File

@ -1,7 +1,9 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if [ "${root%%:*}" = "liveiso" ]; then
{
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
${root#liveiso:}
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
${root#liveiso:}
} >> /etc/udev/rules.d/99-liveiso-mount.rules
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
fi

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
dracut_install umount
inst dmsetup
inst blkid

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# live images are specified with
# root=live:backingdev

@ -16,24 +18,24 @@ fi
[ "${liveroot%%:*}" = "live" ] || return

case "$liveroot" in
live:LABEL=*|LABEL=*)
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="live:/dev/disk/by-label/${root#LABEL=}"
live:LABEL=*|LABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="live:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
live:CDLABEL=*|CDLABEL=*)
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
live:CDLABEL=*|CDLABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
live:UUID=*|UUID=*)
root="${root#live:}"
root="live:/dev/disk/by-uuid/${root#UUID=}"
live:UUID=*|UUID=*) \
root="${root#live:}"
root="live:/dev/disk/by-uuid/${root#UUID=}"
rootok=1 ;;
live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
root="${root#live:}"
root="liveiso:${root}"
rootok=1 ;;
root="${root#live:}"
root="liveiso:${root}"
rootok=1 ;;
live:/dev/*)
rootok=1 ;;
esac

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
inst_hook cmdline 01 "$moddir/parse-kernel.sh"

View File

@ -1,9 +1,11 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if [[ -z $drivers ]]; then
block_module_test() {
local blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
local blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'

egrep -q "$blockfuncs" "$1"
egrep -q "$blockfuncs" "$1"
}
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc
hostonly='' instmods pcmcia firewire-ohci
@ -16,19 +18,19 @@ if [[ -z $drivers ]]; then
instmods $(filter_kernel_modules block_module_test)
# if not on hostonly mode, install all known filesystems if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then
if [[ -z $filesystems ]]; then
instmods '=fs'
# hardcoded list of exceptions
# to save a lot of space
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
else
instmods $filesystems
fi
if [[ -z $filesystems ]]; then
instmods '=fs'
# hardcoded list of exceptions
# to save a lot of space
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
else
instmods $filesystems
fi
else
hostonly='' instmods $(get_fs_type "/dev/block/$(find_root_block_device)")
hostonly='' instmods $(get_fs_type "/dev/block/$(find_root_block_device)")
fi
else
hostonly='' instmods $drivers $filesystems
hostonly='' instmods $drivers $filesystems
fi

[[ $add_drivers ]] && hostonly='' instmods $add_drivers

View File

@ -1,5 +1,7 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

for p in $(getargs rdloaddriver=); do
modprobe $p
modprobe $p
done

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# We depend on dm_mod being loaded
[ "$1" = "-d" ] && echo dm
@ -14,12 +16,12 @@ is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_lvm "$rootdev" || exit 1
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_lvm "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q LVM2_member || exit 1
# root is not on a block device, use the shotgun approach
blkid | grep -q LVM2_member || exit 1
fi
}


View File

@ -1,14 +1,16 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
inst lvm

inst_rules "$moddir/64-lvm.rules"

if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
if [ -f /etc/lvm/lvm.conf ]; then
inst /etc/lvm/lvm.conf
# FIXME: near-term hack to establish read-only locking;
# use command-line lvm.conf editor once it is available
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
inst /etc/lvm/lvm.conf
# FIXME: near-term hack to establish read-only locking;
# use command-line lvm.conf editor once it is available
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
fi
fi


View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# run lvm scan if udev has settled

@ -11,24 +13,24 @@ LVS=$(getargs rd_LVM_LV=)
# build a list of devices to scan
lvmdevs=$(
for f in /tmp/.lvm_scan-*; do
[ -e "$f" ] || continue
echo -n "${f##/tmp/.lvm_scan-} "
[ -e "$f" ] || continue
echo -n "${f##/tmp/.lvm_scan-} "
done
)

if [ ! -e /etc/lvm/lvm.conf ]; then
{
echo 'devices {';
echo -n ' filter = [ '
for dev in $lvmdevs; do
printf '"a|^/dev/%s$|", ' $dev;
done;
echo '"r/.*/" ]';
echo '}';
# establish read-only locking
echo 'global {';
echo ' locking_type = 4';
echo '}';
echo 'devices {';
echo -n ' filter = [ '
for dev in $lvmdevs; do
printf '"a|^/dev/%s$|", ' $dev;
done;
echo '"r/.*/" ]';
echo '}';
# establish read-only locking
echo 'global {';
echo ' locking_type = 4';
echo '}';
} > /etc/lvm/lvm.conf
lvmwritten=1
fi
@ -50,28 +52,28 @@ nopoll=$(
# hopefully this output format will never change, e.g.:
# LVM version: 2.02.53(1) (2009-09-25)
lvm version 2>/dev/null | \
(
IFS=. read maj min sub;
maj=${maj##*:};
sub=${sub%% *}; sub=${sub%%\(*};
check_lvm_ver $maj $min $sub && \
echo " --poll n ") 2>/dev/null )
(
IFS=. read maj min sub;
maj=${maj##*:};
sub=${sub%% *}; sub=${sub%%\(*};
check_lvm_ver $maj $min $sub && \
echo " --poll n ") 2>/dev/null )

if [ -n "$LVS" ] ; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
lvm lvchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
fi
if [ -n "$LVS" ] ; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
lvm lvchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
fi

if [ -z "$LVS" -o -n "$VGS" ]; then
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
lvm vgscan --ignorelockingfailure 2>&1 | vinfo
lvm vgchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $VGS 2>&1 | vinfo
fi
if [ -z "$LVS" -o -n "$VGS" ]; then
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
lvm vgscan --ignorelockingfailure 2>&1 | vinfo
lvm vgchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $VGS 2>&1 | vinfo
fi

if [ "$lvmwritten" ]; then
rm -f /etc/lvm/lvm.conf
ln -s /sbin/lvm-cleanup /pre-pivot/30-lvm-cleanup.sh 2>/dev/null
ln -s /sbin/lvm-cleanup /pre-pivot/31-lvm-cleanup.sh 2>/dev/null
fi
unset lvmwritten
if [ "$lvmwritten" ]; then
rm -f /etc/lvm/lvm.conf
ln -s /sbin/lvm-cleanup /pre-pivot/30-lvm-cleanup.sh 2>/dev/null
ln -s /sbin/lvm-cleanup /pre-pivot/31-lvm-cleanup.sh 2>/dev/null
fi
unset lvmwritten

View File

@ -1,3 +1,5 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if [ -e /etc/lvm/lvm.conf ] && getarg rd_NO_LVMCONF; then
rm -f /etc/lvm/lvm.conf
fi

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# No mdadm? No mdraid support.
type -P mdadm >/dev/null || exit 1
@ -11,12 +13,12 @@ is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_mdraid "$rootdev" || exit 1
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_mdraid "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
blkid | egrep -q '(linux|isw)_raid' || exit 1
# root is not on a block device, use the shotgun approach
blkid | egrep -q '(linux|isw)_raid' || exit 1
fi
}


View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

dracut_install mdadm partx


View File

@ -1,3 +1,5 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
instmods =drivers/md


View File

@ -1,2 +1,4 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
info "rd_NO_MDIMSM: no MD RAID for imsm/isw raids"
udevproperty rd_NO_MDIMSM=1

View File

@ -1,3 +1,5 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
for f in /initqueue-settled/mdcontainer_start* /initqueue-settled/mdraid_start* /initqueue-settled/mdadm_auto*; do
[ -e $f ] && return 1
done

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-lib.sh

info "Autoassembling MD Raid"

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-lib.sh

md=$1

View File

@ -1,3 +1,5 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# save state dir for mdmon/mdadm for the real root
mkdir /dev/.mdadm
[ -e /var/run/mdadm ] && rm -fr /var/run/mdadm

View File

@ -1,16 +1,19 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# stop everything which is not busy
for i in /dev/md* /dev/md/*; do
[ -b $i ] || continue

mddetail=$(udevadm info --query=property --name=$i)
case "$mddetail" in
*MD_LEVEL=container*)
;;
*DEVTYPE=partition*)
;;
*)
mdadm --stop $i >/dev/null 2>&1
;;
*MD_LEVEL=container*)
;;
*DEVTYPE=partition*)
;;
*)
mdadm --stop $i >/dev/null 2>&1
;;
esac
done

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

. /lib/dracut-lib.sh
# run mdadm if udev has settled
@ -10,12 +12,12 @@ mdadm -Is --run 2>&1 | vinfo
# there could still be some leftover devices
# which have had a container added
for md in /dev/md[0-9]* /dev/md/*; do
[ -b "$md" ] || continue
udevinfo="$(udevadm info --query=env --name=$md)"
strstr "$udevinfo" "MD_UUID=" && continue
strstr "$udevinfo" "MD_LEVEL=container" && continue
strstr "$udevinfo" "DEVTYPE=partition" && continue
mdadm --run "$md" 2>&1 | vinfo
[ -b "$md" ] || continue
udevinfo="$(udevadm info --query=env --name=$md)"
strstr "$udevinfo" "MD_UUID=" && continue
strstr "$udevinfo" "MD_LEVEL=container" && continue
strstr "$udevinfo" "DEVTYPE=partition" && continue
mdadm --run "$md" 2>&1 | vinfo
done
unset udevinfo


View File

@ -1,3 +1,5 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getarg rd_NO_MD; then
info "rd_NO_MD: removing MD RAID activation"
udevproperty rd_NO_MD=1
@ -6,21 +8,21 @@ else

# rewrite the md rules to only process the specified raid array
if [ -n "$MD_UUID" ]; then
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
[ -e "$f" ] || continue
mv $f ${f}.bak
while read line; do
if [ "${line%%UUID CHECK}" != "$line" ]; then
for uuid in $MD_UUID; do
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
done;
printf 'GOTO="md_inc_end"\n';
else
echo $line;
fi
done < ${f}.bak > $f
rm ${f}.bak
done
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
[ -e "$f" ] || continue
mv $f ${f}.bak
while read line; do
if [ "${line%%UUID CHECK}" != "$line" ]; then
for uuid in $MD_UUID; do
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
done;
printf 'GOTO="md_inc_end"\n';
else
echo $line;
fi
done < ${f}.bak > $f
rm ${f}.bak
done
fi
fi

@ -31,7 +33,7 @@ if [ -e /etc/mdadm.conf ] && ! getarg rd_NO_MDADMCONF; then
fi

if getarg rd_NO_MDADMCONF; then
rm -f /etc/mdadm/mdadm.conf /etc/mdadm.conf
rm -f /etc/mdadm/mdadm.conf /etc/mdadm.conf
fi

# noiswmd nodmraid for anaconda / rc.sysinit compatibility

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# if there's no multipath binary, no go.
type -P multipath >/dev/null || exit 1

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

for f in \
/sbin/dmsetup \

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

mp_mod_test() {
local mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [ -e /etc/multipath.conf ]; then
HARD=""

View File

@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

if [ -e /etc/multipath.conf -a -e /etc/multipath/wwids ]; then
modprobe dm-multipath

View File

@ -1,4 +1,6 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
arch=$(uname -m)
[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1


Some files were not shown because too many files have changed in this diff Show More