Compare commits

...

38 Commits
016 ... 017

Author SHA1 Message Date
Harald Hoyer
f5a9e45923 Version 017 2012-02-24 15:38:08 +01:00
Harald Hoyer
1701d7adc8 30convertfs/convertfs.sh: add check for /usr/bin
Check if /usr is mounted, by checking for /usr/bin
2012-02-24 14:59:18 +01:00
Harald Hoyer
d18bc9070d dracut-functions.sh: optimize ldd 2012-02-24 14:59:18 +01:00
Harald Hoyer
86bf239ede dracut-functions.sh: only call ldd in find_binary() for "*.so*" 2012-02-24 14:59:18 +01:00
Harald Hoyer
d433da4473 dracut.sh: first install /usr dirs, then toplevel
This saves some checks in inst_dir.
2012-02-24 14:58:21 +01:00
Harald Hoyer
3249c257a0 dracut-functions.sh: optimized
get rid off lots of duplicated checks and code
2012-02-24 14:56:40 +01:00
Harald Hoyer
a6b63f9192 dracut.spec,Makefile: backward compat symlink for dracut-functions.sh 2012-02-23 12:26:16 +01:00
Harald Hoyer
b019d405d9 dracut.spec: changes for RHEL-6 2012-02-22 19:53:07 +01:00
Harald Hoyer
004fd0557d host-only checks corrected and kernel_only mode
In kernel_only mode, we don't want to write /etc/cmdline.d

Correctly return the check functions, so we have a valid return of
for_each_host_dev_fs().

mdraid and dmraid functions had wrong checkings for the filesystem
type.
2012-02-22 19:29:57 +01:00
Harald Hoyer
2efa546f26 dracut-functions.sh:for_each_host_dev_fs() return a value
for_each_host_dev_fs() now returns 0 if one func returned with 0
2012-02-22 19:06:00 +01:00
Colin Guthrie
0330b91987 lvm: Only activate a given vg+lv once.
Due to the way the main loop runs to detect partions, the same one
might be included twice (albeit via different symlinks.

This code simply prevents the same combo being activated twice.

A better fix might simply be to not include duplicate (after
resolving symlinks) entries in the host_fs_types variable.
2012-02-22 18:30:58 +01:00
Colin Guthrie
e0a38de881 mount-usr: Calculate and pass full fsck options when mounting /usr.
Edited-By: Harald Hoyer <harald@redhat.com>
2012-02-22 18:11:27 +01:00
Colin Guthrie
d06580986b fs-lib: No need to pass in _dev and _fop as they are inherited, not used as arguments. 2012-02-22 18:04:43 +01:00
Harald Hoyer
03a44f0bf0 git2spec.pl: detect renames 2012-02-22 16:14:38 +01:00
Harald Hoyer
8b6e099892 90kernel-modules/module-setup.sh: exclude nfs* lockd from standard
do not install nfs* lockd filesystems for the standard kernel modules
2012-02-22 16:14:38 +01:00
Harald Hoyer
34248c926c change omit_drivers to support regexp expressions 2012-02-22 16:14:38 +01:00
Harald Hoyer
14c47b0ee4 dracut.sh: do not install some files in installkernel
/etc/cmdline.d
/etc/fstab
2012-02-22 16:14:23 +01:00
Harald Hoyer
edd3262efd 40network/parse-ip-opts.sh: "local" can only be used in functions 2012-02-22 16:13:20 +01:00
Harald Hoyer
9cb8447c90 dracut-functions.sh:inst_library(): readlink source dir first
read link of the source dir, before convert_abs_to_rel()
2012-02-22 16:13:20 +01:00
Harald Hoyer
cc227886c6 dracut-functions.sh:inst_simple(): no inst_dir if dir exists 2012-02-22 16:13:20 +01:00
Harald Hoyer
6d2a7942aa dracut-functions.sh: set IFS only for variable setting 2012-02-22 16:13:20 +01:00
Harald Hoyer
43dfbeec7b dracut-functions.sh: turn off regexp for strstr() 2012-02-22 16:13:20 +01:00
Harald Hoyer
3335ed0ef4 dracut.sh: skip symlink dirs for prelink unlink 2012-02-22 16:13:20 +01:00
Harald Hoyer
b6e244f794 90kernel-modules/module-setup.sh: install modules.* in installkernel()
modules.* should be in the kernel initramfs
2012-02-22 15:15:22 +01:00
Harald Hoyer
14669e3a86 95nfs/module-setup.sh: whitespace fixup 2012-02-22 15:15:22 +01:00
Harald Hoyer
552ecca6db Renamed all shell scripts to *.sh 2012-02-22 15:15:21 +01:00
Harald Hoyer
9373aec650 TEST-30-ISCSI/test.sh: factor out client runs 2012-02-22 11:32:59 +01:00
Harald Hoyer
30befb85e3 .gitignore: add eclipse directories 2012-02-22 11:32:40 +01:00
Will Woods
ed293f6d0c url-lib: fix fetch_url return value for dotfiles
If you do "fetch_url $url/.somefile", fetch_url would return failure,
because "$outdir/*" wouldn't match the file.

Use ls -A (which busybox ls supports) to actually find possible dotfiles
in the created output dir.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-21 10:11:11 +01:00
Harald Hoyer
cd9592385d 98usrmount/mount-usr.sh: honor fs_passno in /etc/fstab
If the sixth field in /etc/fstab is "0" or not present for /usr, do not
run fsck.

This prevents fsck for nfs /usr also.
2012-02-20 17:28:58 +01:00
Harald Hoyer
7e2bca4820 dracut-functions: documentation and restructuring 2012-02-16 11:49:19 +01:00
Harald Hoyer
c4e48eaea1 dracut-functions: factor out all get_maj_min() variants 2012-02-16 11:48:17 +01:00
Harald Hoyer
3905f6695e TEST-30-ISCSI: add test case for "root=iscsi:...." and untabify 2012-02-16 11:37:21 +01:00
Harald Hoyer
2a3faa2df9 95iscsi: fix "root=iscsi:...." case
install udev rules and wait for /dev/root
2012-02-16 11:34:37 +01:00
Dave Young
86de902e35 ssh-client module install fix
commit 38164332e1 try to
disallow ssh-client install for without proper options.
But ssh-client will fail installation with --sshkey for
publickey mode

Fix it by refusing to install only when both --ctty and --sshkey
are not added in options.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-16 11:21:34 +01:00
Will Woods
c1df00d2c6 livenet: avoid spurious error message / wait_for_dev
If the user didn't request a livenet boot, don't print an error
and don't do wait_for_dev.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-16 11:21:34 +01:00
Dave Young
75cade1216 add function wait_for_route_ok
Manually setuping nic through udev is not always done when
we want network access. Here add a function wait_for_route_ok to
wait and make sure the network is accesible

[v1 -> v2]:
Harald: don't use bash syntax
Add check for [ -n "$li" ] because `ip route show` will show nothing probably

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-16 11:19:07 +01:00
Harald Hoyer
a2c631c0a3 Makefile: also link dracut-shutdown.service to shutdown target 2012-02-16 09:37:11 +01:00
90 changed files with 632 additions and 489 deletions

2
.gitignore vendored
View File

@@ -8,3 +8,5 @@
/modules.d/99base/switch_root
/test/*/test.log
test*.img
/.buildpath
/.project

View File

@@ -1,4 +1,4 @@
VERSION=016
VERSION=017
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
prefix ?= /usr
@@ -31,15 +31,16 @@ install: doc
mkdir -p $(DESTDIR)$(sysconfdir)
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
mkdir -p $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
install -m 0755 dracut $(DESTDIR)$(bindir)/dracut
install -m 0755 dracut-gencmdline $(DESTDIR)$(bindir)/dracut-gencmdline
install -m 0755 dracut-catimages $(DESTDIR)$(bindir)/dracut-catimages
install -m 0755 dracut.sh $(DESTDIR)$(bindir)/dracut
install -m 0755 dracut-gencmdline.sh $(DESTDIR)$(bindir)/dracut-gencmdline
install -m 0755 dracut-catimages.sh $(DESTDIR)$(bindir)/dracut-catimages
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
install -m 0755 lsinitrd $(DESTDIR)$(bindir)/lsinitrd
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
ln -s dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
cp -arx modules.d $(DESTDIR)$(pkglibdir)
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
@@ -52,7 +53,9 @@ install: doc
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
ln -s ../dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-shutdown.service; \
ln -s ../dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
fi
clean:
@@ -84,13 +87,13 @@ rpm: dracut-$(VERSION).tar.bz2
( mv "$$rpmbuild"/noarch/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh dracut-logger \
modules.d/99base/init modules.d/*/*.sh; do \
@ret=0;for i in dracut-initramfs-restore.sh dracut-logger.sh \
modules.d/99base/init.sh modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
[ "$${i##*/}" = "caps.sh" ] && continue; \
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
@ret=0;for i in mkinitrd-dracut.sh dracut modules.d/02caps/caps.sh \
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/02caps/caps.sh \
modules.d/*/module-setup.sh; do \
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
@@ -99,17 +102,17 @@ check: all syncheck
$(MAKE) -C test check
testimage: all
./dracut -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
testimages: all
./dracut -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
@echo wrote test-dracut.img
hostimage: all
./dracut -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
./dracut.sh -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
AUTHORS:

13
NEWS
View File

@@ -1,3 +1,16 @@
dracut-017
==========
- a _lot_ faster than dracut-016 in image creation
- systemd service dracut-shutdown.service
- livenet fixes
- ssh-client module install fix
- root=iscsi:... fixed
- lots of restructuring and optimizing in dracut-functions.sh
- usrmount: honor fs_passno in /etc/fstab
- renamed all shell scripts to .sh
- new option "--omit-drivers" and config option "omit_drivers"
- hostonly mode fixups
dracut-016
==========
- fixed lsinitrd

View File

@@ -28,12 +28,19 @@ if ! [[ $dracutbasedir ]]; then
fi
if ! type dinfo >/dev/null 2>&1; then
. "$dracutbasedir/dracut-logger"
. "$dracutbasedir/dracut-logger.sh"
dlog_init
fi
# export standard hookdirs
[[ $hookdirs ]] || {
hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown cleanup"
export hookdirs
}
# Generic substring function. If $2 is in $1, return 0.
strstr() { [[ $1 =~ $2 ]]; }
strstr() { [ "${1#*$2*}" != "$1" ]; }
# Create all subdirectories for given path without creating the last element.
# $1 = path
@@ -66,6 +73,8 @@ vercmp() {
esac
}
# is_func <command>
# Check whether $1 is a function.
is_func() {
[[ $(type -t $1) = "function" ]]
}
@@ -82,6 +91,12 @@ print_vars() {
done
}
# normalize_path <path>
# Prints the normalized path, where it removes any duplicated
# and trailing slashes.
# Example:
# $ normalize_path ///test/test//
# /test/test
normalize_path() {
shopt -q -s extglob
set -- "${1//+(\/)//}"
@@ -89,10 +104,15 @@ normalize_path() {
echo "${1%/}"
}
# convert_abs_rel <from> <to>
# Prints the relative path, when creating a symlink to <to> from <from>.
# Example:
# $ convert_abs_rel /usr/bin/test /bin/test-2
# ../../bin/test-2
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
convert_abs_rel() {
local __current __absolute __abssize __cursize __newpath __oldifs
local __current __absolute __abssize __cursize __newpath
local -i __i __level
# PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
@@ -102,11 +122,8 @@ convert_abs_rel() {
# corner case #2 - own dir link
[[ "${1%/*}" == "$2" ]] && { echo "."; return; }
__oldifs="$IFS"
IFS="/"
__current=($1)
__absolute=($2)
IFS="$__oldifs"
IFS="/" __current=($1)
IFS="/" __absolute=($2)
__abssize=${#__absolute[@]}
__cursize=${#__current[@]}
@@ -141,6 +158,12 @@ convert_abs_rel() {
echo "$__newpath"
}
# get_fs_env <device>
# Get and set the ID_FS_TYPE and ID_FS_UUID variable from udev for a device.
# Example:
# $ get_fs_env /dev/sda2; echo $ID_FS_TYPE; echo $ID_FS_UUID
# ext4
# 551a39aa-4ae9-4e70-a262-ef665cadb574
get_fs_env() {
[[ $1 ]] || return
unset ID_FS_TYPE
@@ -157,6 +180,21 @@ get_fs_env() {
fi
}
# get_fs_uuid <device>
# Prints the filesystem UUID for a device.
# Example:
# $ get_fs_uuid /dev/sda2
# 551a39aa-4ae9-4e70-a262-ef665cadb574
get_fs_uuid() (
get_fs_env $1 || return
echo $ID_FS_UUID
)
# get_fs_type <device>
# Prints the filesystem type for a device.
# Example:
# $ get_fs_type /dev/sda1
# ext4
get_fs_type() (
[[ $1 ]] || return
if [[ $1 != ${1#/dev/block/nfs:} ]] \
@@ -172,12 +210,11 @@ get_fs_type() (
find_dev_fstype $1
)
get_fs_uuid() (
get_fs_env $1 || return
echo $ID_FS_UUID
)
# get_maj_min <device>
# Prints the major and minor of a device node.
# Example:
# $ get_maj_min /dev/sda2
# 8:2
get_maj_min() {
local _dev
_dev=$(stat -L -c '$((0x%t)):$((0x%T))' "$1" 2>/dev/null)
@@ -185,6 +222,16 @@ get_maj_min() {
echo $_dev
}
# find_block_device <mountpoint>
# Prints the major and minor number of the block device
# for a given mountpoint.
# Unless $use_fstab is set to "yes" the functions
# uses /proc/self/mountinfo as the primary source of the
# information and only falls back to /etc/fstab, if the mountpoint
# is not found there.
# Example:
# $ find_block_device /usr
# 8:4
find_block_device() {
local _x _mpt _majmin _dev _fs _maj _min
if [[ $use_fstab != yes ]]; then
@@ -212,17 +259,21 @@ find_block_device() {
[[ $_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
get_maj_min "$_dev" && return 0
fi
done < /etc/fstab
return 1
}
# find_dev_fstype <device>
# Echo the filesystem type for a given device.
# /proc/self/mountinfo is taken as the primary source of information
# and /etc/fstab is used as a fallback.
# No newline is appended!
# Example:
# $ find_dev_fstype /dev/sda2;echo
# ext4
find_dev_fstype() {
local _x _mpt _majmin _dev _fs _maj _min
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
@@ -244,11 +295,15 @@ find_dev_fstype() {
# finds the major:minor of the block device backing the root filesystem.
find_root_block_device() { find_block_device /; }
# for_each_host_dev_fs <func>
# Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
# in ${host_fs_types[@]}
for_each_host_dev_fs()
{
local _func="$1"
local _dev
local _fs
local _ret=1
for f in ${host_fs_types[@]}; do
OLDIFS="$IFS"
IFS="|"
@@ -257,8 +312,9 @@ for_each_host_dev_fs()
_dev="$1"
[[ -b "$_dev" ]] || continue
_fs="$2"
$_func $_dev $_fs
$_func $_dev $_fs && _ret=0
done
return $_ret
}
# Walk all the slave relationships for a given block device.
@@ -281,11 +337,6 @@ check_block_and_slaves() {
return 1
}
get_numeric_dev() {
local _x _maj _min
ls -lH "$1" | { read _x _x _x _x _maj _min _x; printf "%d:%d" ${_maj%%,} $_min; }
}
# ugly workaround for the lvm design
# There is no volume group device,
# so, there are no slave devices for volume groups.
@@ -295,7 +346,7 @@ get_numeric_dev() {
check_vol_slaves() {
local _lv _vg _pv
for i in /dev/mapper/*; do
_lv=$(get_numeric_dev $i)
_lv=$(get_maj_min $i)
if [[ $_lv = $2 ]]; then
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
@@ -303,7 +354,7 @@ check_vol_slaves() {
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
check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
done
fi
fi
@@ -326,21 +377,14 @@ inst_dir() {
# iterate over parent directories
for _file in $_dir; do
[[ -e "${initdir}/$_file" ]] && continue
if [[ -L $_file ]]; then
# create link as the original
local target=$(readlink -f "$_file")
# resolve relative path and recursively install destination
[[ $target == ${target#/} ]] && target="$(dirname "$_file")/$target"
inst_dir "$target"
inst_symlink "$_file"
else
[[ -h ${initdir}/$_file ]] && _file=$(readlink "${initdir}/$_file")
# create directory
[[ -e "${initdir}/$_file" ]] || mkdir -m 0755 -p "${initdir}/$_file" || return 1
if [[ -d "$_file" ]]; then
chmod --reference="$_file" "${initdir}/$_file"
chmod u+w "${initdir}/$_file"
fi
mkdir -m 0755 -p "${initdir}/$_file" || return 1
[[ -e "$_file" ]] && chmod --reference="$_file" "${initdir}/$_file"
chmod u+w "${initdir}/$_file"
fi
done
}
@@ -356,8 +400,8 @@ inst_simple() {
local _src=$1 target="${2:-$1}"
if ! [[ -d ${initdir}/$target ]]; then
[[ -e ${initdir}/$target ]] && return 0
[[ -h ${initdir}/$target ]] && return 0
inst_dir "${target%/*}"
[[ -L ${initdir}/$target ]] && return 0
[[ -d "${initdir}/${target%/*}" ]] || inst_dir "${target%/*}"
fi
# install checksum files also
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
@@ -407,6 +451,7 @@ inst_library() {
_reallib=$(readlink -f "$_src")
inst_simple "$_reallib" "$_reallib"
inst_dir "${_dest%/*}"
[[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
ln -sfn $(convert_abs_rel "${_dest}" "${_reallib}") "${initdir}/${_dest}"
else
inst_simple "$_src" "$_dest"
@@ -425,7 +470,7 @@ inst_library() {
# search in the usual places to find the binary.
find_binary() {
if [[ -z ${1##/*} ]]; then
if [[ -x $1 ]] || ldd $1 &>/dev/null; then
if [[ -x $1 ]] || { strstr "$1" ".so" && ldd $1 &>/dev/null; }; then
echo $1
return 0
fi
@@ -437,47 +482,33 @@ find_binary() {
# Same as above, but specialized to install binary executables.
# Install binary executable, and all shared library dependencies, if any.
inst_binary() {
local _bin _target _f _self _so_regex _lib_regex _tlibdir _base _file _line
local _bin _target
_bin=$(find_binary "$1") || return 1
_target=${2:-$_bin}
[[ -e $initdir/$_target ]] && return 0
inst_symlink $_bin $_target && return 0
# If the binary being installed is also a library, add it to the loop.
_so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
[[ $_bin =~ $_so_regex ]] && _self="\t${_bin##*/} => ${_bin} (0x0)\n"
_lib_regex='^(/lib[^/]*).*'
[[ -L $_bin ]] && inst_symlink $_bin $_target && return 0
local _file _line
local _so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
# I love bash!
{ LC_ALL=C ldd $_bin 2>/dev/null; echo -en "$_self"; } | while read _line; do
[[ $_line = 'not a dynamic executable' ]] && return 1
LC_ALL=C ldd "$_bin" 2>/dev/null | while read _line; do
[[ $_line = 'not a dynamic executable' ]] && break
if [[ $_line =~ $_so_regex ]]; then
_file=${BASH_REMATCH[1]}
[[ -e ${initdir}/$_file ]] && continue
inst_library "$_file"
continue
fi
if [[ $_line =~ not\ found ]]; then
dfatal "Missing a shared library required by $_bin."
dfatal "Run \"ldd $_bin\" to find out what it is."
dfatal "$_line"
dfatal "dracut cannot create an initrd."
exit 1
fi
[[ $_line =~ $_so_regex ]] || continue
_file=${BASH_REMATCH[1]}
[[ -e ${initdir}/$_file ]] && continue
# See if we are loading an optimized version of a shared lib.
if [[ $_file =~ $_lib_regex ]]; then
_tlibdir=${BASH_REMATCH[1]}
_base=${_file##*/}
# Prefer nosegneg libs to unoptimized ones.
for _f in "$_tlibdir/i686/nosegneg"; do
[[ -e $_f/$_base ]] || continue
inst_library $_f/$_base
break
done
fi
inst_library "$_file"
done
# Install the binary if it wasn't handled in the above loop.
[[ -z $_self ]] && inst_simple "$_bin" "$_target"
inst_simple "$_bin" "$_target"
}
# same as above, except for shell scripts.
@@ -502,23 +533,15 @@ inst_symlink() {
[[ -L $1 ]] || return 1
[[ -L $initdir/$_target ]] && return 0
_realsrc=$(readlink -f "$_src")
[[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
if [[ -d $_realsrc ]]; then
inst_dir "$_realsrc"
else
{
local _t
_t=${2:-$1}
_t="${_t%/*}"
[[ $_t ]] && inst_dir "$_t"
if ! [[ -e $initdir/$_realsrc ]]; then
if [[ -d $_realsrc ]]; then
inst_dir "$_realsrc"
else
inst "$_realsrc"
}
fi
if [[ -e "${_src}" ]]; then
ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
else
ln -sfn "$_realsrc" "$initdir/$_target"
fi
fi
[[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
}
# attempt to install any programs specified in a udev rule
@@ -590,12 +613,6 @@ inst() {
return 1
}
[[ $hookdirs ]] || {
hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
hookdirs+=" pre-pivot mount emergency shutdown-emergency shutdown cleanup"
export hookdirs
}
# install function specialized for hooks
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
@@ -639,6 +656,9 @@ inst_any() {
return 1
}
# dracut_install [-o ] <file> [<file> ... ]
# Install <file> to the initramfs image
# -o optionally install the <file> and don't fail, if it is not there
dracut_install() {
local _optional=no
if [[ $1 = '-o' ]]; then
@@ -706,6 +726,10 @@ inst_opt_decompress() {
done
}
# module_check <dracut module>
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "check $hostonly" is called
module_check() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
@@ -732,62 +756,10 @@ module_check() {
return $_ret
}
module_depends() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
# if we do not have a check script, we have no deps
[[ -x $_moddir/check ]] || return 0
$_moddir/check -d
return $?
else
unset check depends install installkernel
. $_moddir/module-setup.sh
is_func depends || return 0
depends
_ret=$?
unset check depends install installkernel
return $_ret
fi
}
module_install() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
[[ -x $_moddir/install ]] && . "$_moddir/install"
return $?
else
unset check depends install installkernel
. $_moddir/module-setup.sh
is_func install || return 0
install
_ret=$?
unset check depends install installkernel
return $_ret
fi
}
module_installkernel() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
return $?
else
unset check depends install installkernel
. $_moddir/module-setup.sh
is_func installkernel || return 0
installkernel
_ret=$?
unset check depends install installkernel
return $_ret
fi
}
# module_check_mount <dracut module>
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "mount_needs=1 check 0" is called
module_check_mount() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
@@ -810,6 +782,74 @@ module_check_mount() {
return $_ret
}
# module_depends <dracut module>
# execute the depends() function of module-setup.sh of <dracut module>
# or the "depends" script, if module-setup.sh is not found
module_depends() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
# if we do not have a check script, we have no deps
[[ -x $_moddir/check ]] || return 0
$_moddir/check -d
return $?
else
unset check depends install installkernel
. $_moddir/module-setup.sh
is_func depends || return 0
depends
_ret=$?
unset check depends install installkernel
return $_ret
fi
}
# module_install <dracut module>
# execute the install() function of module-setup.sh of <dracut module>
# or the "install" script, if module-setup.sh is not found
module_install() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
[[ -x $_moddir/install ]] && . "$_moddir/install"
return $?
else
unset check depends install installkernel
. $_moddir/module-setup.sh
is_func install || return 0
install
_ret=$?
unset check depends install installkernel
return $_ret
fi
}
# module_installkernel <dracut module>
# execute the installkernel() function of module-setup.sh of <dracut module>
# or the "installkernel" script, if module-setup.sh is not found
module_installkernel() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
local _ret
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
return $?
else
unset check depends install installkernel
. $_moddir/module-setup.sh
is_func installkernel || return 0
installkernel
_ret=$?
unset check depends install installkernel
return $_ret
fi
}
# check_mount <dracut module>
# check_mount checks, if a dracut module is needed for the given
# device and filesystem types in "${host_fs_types[@]}"
check_mount() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
@@ -849,6 +889,10 @@ check_mount() {
return 0
}
# check_module <dracut module> [<use_as_dep>]
# check if a dracut module is to be used in the initramfs process
# if <use_as_dep> is set, then the process also keeps track
# that the modules were checked for the dependency tracking process
check_module() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
@@ -900,6 +944,8 @@ check_module() {
return 0
}
# for_each_module_dir <func>
# execute "<func> <dracut module> 1"
for_each_module_dir() {
local _modcheck
local _mod
@@ -932,7 +978,11 @@ install_kmod_with_fw() {
local _kmod=${1##*/}
_kmod=${_kmod%.ko}
_kmod=${_kmod/-/_}
if strstr " $omit_drivers " " $_kmod " ; then
if [[ "$_kmod" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
return 1
fi
if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
return 1
fi
@@ -1037,7 +1087,10 @@ find_kernel_modules () {
find_kernel_modules_by_path drivers
}
# instmods <kernel module> [<kernel module> ... ]
# instmods <kernel subsystem>
# install kernel modules along with all their dependencies.
# <kernel subsystem> can be e.g. "=block" or "=drivers/usb/storage"
instmods() {
[[ $no_kernel = yes ]] && return
# called [sub]functions inherit _fderr
@@ -1065,12 +1118,17 @@ instmods() {
;;
--*) _mpargs+=" $_mod" ;;
i2o_scsi) return ;; # Do not load this diagnostic-only module
*) _mod=${_mod##*/}
*)
# if we are already installed, skip this module and go on
# to the next one.
[[ -f $initdir/$1 ]] && return
if [[ $omit_drivers ]] && [[ "$1" =~ $omit_drivers ]]; then
dinfo "Omitting driver ${_mod##$srcmods}"
return
fi
_mod=${_mod##*/}
# 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 \

View File

@@ -4,7 +4,7 @@
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
add_dracutmodules+=" rpmversion "
omit_dracutmodules+=" dash "
omit_drivers+=" ocfs2 "
omit_drivers+=" .*/fs/ocfs/.* "
stdloglvl=3
realinitpath="/usr/lib/systemd/systemd"
install_items+=" vi /etc/virc ps grep cat rm openvt "

View File

@@ -307,7 +307,7 @@ unset GREP_OPTIONS
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions.sh" ]] && \
dracutbasedir="$(readlink -f ${0%/*})"
# if we were not passed a config file, try the default one
@@ -436,10 +436,10 @@ fi
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
if [[ -f $dracutbasedir/dracut-functions ]]; then
. $dracutbasedir/dracut-functions
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
. $dracutbasedir/dracut-functions.sh
else
echo "Cannot find $dracutbasedir/dracut-functions." >&2
echo "Cannot find $dracutbasedir/dracut-functions.sh." >&2
echo "Are you running from a git checkout?" >&2
echo "Try passing -l as an argument to $0" >&2
exit 1
@@ -452,7 +452,7 @@ if (( ${BASH_VERSINFO[0]} < 3 ||
exit 1
fi
dracutfunctions=$dracutbasedir/dracut-functions
dracutfunctions=$dracutbasedir/dracut-functions.sh
export dracutfunctions
if (( ${#drivers_l[@]} )); then
@@ -477,12 +477,12 @@ if (( ${#omit_drivers_l[@]} )); then
fi
omit_drivers=${omit_drivers/-/_}
unset omit_drivers_corrected
omit_drivers_corrected=""
for d in $omit_drivers; do
strstr " $drivers $add_drivers " " $d " && continue
omit_drivers_corrected+=" $d "
omit_drivers_corrected+="$d|"
done
omit_drivers=$omit_drivers_corrected
omit_drivers="${omit_drivers_corrected%|}"
unset omit_drivers_corrected
@@ -642,18 +642,18 @@ if [[ $prefix ]]; then
fi
if [[ $kernel_only != yes ]]; then
for d in bin etc lib "$libdir" sbin tmp usr var var/log usr/bin usr/sbin; do
for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
if [ -h "/$d" ]; then
inst "/$d" "${prefix}/$d"
if [ -L "/$d" ]; then
inst_symlink "/$d" "${prefix}/$d"
else
mkdir -m 0755 -p "${initdir}${prefix}/$d"
fi
done
for d in dev proc sys sysroot root run run/lock run/initramfs; do
if [ -h "/$d" ]; then
inst "/$d"
if [ -L "/$d" ]; then
inst_symlink "/$d"
else
mkdir -m 0755 -p "$initdir/$d"
fi
@@ -672,7 +672,9 @@ else
done
fi
mkdir -p "${initdir}/etc/cmdline.d"
if [[ $kernel_only != yes ]]; then
mkdir -p "${initdir}/etc/cmdline.d"
fi
mods_to_load=""
# check all our modules to see if they should be sourced.
@@ -737,20 +739,20 @@ while pop include_src src && pop include_target tgt; do
fi
done
for item in $install_items; do
dracut_install -o "$item"
done
unset item
while pop fstab_lines line; do
echo "$line 0 0" >> "${initdir}/etc/fstab"
done
for f in $add_fstab; do
cat $f >> "${initdir}/etc/fstab"
done
if [[ $kernel_only != yes ]]; then
for item in $install_items; do
dracut_install -o "$item"
done
unset item
while pop fstab_lines line; do
echo "$line 0 0" >> "${initdir}/etc/fstab"
done
for f in $add_fstab; do
cat $f >> "${initdir}/etc/fstab"
done
# make sure that library links are correct and up to date
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
[[ -f $f ]] && inst_simple "$f"
@@ -793,11 +795,14 @@ type hardlink &>/dev/null && {
}
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
for i in $initdir/bin/* \
$initdir/sbin/* \
$initdir/usr/bin/* \
$initdir/usr/sbin/*; do
[ -x $i ] && prelink -u $i &>/dev/null
for dir in "$initdir/bin" \
"$initdir/sbin" \
"$initdir/usr/bin" \
"$initdir/usr/sbin"; do
[[ -L "$dir" ]] && continue
for i in "$dir"/*; do
[[ -x $i ]] && prelink -u $i &>/dev/null
done
done
fi

View File

@@ -13,7 +13,7 @@ Version: xxx
Release: xxx
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
Group: System Environment/Base
%endif
%if 0%{?suse_version}
@@ -28,14 +28,14 @@ Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar
BuildArch: noarch
BuildRequires: dash bash git
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
@@ -43,7 +43,7 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
BuildRequires: docbook-xsl-stylesheets libxslt
%endif
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6
%if 0%{?fedora} > 12 || 0%{?rhel}
# no "provides", because dracut does not offer
# all functionality of the obsoleted packages
Obsoletes: mkinitrd <= 6.0.93
@@ -75,7 +75,11 @@ Requires: gzip
Requires: module-init-tools >= 3.7-9
Requires: sed
Requires: udev
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.20
%else
Requires: util-linux-ng >= 2.17.2
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
Conflicts: initscripts < 8.63-1
@@ -99,7 +103,7 @@ Provides: dracut-generic = %{version}-%{release}
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel} >= 6
%package fips
Summary: Dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
@@ -123,7 +127,7 @@ Requires: %{name}-fips = %{version}-%{release}
%description fips-aesni
This package requires everything which is needed to build an
all purpose initramfs with dracut, which does an integrity check
all purpose initramfs with dracut, which does an integrity check
and adds the aesni-intel kernel module.
%package caps
@@ -160,14 +164,16 @@ git am -p1 %{patches}
make
%install
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
rm -rf $RPM_BUILD_ROOT
%endif
make install DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib \
bindir=%{_bindir} \
sysconfdir=/etc mandir=%{_mandir} \
systemdsystemunitdir=%{_unitdir}
%if %{defined _unitdir}
systemdsystemunitdir=%{_unitdir} \
%endif
sysconfdir=/etc mandir=%{_mandir}
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/10rpmversion/dracut-version
@@ -185,7 +191,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
%endif
@@ -221,11 +227,12 @@ rm -rf $RPM_BUILD_ROOT
%endif
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-logger
%{dracutlibdir}/dracut-logger.sh
%{dracutlibdir}/dracut-initramfs-restore
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
%config /etc/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
@@ -275,7 +282,7 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) /etc/logrotate.d/dracut_log
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%if 0%{?fedora} > 16 || 0%{?rhel} > 6
%if %{defined _unitdir}
%{_unitdir}/*.service
%{_unitdir}/*/*.service
%endif
@@ -292,7 +299,7 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/95znet
%if 0%{?fedora} || 0%{?rhel} > 6
%if 0%{?fedora} || 0%{?rhel}
%files fips
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/01fips

View File

@@ -20,7 +20,7 @@ sub create_patches {
my $tag=shift;
my $pdir=shift;
my $num=0;
open( GIT, 'git format-patch -N --no-signature -o "'.$pdir.'" '.$tag.' |');
open( GIT, 'git format-patch -M -N --no-signature -o "'.$pdir.'" '.$tag.' |');
@lines=<GIT>;
close GIT; # be done
return @lines;

View File

@@ -84,7 +84,7 @@ install() {
install_base() {
dracut_install setfont loadkeys kbd_mode stty
inst ${moddir}/console_init /lib/udev/console_init
inst ${moddir}/console_init.sh /lib/udev/console_init
inst_rules ${moddir}/10-console.rules
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
}

View File

@@ -47,6 +47,11 @@ if ! needconvert; then
exit 0
fi
if [ -e "$ROOT/usr/bin" ]; then
echo "$ROOT/usr/bin does not exist"
exit 1
fi
testfile="$ROOT/.usrmovecheck$$"
rm -f "$testfile"
> "$testfile"

View File

@@ -73,9 +73,9 @@ install() {
local _arch _i _dir
dracut_install ip arping tr dhclient
dracut_install -o brctl ifenslave
inst "$moddir/ifup" "/sbin/ifup"
inst "$moddir/netroot" "/sbin/netroot"
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
inst "$moddir/ifup.sh" "/sbin/ifup"
inst "$moddir/netroot.sh" "/sbin/netroot"
inst "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
inst "$moddir/net-lib.sh" "/lib/net-lib.sh"
inst_simple "$moddir/dhclient.conf" "/etc/dhclient.conf"
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"

View File

@@ -38,12 +38,13 @@ fi
# Count ip= lines to decide whether we need bootdev= or not
if [ -z "$NEEDBOOTDEV" ] ; then
local count=0
count=0
for p in $(getargs ip=); do
count=$(( $count + 1 ))
done
[ $count -gt 1 ] && NEEDBOOTDEV=1
fi
unset count
# If needed, check if bootdev= contains anything usable
if [ -n "$NEEDBOOTDEV" ] ; then

View File

@@ -60,11 +60,8 @@ curl_fetch_url() {
curl $curl_args --output "$outloc" "$url" || return $?
else
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
local cwd="$(pwd)"
cd "$outdir"
curl $curl_args --remote-name "$url" || return $?
cd "$cwd"
outloc="$(echo $outdir/*)"
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
outloc="$outdir/$(ls -A $outdir)"
fi
[ -f "$outloc" ] || return 253
echo "$outloc"

View File

@@ -38,7 +38,7 @@ install() {
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
. "$moddir"/plymouth-populate-initrd
. "$moddir"/plymouth-populate-initrd.sh
else
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
/usr/libexec/plymouth/plymouth-populate-initrd -t $initdir

View File

@@ -11,7 +11,7 @@ check() {
check_crypt() {
local dev=$1 fs=$2
[[ $fs = "crypto_LUKS" ]] || continue
[[ $fs = "crypto_LUKS" ]] || return 1
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
| while read line; do
[[ ${line#ID_FS_UUID} = $line ]] && continue
@@ -19,13 +19,15 @@ check() {
echo $ID_FS_UUID
break
done)
[[ ${ID_FS_UUID} ]] || continue
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
[[ ${ID_FS_UUID} ]] || return 1
if ! [[ $kernel_only ]]; then
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
fi
return 0
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_crypt
[ -f "${initdir}/etc/cmdline.d/90crypt.conf" ] || return 1
for_each_host_dev_fs check_crypt || return 1
}
return 0

View File

@@ -13,8 +13,7 @@ check() {
check_dmraid() {
local dev=$1 fs=$2 holder DEVPATH DM_NAME
[[ "$fs" = "linux_raid_member" ]] && continue
[[ "$fs" = "${fs%%_raid_member}" ]] && continue
[[ "$fs" = "${fs%%_raid_member}" ]] && return 1
DEVPATH=$(udevadm info --query=property --name=$dev \
| while read line; do
@@ -34,13 +33,15 @@ check() {
done)
done
[[ ${DM_NAME} ]] || continue
echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
[[ ${DM_NAME} ]] || return 1
if ! [[ $kernel_only ]]; then
echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
fi
return 0
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_dmraid
[ -f "${initdir}/etc/cmdline.d/90dmraid.conf" ] || return 1
for_each_host_dev_fs check_dmraid || return 1
}
return 0

View File

@@ -35,7 +35,7 @@ install() {
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
inst "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root"
inst "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
# should probably just be generally included
inst_rules 60-cdrom_id.rules
}

View File

@@ -45,7 +45,7 @@ installkernel() {
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then
if [[ -z $filesystems ]]; then
instmods '=fs'
omit_drivers="$omit_drivers|kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" omit_drivers="${omit_drivers##|}" instmods '=fs'
fi
else
inst_fs() {
@@ -63,16 +63,6 @@ installkernel() {
# force install of scsi_wait_scan
hostonly='' instmods scsi_wait_scan
}
install() {
local _f i
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
for i in $(find -L /etc/modprobe.d/ -maxdepth 1 -type f -name '*.conf'); do
inst_simple "$i"
done
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
for _f in modules.builtin.bin modules.builtin; do
[[ $srcmods/$_f ]] && break
@@ -84,4 +74,15 @@ install() {
for _f in modules.builtin.bin modules.builtin modules.order; do
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
done
}
install() {
local _f i
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
for i in $(find -L /etc/modprobe.d/ -maxdepth 1 -type f -name '*.conf'); do
inst_simple "$i"
done
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
}

View File

@@ -12,6 +12,6 @@ depends() {
install() {
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
inst "$moddir/livenetroot" "/sbin/livenetroot"
inst "$moddir/livenetroot.sh" "/sbin/livenetroot"
}

View File

@@ -15,8 +15,7 @@ if get_url_handler "$liveurl" >/dev/null; then
netroot="livenet:$liveurl"
root="livenet" # quiet complaints from init
rootok=1
wait_for_dev /dev/root
else
info "livenet: no url handler for $liveurl"
fi
wait_for_dev /dev/root

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
local _rootdev
local _rootdev _activated
# No point trying to support lvm if the binaries are missing
type -P lvm >/dev/null || return 1
@@ -14,13 +14,18 @@ check() {
unset DM_VG_NAME
unset DM_LV_NAME
eval $(udevadm info --query=property --name=$1|egrep '(DM_VG_NAME|DM_LV_NAME)=')
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return
echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
if ! [[ $kernel_only ]]; then
echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
fi
push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
fi
return 0
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_lvm
[ -f "${initdir}/etc/cmdline.d/90lvm.conf" ] || return 1
for_each_host_dev_fs check_lvm || return 1
}
return 0

View File

@@ -12,35 +12,25 @@ check() {
check_mdraid() {
local dev=$1 fs=$2 holder DEVPATH MD_UUID
[[ "$fs" = "linux_raid_member" ]] && continue
[[ "$fs" = "${fs%%_raid_member}" ]] && continue
[[ "$fs" = "${fs%%_raid_member}" ]] && return 1
DEVPATH=$(udevadm info --query=property --name=$dev \
MD_UUID=$(/sbin/mdadm --examine --export $dev \
| while read line; do
[[ ${line#DEVPATH} = $line ]] && continue
[[ ${line#MD_UUID} = $line ]] && continue
eval "$line"
echo $DEVPATH
echo $MD_UUID
break
done)
for holder in /sys/$DEVPATH/holders/*; do
[[ -e $holder ]] || continue
MD_UUID=$(udevadm info --query=property --path=$holder \
| while read line; do
[[ ${line#MD_UUID} = $line ]] && continue
eval "$line"
echo $MD_UUID
break
done)
done
[[ ${MD_UUID} ]] || continue
echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
[[ ${MD_UUID} ]] || return 1
if ! [[ $kernel_only ]]; then
echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
fi
return 0
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_mdraid
[[ -f "${initdir}/etc/cmdline.d/90mdraid.conf" ]] || return 1
for_each_host_dev_fs check_mdraid || return 1
}
return 0

View File

@@ -29,7 +29,7 @@ install() {
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
inst "$moddir/fcoe-up" "/sbin/fcoe-up"
inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"

View File

@@ -46,6 +46,7 @@ if getargbool 0 rd.iscsi.firmware -y iscsi_firmware ; then
if [ -n "${root%%block:*}" ]; then
# if root is not specified try to mount the whole iSCSI LUN
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
udevadm control --reload
fi
iscsistart -b
exit 0

View File

@@ -64,6 +64,6 @@ install() {
inst iscsi-iname
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
inst_hook pre-pivot 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot" "/sbin/iscsiroot"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
}

View File

@@ -28,9 +28,11 @@
if [ "${root%%:*}" = "iscsi" ] ; then
if [ -n "$netroot" ] ; then
echo "Warning: root takes precedence over netroot. Ignoring netroot"
fi
netroot=$root
# if root is not specified try to mount the whole iSCSI LUN
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
root=/dev/root
fi
# If it's not empty or iscsi we don't continue

View File

@@ -34,6 +34,6 @@ install() {
inst nbd-client
inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
inst "$moddir/nbdroot" "/sbin/nbdroot"
inst "$moddir/nbdroot.sh" "/sbin/nbdroot"
}

View File

@@ -24,15 +24,16 @@ netroot_to_var() {
server=$2; port=$3;
}
# Don't continue if root is ok
[ -n "$rootok" ] && return
# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)
[ -z "$netroot" ] && netroot=$(getarg netroot=)
# Root takes precedence over netroot
if [ "${root%%:*}" = "nbd" ] ; then
# Don't continue if root is ok
[ -n "$rootok" ] && return
if [ -n "$netroot" ] ; then
warn "root takes precedence over netroot. Ignoring netroot"

View File

@@ -40,7 +40,7 @@ install() {
for i in /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf; do
inst_simple $i
done
dracut_install rpc.idmapd
dracut_install rpc.idmapd
dracut_install sed
for _i in {"$libdir","$usrlibdir"}/libnfsidmap_nsswitch.so* \
@@ -59,7 +59,7 @@ install() {
inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
inst_hook pre-udev 99 "$moddir/nfs-start-rpc.sh"
inst_hook pre-pivot 99 "$moddir/nfsroot-cleanup.sh"
inst "$moddir/nfsroot" "/sbin/nfsroot"
inst "$moddir/nfsroot.sh" "/sbin/nfsroot"
inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh"
mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
mkdir -m 0755 -p "$initdir/var/lib/rpcbind"

View File

@@ -50,8 +50,8 @@ inst_sshenv()
}
install() {
[[ ! $cttyhack = yes ]] && {
derror "ssh interactive mode needs option --ctty!"
[[ ! $cttyhack = yes && ! $sshkey ]] && {
derror "ssh-client needs option --ctty or --sshkey!"
return 1
}

View File

@@ -5,11 +5,40 @@
type info >/dev/null 2>&1 || . /lib/dracut-lib.sh
type fsck_single >/dev/null 2>&1 || . /lib/fs-lib.sh
fsck_usr()
{
local _dev=$1
local _fs=$2
local _fsckoptions
if [ -f "$NEWROOT"/fsckoptions ]; then
_fsckoptions=$(cat "$NEWROOT"/fsckoptions)
fi
if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
_fsckoptions="-f $_fsckoptions"
elif [ -f "$NEWROOT"/.autofsck ]; then
[ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
fi
if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
warn "*** Warning -- the system did not shut down cleanly. "
warn "*** Dropping you to a shell; the system will continue"
warn "*** when you leave the shell."
emergency_shell
fi
_fsckoptions="$AUTOFSCK_OPT $_fsckoptions"
fi
fsck_single "$_dev" "$_fs" "$_fsckoptions"
}
mount_usr()
{
local _dev _mp _fs _opts _rest _usr_found _ret
local _dev _mp _fs _opts _rest _usr_found _ret _freq _passno
# check, if we have to mount the /usr filesystem
while read _dev _mp _fs _opts _rest; do
while read _dev _mp _fs _opts _freq _passno; do
if [ "$_mp" = "/usr" ]; then
case "$_dev" in
LABEL=*)
@@ -21,7 +50,7 @@ mount_usr()
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
;;
esac
echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_rest"
echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_freq $_passno"
_usr_found="1"
break
fi
@@ -29,7 +58,11 @@ mount_usr()
if [ "x$_usr_found" != "x" ]; then
# we have to mount /usr
fsck_single "$_dev" "$_fs"
if [ "0" != "${_passno:-0}" ]; then
fsck_usr "$_dev" "$_fs"
else
:
fi
_ret=$?
echo $_ret >/run/initramfs/usr-fsck
if [ $_ret -ne 255 ]; then

View File

@@ -392,6 +392,17 @@ wait_for_if_up() {
return 1
}
wait_for_route_ok() {
local cnt=0
while [ $cnt -lt 200 ]; do
li=$(ip route show)
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
# root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
# root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
nfsroot_to_var() {

View File

@@ -26,9 +26,9 @@ install() {
egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd"
egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
# install our scripts and hooks
inst "$moddir/init" "/init"
inst "$moddir/initqueue" "/sbin/initqueue"
inst "$moddir/loginit" "/sbin/loginit"
inst "$moddir/init.sh" "/init"
inst "$moddir/initqueue.sh" "/sbin/initqueue"
inst "$moddir/loginit.sh" "/sbin/loginit"
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
mkdir -m 0755 -p ${initdir}/lib/dracut

View File

@@ -197,7 +197,7 @@ fsck_single() {
info "Checking $_fs: $_dev"
export FSTAB_FILE
eval "$_drv" "\"$_dev\"" "\"$_fop\""
eval "$_drv"
return $?
}

View File

@@ -16,7 +16,7 @@ install() {
dracut_install umount
dracut_install poweroff reboot halt
dracut_install -o kexec
inst "$moddir/shutdown" "$prefix/shutdown"
inst "$moddir/shutdown.sh" "$prefix/shutdown"
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
mkdir -m 0755 -p ${initdir}/lib/dracut
mkdir -m 0755 -p ${initdir}/lib/dracut/hooks

View File

@@ -26,7 +26,7 @@ test_setup() {
(
initdir=$TESTDIR/overlay/source
mkdir -p $initdir
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient \
umount strace less
@@ -37,7 +37,7 @@ test_setup() {
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
@@ -47,7 +47,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sfdisk mkfs.ext3 poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -56,7 +56,7 @@ test_setup() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
--nomdadmconf \
@@ -75,12 +75,12 @@ test_setup() {
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-f $TESTDIR/initramfs.testing $KVERSION || return 1

View File

@@ -27,14 +27,14 @@ test_setup() {
(
initdir=$TESTDIR/overlay/source
(mkdir -p "$initdir"; cd "$initdir"; mkdir -p dev sys proc etc var/run tmp run)
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
@@ -47,7 +47,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -56,7 +56,7 @@ test_setup() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
--nomdadmconf \
@@ -73,13 +73,13 @@ test_setup() {
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst ./cryptroot-ask /sbin/cryptroot-ask
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth network" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \

View File

@@ -24,7 +24,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
initdir=$TESTDIR/overlay/source
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
@@ -34,7 +34,7 @@ test_setup() {
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
@@ -45,7 +45,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -54,7 +54,7 @@ test_setup() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash lvm mdraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
@@ -67,12 +67,12 @@ test_setup() {
grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth network" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \

View File

@@ -59,7 +59,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
initdir=$TESTDIR/overlay/source
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
@@ -69,7 +69,7 @@ test_setup() {
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
@@ -79,7 +79,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sfdisk mke2fs poweroff cp umount dd grep
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -88,7 +88,7 @@ test_setup() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
@@ -107,15 +107,15 @@ test_setup() {
eval $(grep --binary-files=text -m 1 MD_UUID $TESTDIR/root.ext2)
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask /sbin/cryptroot-ask
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
mkdir -p $initdir/etc
echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > $initdir/etc/mdadm.conf
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth network" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \

View File

@@ -60,7 +60,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
initdir=$TESTDIR/overlay/source
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
@@ -70,7 +70,7 @@ test_setup() {
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
@@ -80,7 +80,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sfdisk mke2fs poweroff cp umount grep
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -89,7 +89,7 @@ test_setup() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
@@ -109,13 +109,13 @@ test_setup() {
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask /sbin/cryptroot-ask
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth network" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \

View File

@@ -26,7 +26,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
initdir=$TESTDIR/overlay/source
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
@@ -36,7 +36,7 @@ test_setup() {
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
@@ -46,7 +46,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sfdisk mkfs.btrfs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -55,7 +55,7 @@ test_setup() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash btrfs udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix btrfs sd_mod" \
--nomdadmconf \
@@ -75,13 +75,13 @@ test_setup() {
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst ./cryptroot-ask /sbin/cryptroot-ask
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth network" \
-a "debug" \
-d "piix ide-gd_mod ata_piix btrfs sd_mod" \

View File

@@ -22,7 +22,7 @@ test_setup() {
mkdir -p $TESTDIR/overlay
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -30,7 +30,7 @@ test_setup() {
dd if=/dev/zero of=$TESTDIR/root.img count=100
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-a "debug dmsquash-live" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-f $TESTDIR/initramfs.testing $KVERSION || return 1
@@ -40,7 +40,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
initdir=$TESTDIR/root-source
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient \
umount strace less
@@ -54,7 +54,7 @@ test_setup() {
for f in /usr/share/syslinux/*; do
inst_simple "$f"
done
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
inst $TESTDIR/initramfs.testing "/boot/initramfs-$KVERSION.img"
inst /boot/vmlinuz-$KVERSION
find_binary plymouth >/dev/null && dracut_install plymouth

View File

@@ -211,7 +211,7 @@ test_setup() {
kernel=$KVERSION
(
initdir=$TESTDIR/mnt
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh ls shutdown poweroff stty cat ps ln ip \
dmesg mkdir cp ping exportfs \
modprobe rpc.nfsd rpc.mountd showmount tcpdump \
@@ -225,8 +225,8 @@ test_setup() {
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
instmods nfsd sunrpc ipv6
inst ./server-init /sbin/init
instmods nfsd sunrpc ipv6 lockd
inst ./server-init.sh /sbin/init
inst ./hosts /etc/hosts
inst ./exports /etc/exports
inst ./dhcpd.conf /etc/dhcpd.conf
@@ -263,14 +263,14 @@ test_setup() {
mkdir -p $initdir
(
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh shutdown poweroff stty cat ps ln ip \
mount dmesg mkdir cp ping grep
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
inst ./client-init /sbin/init
inst ./client-init.sh /sbin/init
(
cd "$initdir"
mkdir -p dev sys proc etc
@@ -298,20 +298,20 @@ test_setup() {
(
initdir=$TESTDIR/overlay
mkdir $TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
# Make server's dracut image
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash udev-rules base rootfs-block debug kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \
-f $TESTDIR/initramfs.server $KVERSION || return 1
# Make client's dracut image
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth" \
-a "debug" \
-d "piix ide-gd_mod ata_piix sd_mod e1000 nfs sunrpc" \

View File

@@ -12,18 +12,18 @@ run_server() {
echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server"
$testdir/run-qemu \
-hda $TESTDIR/server.ext2 \
-hdb $TESTDIR/root.ext2 \
-hdc $TESTDIR/iscsidisk2.img \
-hdd $TESTDIR/iscsidisk3.img \
-m 256M -nographic \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
-net socket,listen=127.0.0.1:12330 \
-serial $SERIAL \
-kernel /boot/vmlinuz-$KVERSION \
-append "root=/dev/sda rw quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.server \
-pidfile $TESTDIR/server.pid -daemonize || return 1
-hda $TESTDIR/server.ext2 \
-hdb $TESTDIR/root.ext2 \
-hdc $TESTDIR/iscsidisk2.img \
-hdd $TESTDIR/iscsidisk3.img \
-m 256M -nographic \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
-net socket,listen=127.0.0.1:12330 \
-serial $SERIAL \
-kernel /boot/vmlinuz-$KVERSION \
-append "root=/dev/sda rw quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.server \
-pidfile $TESTDIR/server.pid -daemonize || return 1
sudo chmod 644 $TESTDIR/server.pid || return 1
# Cleanup the terminal if we have one
@@ -34,58 +34,64 @@ run_server() {
}
run_client() {
local test_name=$1; shift
echo "CLIENT TEST START: $test_name"
# Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1; then
echo "Unable to make client sda image" 1>&2
dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1
$testdir/run-qemu \
-hda $TESTDIR/client.img \
-m 256M -nographic \
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
-kernel /boot/vmlinuz-$KVERSION \
-append "$@ rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
if ! grep -m 1 -q iscsi-OK $TESTDIR/client.img; then
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
return 1
fi
$testdir/run-qemu \
-hda $TESTDIR/client.img \
-m 256M -nographic \
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
-kernel /boot/vmlinuz-$KVERSION \
-append "root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2 rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
grep -m 1 -q iscsi-OK $TESTDIR/client.img || return 1
echo "CLIENT TEST END: $test_name [OK]"
return 0
}
if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1; then
echo "Unable to make client sda image" 1>&2
return 1
fi
do_test_run() {
$testdir/run-qemu \
-hda $TESTDIR/client.img \
-m 256M -nographic \
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
-kernel /boot/vmlinuz-$KVERSION \
-append "root=dhcp rw quiet rd.retry=5 rd.debug rd.info console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
grep -m 1 -q iscsi-OK $TESTDIR/client.img || return 1
run_client "root=dhcp" \
"root=dhcp" \
|| return 1
run_client "root=iscsi" \
"root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
"ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off" \
|| return 1
run_client "netroot=iscsi" \
"root=LABEL=sysroot ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:eth0:off" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
|| return 1
return 0
}
test_run() {
if ! run_server; then
echo "Failed to start server" 1>&2
return 1
echo "Failed to start server" 1>&2
return 1
fi
run_client
do_test_run
ret=$?
if [[ -s $TESTDIR/server.pid ]]; then
sudo kill -TERM $(cat $TESTDIR/server.pid)
rm -f $TESTDIR/server.pid
sudo kill -TERM $(cat $TESTDIR/server.pid)
rm -f $TESTDIR/server.pid
fi
return $ret
}
test_setup() {
if [ ! -x /usr/sbin/iscsi-target ]; then
echo "Need iscsi-target from netbsd-iscsi"
return 1
echo "Need iscsi-target from netbsd-iscsi"
return 1
fi
# Create the blank file to use as a root filesystem
@@ -96,68 +102,68 @@ test_setup() {
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
(
initdir=$TESTDIR/overlay/source
. $basedir/dracut-functions
dracut_install sh shutdown poweroff stty cat ps ln ip \
initdir=$TESTDIR/overlay/source
. $basedir/dracut-functions.sh
dracut_install sh shutdown poweroff stty cat ps ln ip \
mount dmesg mkdir cp ping grep
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
inst ./client-init /sbin/init
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
inst ./client-init.sh /sbin/init
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
initdir=$TESTDIR/overlay
. $basedir/dracut-functions.sh
dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
rm -rf $TESTDIR/overlay
# Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
if ! dd if=/dev/null of=$TESTDIR/client.img bs=1M seek=1; then
echo "Unable to make client sdb image" 1>&2
return 1
echo "Unable to make client sdb image" 1>&2
return 1
fi
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu \
-hda $TESTDIR/root.ext2 \
-hdb $TESTDIR/client.img \
-hdc $TESTDIR/iscsidisk2.img \
-hdd $TESTDIR/iscsidisk3.img \
-m 256M -nographic -net none \
-kernel "/boot/vmlinuz-$kernel" \
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
-hda $TESTDIR/root.ext2 \
-hdb $TESTDIR/client.img \
-hdc $TESTDIR/iscsidisk2.img \
-hdd $TESTDIR/iscsidisk3.img \
-m 256M -nographic -net none \
-kernel "/boot/vmlinuz-$kernel" \
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
rm $TESTDIR/client.img
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
initdir=$TESTDIR/overlay
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
-o "plymouth dmraid" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-f $TESTDIR/initramfs.testing $KVERSION || return 1
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth dmraid" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-f $TESTDIR/initramfs.testing $KVERSION || return 1
# Make server root
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=60
@@ -167,53 +173,53 @@ test_setup() {
kernel=$KVERSION
(
initdir=$TESTDIR/mnt
. $basedir/dracut-functions
(
cd "$initdir";
mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
)
inst /etc/passwd /etc/passwd
dracut_install sh ls shutdown poweroff stty cat ps ln ip \
dmesg mkdir cp ping \
modprobe tcpdump \
/etc/services sleep mount chmod
dracut_install /usr/sbin/iscsi-target
initdir=$TESTDIR/mnt
. $basedir/dracut-functions.sh
(
cd "$initdir";
mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
)
inst /etc/passwd /etc/passwd
dracut_install sh ls shutdown poweroff stty cat ps ln ip \
dmesg mkdir cp ping \
modprobe tcpdump \
/etc/services sleep mount chmod
dracut_install /usr/sbin/iscsi-target
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
instmods iscsi_tcp crc32c ipv6
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
instmods iscsi_tcp crc32c ipv6
inst ./targets /etc/iscsi/targets
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
inst ./server-init /sbin/init
inst ./hosts /etc/hosts
inst ./dhcpd.conf /etc/dhcpd.conf
dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
inst /etc/group /etc/group
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
inst ./server-init.sh /sbin/init
inst ./hosts /etc/hosts
inst ./dhcpd.conf /etc/dhcpd.conf
dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
inst /etc/group /etc/group
/sbin/depmod -a -b "$initdir" $kernel
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
/sbin/depmod -a -b "$initdir" $kernel
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
sudo umount $TESTDIR/mnt
rm -fr $TESTDIR/mnt
# Make server's dracut image
$basedir/dracut -l -i $TESTDIR/overlay / \
-m "dash udev-rules base rootfs-block debug kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \
-f $TESTDIR/initramfs.server $KVERSION || return 1
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash udev-rules base rootfs-block debug kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \
-f $TESTDIR/initramfs.server $KVERSION || return 1
}
test_cleanup() {
if [[ -s $TESTDIR/server.pid ]]; then
sudo kill -TERM $(cat $TESTDIR/server.pid)
rm -f $TESTDIR/server.pid
sudo kill -TERM $(cat $TESTDIR/server.pid)
rm -f $TESTDIR/server.pid
fi
}

View File

@@ -193,14 +193,14 @@ make_encrypted_root() {
initdir=$TESTDIR/overlay/source
mkdir -p "$initdir"
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip \
mount dmesg mkdir cp ping
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
inst ./client-init /sbin/init
inst ./client-init.sh /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
@@ -209,7 +209,7 @@ make_encrypted_root() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install mke2fs poweroff cp umount tune2fs
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -218,7 +218,7 @@ make_encrypted_root() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 ext3 sd_mod" \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
@@ -245,7 +245,7 @@ make_client_root() {
kernel=$KVERSION
(
initdir=$TESTDIR/mnt
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
mkdir -p "$initdir"
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
dracut_install sh ls shutdown poweroff stty cat ps ln ip \
@@ -254,7 +254,7 @@ make_client_root() {
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
inst ./client-init /sbin/init
inst ./client-init.sh /sbin/init
inst /etc/nsswitch.conf /etc/nsswitch.conf
inst /etc/passwd /etc/passwd
inst /etc/group /etc/group
@@ -279,7 +279,7 @@ make_server_root() {
kernel=$KVERSION
(
initdir=$TESTDIR/mnt
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
mkdir -p "$initdir"
(
cd "$initdir";
@@ -294,7 +294,7 @@ make_server_root() {
dracut_install -o ${_terminfodir}/l/linux
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
inst ./server-init /sbin/init
inst ./server-init.sh /sbin/init
inst ./hosts /etc/hosts
inst ./dhcpd.conf /etc/dhcpd.conf
inst /etc/nsswitch.conf /etc/nsswitch.conf
@@ -324,19 +324,19 @@ test_setup() {
# Make the test image
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask /sbin/cryptroot-ask
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash udev-rules rootfs-block base debug kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000" \
-f $TESTDIR/initramfs.server $KVERSION || return 1
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000" \

View File

@@ -130,7 +130,7 @@ test_setup() {
kernel=$KVERSION
(
initdir=$TESTDIR/mnt
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh ls shutdown poweroff stty cat ps ln ip \
dmesg mkdir cp ping exportfs \
modprobe rpc.nfsd rpc.mountd showmount tcpdump \
@@ -145,7 +145,7 @@ test_setup() {
type -P dhcpd >/dev/null && dracut_install dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
instmods nfsd sunrpc ipv6
inst ./server-init /sbin/init
inst ./server-init.sh /sbin/init
inst ./hosts /etc/hosts
inst ./exports /etc/exports
inst ./dhcpd.conf /etc/dhcpd.conf
@@ -191,7 +191,7 @@ test_setup() {
mkdir -p $initdir
(
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh shutdown poweroff stty cat ps ln ip \
mount dmesg mkdir \
cp ping grep ls
@@ -199,7 +199,7 @@ test_setup() {
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
inst ./client-init /sbin/init
inst ./client-init.sh /sbin/init
(
cd "$initdir"
mkdir -p dev sys proc etc run
@@ -223,20 +223,20 @@ test_setup() {
(
initdir=$TESTDIR/overlay
mkdir $TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
# Make server's dracut image
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash udev-rules base rootfs-block debug kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod e1000" \
-f $TESTDIR/initramfs.server $KVERSION || return 1
# Make client's dracut image
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth" \
-a "debug" \
-d "piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfs sunrpc" \

View File

@@ -58,7 +58,7 @@ test_setup() {
# Create what will eventually be our root filesystem onto an overlay
(
initdir=$TESTDIR/overlay/source
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
mount dmesg ifconfig dhclient mkdir cp ping dhclient
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
@@ -68,7 +68,7 @@ test_setup() {
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
inst ./test-init /sbin/init
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
cp -a /etc/ld.so.conf* $initdir/etc
@@ -79,7 +79,7 @@ test_setup() {
# second, install the files needed to make the root filesystem
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install sfdisk mke2fs poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
@@ -88,7 +88,7 @@ test_setup() {
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut -l -i $TESTDIR/overlay / \
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash lvm mdraid dmraid udev-rules base rootfs-block kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
@@ -105,12 +105,12 @@ test_setup() {
grep -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
(
initdir=$TESTDIR/overlay
. $basedir/dracut-functions
. $basedir/dracut-functions.sh
dracut_install poweroff shutdown
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i $TESTDIR/overlay / \
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth network" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \