Compare commits
80 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
148284ced6 | ||
![]() |
1def132d53 | ||
![]() |
0de910602c | ||
![]() |
3714170f33 | ||
![]() |
c6ca79eb4e | ||
![]() |
a15ad925e9 | ||
![]() |
13d5225fc8 | ||
![]() |
e3052553cf | ||
![]() |
cc0e7a369b | ||
![]() |
7f819d7041 | ||
![]() |
dfba82b3d3 | ||
![]() |
3ae2f09a04 | ||
![]() |
a2a2a956dd | ||
![]() |
fa9d7304bf | ||
![]() |
c56b63d1bd | ||
![]() |
2e44f115b9 | ||
![]() |
0c296f15b1 | ||
![]() |
345f573546 | ||
![]() |
69288348dd | ||
![]() |
9babe97e6f | ||
![]() |
863fa9c295 | ||
![]() |
766968bb6f | ||
![]() |
123e04b23e | ||
![]() |
9d2eb35d7a | ||
![]() |
67a38adacf | ||
![]() |
80aa303c29 | ||
![]() |
5ea16f2790 | ||
![]() |
2f24b79ddd | ||
![]() |
d9f8feb04a | ||
![]() |
bb57587b42 | ||
![]() |
b61ca28260 | ||
![]() |
a3f4e7709b | ||
![]() |
984a819b92 | ||
![]() |
edae4b5efb | ||
![]() |
2098ebf712 | ||
![]() |
f72c10f657 | ||
![]() |
645bde35d3 | ||
![]() |
0c39f9f6f6 | ||
![]() |
21007cb6ec | ||
![]() |
31f7db66a8 | ||
![]() |
4f18fe8296 | ||
![]() |
5494f08cc5 | ||
![]() |
c1a37d928f | ||
![]() |
0375106c78 | ||
![]() |
2b9dfbbeae | ||
![]() |
47b5c0f290 | ||
![]() |
4e6d8fd691 | ||
![]() |
34a369ed2d | ||
![]() |
3e6d2b31ea | ||
![]() |
13beb248bc | ||
![]() |
b03edf372f | ||
![]() |
e663608c40 | ||
![]() |
ef380e9de8 | ||
![]() |
39f3a51d65 | ||
![]() |
4809126378 | ||
![]() |
6c4b24afb0 | ||
![]() |
c1b2cc48d6 | ||
![]() |
fdb3d52d59 | ||
![]() |
d726d811f1 | ||
![]() |
2fe2945869 | ||
![]() |
f016dccc89 | ||
![]() |
c993cfb32f | ||
![]() |
9aaf7c3a33 | ||
![]() |
0e77eb3782 | ||
![]() |
93ce0a7a1c | ||
![]() |
a8b15b36bf | ||
![]() |
33ee031c4a | ||
![]() |
f24a2d46b7 | ||
![]() |
6a389cfca8 | ||
![]() |
26537a5b79 | ||
![]() |
aae88014c7 | ||
![]() |
441d31b927 | ||
![]() |
04db5fdc15 | ||
![]() |
0592128b1e | ||
![]() |
308b10311c | ||
![]() |
7045d15460 | ||
![]() |
6c034582d2 | ||
![]() |
57b965ef4b | ||
![]() |
f4785648fb | ||
![]() |
e368513370 |
12
Makefile
12
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=0.5
|
||||
VERSION=0.8
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix = /usr
|
||||
@@ -23,6 +23,7 @@ install:
|
||||
mkdir -p $(DESTDIR)$(mandir)/man8
|
||||
install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
|
||||
install -m 0755 dracut-gencmdline $(DESTDIR)$(sbindir)/dracut-gencmdline
|
||||
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
|
||||
install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
@@ -65,3 +66,12 @@ check: all
|
||||
testimage: all
|
||||
./dracut -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)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
./dracut -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
|
||||
@echo wrote test-dracut.img
|
||||
|
||||
|
||||
|
||||
|
152
NEWS
Normal file
152
NEWS
Normal file
@@ -0,0 +1,152 @@
|
||||
dracut-0.8
|
||||
==========
|
||||
- iSCSI with username and password
|
||||
- support for live images (dmsquashed live images)
|
||||
- iscsi_firmware fixes
|
||||
- smaller images
|
||||
- bugfixes
|
||||
|
||||
dracut-0.7
|
||||
==========
|
||||
- dracut: strip binaries in initramfs
|
||||
|
||||
--strip
|
||||
strip binaries in the initramfs (default)
|
||||
|
||||
--nostrip
|
||||
do not strip binaries in the initramfs
|
||||
- dracut-catimages
|
||||
|
||||
Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
|
||||
[<image>...]
|
||||
Creates initial ramdisk image by concatenating several images from the
|
||||
command
|
||||
line and /boot/dracut/
|
||||
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-i, --imagedir Directory with additional images to add
|
||||
(default: /boot/dracut/)
|
||||
-o, --overlaydir Overlay directory, which contains files that
|
||||
will be used to create an additional image
|
||||
--nooverlay Do not use the overlay directory
|
||||
--noimagedir Do not use the additional image directory
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
-v, --verbose Verbose output during the build process
|
||||
|
||||
- s390 dasd support
|
||||
|
||||
dracut-0.6
|
||||
==========
|
||||
- dracut: add --kernel-only and --no-kernel arguments
|
||||
|
||||
--kernel-only
|
||||
only install kernel drivers and firmware files
|
||||
|
||||
--no-kernel
|
||||
do not install kernel drivers and firmware files
|
||||
|
||||
All kernel module related install commands moved from "install"
|
||||
to "installkernel".
|
||||
|
||||
For "--kernel-only" all installkernel scripts of the specified
|
||||
modules are used, regardless of any checks, so that all modules
|
||||
which might be needed by any dracut generic image are in.
|
||||
|
||||
The basic idea is to create two images. One image with the kernel
|
||||
modules and one without. So if the kernel changes, you only have
|
||||
to replace one image.
|
||||
|
||||
Grub and the kernel can handle multiple images, so grub entry can
|
||||
look like this:
|
||||
|
||||
title Fedora (2.6.29.5-191.fc11.i586)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
|
||||
initrd /initrd-20090722.img /initrd-kernel-2.6.29.5-191.fc11.i586.img /initrd-config.img
|
||||
|
||||
initrd-20090722.img
|
||||
the image provided by the initrd rpm
|
||||
one old backup version is kept like with the kernel
|
||||
|
||||
initrd-kernel-2.6.29.5-191.fc11.i586.img
|
||||
the image provided by the kernel rpm
|
||||
|
||||
initrd-config.img
|
||||
optional image with local configuration files
|
||||
|
||||
- dracut: add --kmoddir directory, where to look for kernel modules
|
||||
|
||||
-k, --kmoddir [DIR]
|
||||
specify the directory, where to look for kernel modules
|
||||
|
||||
|
||||
|
||||
dracut-0.5
|
||||
==========
|
||||
- more generic (all plymouth modules, all keyboards, all console fonts)
|
||||
- more kernel command line parameters (see also man dracut(8))
|
||||
- a helper tool, which generates the kernel command line (dracut-gencmdline)
|
||||
- bridged network boot
|
||||
- a lot of new command line parameter
|
||||
|
||||
dracut-0.4
|
||||
==========
|
||||
- bugfixes
|
||||
- firmware loading support
|
||||
- new internal queue (initqueue)
|
||||
initqueue now loops until /dev/root exists or root is mounted
|
||||
|
||||
init now has the following points to inject scripts:
|
||||
|
||||
/cmdline/*.sh
|
||||
scripts for command line parsing
|
||||
|
||||
/pre-udev/*.sh
|
||||
scripts to run before udev is started
|
||||
|
||||
/pre-trigger/*.sh
|
||||
scripts to run before the main udev trigger is pulled
|
||||
|
||||
/initqueue/*.sh
|
||||
runs in parallel to the udev trigger
|
||||
Udev events can add scripts here with /sbin/initqueue.
|
||||
If /sbin/initqueue is called with the "--onetime" option, the script
|
||||
will be removed after it was run.
|
||||
If /initqueue/work is created and udev >= 143 then this loop can
|
||||
process the jobs in parallel to the udevtrigger.
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
Scripts can remove themselves from the initqueue by "rm $job".
|
||||
|
||||
/pre-mount/*.sh
|
||||
scripts to run before the root filesystem is mounted
|
||||
NFS is an exception, because it has no device node to be created
|
||||
and mounts in the udev events
|
||||
|
||||
/mount/*.sh
|
||||
scripts to mount the root filesystem
|
||||
NFS is an exception, because it has no device node to be created
|
||||
and mounts in the udev events
|
||||
If the udev queue is empty and no root device is found or no root
|
||||
filesystem was mounted, the user will be dropped to a shell after
|
||||
a timeout.
|
||||
|
||||
/pre-pivot/*.sh
|
||||
scripts to run before the real init is executed and the initramfs
|
||||
disappears
|
||||
All processes started before should be killed here.
|
||||
|
||||
The behaviour of the dmraid module demonstrates how to use the new
|
||||
mechanism. If it detects a device which is part of a raidmember from a
|
||||
udev rule, it installs a job to scan for dmraid devices, if the udev
|
||||
queue is empty. After a scan, it removes itsself from the queue.
|
||||
|
||||
|
||||
|
||||
dracut-0.3
|
||||
==========
|
||||
|
||||
- first public version
|
||||
|
2
README
2
README
@@ -21,7 +21,7 @@ as hooks are guaranteed to be the path to slow-down.
|
||||
|
||||
Most of the initrd generation functionality in dracut is provided by a bunch
|
||||
of generator modules that are sourced by the main dracut script to install
|
||||
specific functionality into the initrd. They live in the modules subdirectory,
|
||||
specific functionality into the initrd. They live in the modules.d subdirectory,
|
||||
and use functionality provided by dracut-functions to do their work.
|
||||
Some general rules for writing modules:
|
||||
* Use one of the inst family of functions to actually install files
|
||||
|
6
README.kernel
Normal file
6
README.kernel
Normal file
@@ -0,0 +1,6 @@
|
||||
dracut-kernel is used to pull in all firmware files to build an initrd with
|
||||
only kernel modules and firmware files.
|
||||
|
||||
dracut --kernel-only only executes "installkernel" in the modules
|
||||
subdirectories.
|
||||
|
@@ -16,7 +16,7 @@ dracut_install_dir/modules.d/
|
||||
it easy for an earlier module to override the functionality of a
|
||||
later module, so that you can have a distro or system specific
|
||||
module override or modify the functionality of a generic module
|
||||
without having to patch the mode generic module.
|
||||
without having to patch the more generic module.
|
||||
|
||||
install: dracut sources this script to install the functionality that a
|
||||
module implements onto the initrd. For the most part, this amounts
|
||||
|
92
dracut
92
dracut
@@ -5,8 +5,21 @@
|
||||
# of the various mkinitrd implementations out there
|
||||
#
|
||||
|
||||
# Copyright 2008, Red Hat, Inc. Jeremy Katz <katzj@redhat.com>
|
||||
# GPLv2 header here
|
||||
# Copyright 2005-2009 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/>.
|
||||
#
|
||||
|
||||
|
||||
usage() {
|
||||
@@ -22,6 +35,14 @@ Creates initial ramdisk images for preloading modules
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
|
||||
include in the initramfs.
|
||||
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
|
||||
modules
|
||||
--fwdir [DIR] Specify additional directories, where to look for
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--strip Strip binaries in the initramfs (default)
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
-v, --verbose Verbose output during the build process
|
||||
@@ -48,6 +69,12 @@ while (($# > 0)); do
|
||||
-o|--omit) omit_dracutmodules_l="$2"; shift;;
|
||||
-a|--add) add_dracutmodules_l="$2"; shift;;
|
||||
-d|--drivers) drivers_l="$2"; shift;;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
||||
--fwdir) fw_dir_l="$2"; shift;;
|
||||
--kernel-only) kernel_only="yes"; nokernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
--debug) debug="yes";;
|
||||
-v|--verbose) beverbose="yes";;
|
||||
@@ -56,6 +83,7 @@ while (($# > 0)); do
|
||||
-H|--hostonly) hostonly="-h" ;;
|
||||
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
|
||||
-I|--install) install_items="$2"; shift;;
|
||||
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
@@ -79,7 +107,12 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
|
||||
[[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
|
||||
[[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
|
||||
[[ $drivers_l ]] && drivers=$drivers_l
|
||||
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
|
||||
[[ $fw_dir_l ]] && fw_dir=$fw_dir_l
|
||||
[[ $do_strip_l ]] && do_strip=$do_strip_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
[[ $fw_dir ]] || fw_dir=/lib/firmware
|
||||
[[ $do_strip ]] || do_strip=yes
|
||||
|
||||
[[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
|
||||
|
||||
@@ -102,6 +135,10 @@ esac
|
||||
[[ $2 ]] && kernel=$2 || kernel=$(uname -r)
|
||||
[[ $1 ]] && outfile=$(readlink -f $1) || outfile="/boot/initrd-$kernel.img"
|
||||
|
||||
srcmods="/lib/modules/$kernel/"
|
||||
[ -n "$drivers_dir" ] && srcmods="$drivers_dir"
|
||||
export srcmods
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
echo "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
@@ -115,12 +152,15 @@ trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
chmod 755 "$initdir"
|
||||
|
||||
export initdir hookdirs dsrc dracutmodules drivers debug beverbose
|
||||
export initdir hookdirs dsrc dracutmodules drivers \
|
||||
fw_dir drivers_dir debug beverbose no_kernel kernel_only
|
||||
|
||||
# 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
|
||||
mkdir -p "$initdir/$d";
|
||||
done
|
||||
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
|
||||
mkdir -p "$initdir/$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.
|
||||
@@ -130,7 +170,14 @@ check_modules
|
||||
for moddir in "$dsrc/modules.d"/[0-9][0-9]*; do
|
||||
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $mod "; then
|
||||
. "$moddir/install"
|
||||
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
|
||||
@@ -162,6 +209,35 @@ unset item
|
||||
|
||||
[[ "$beverbose" = "yes" ]] && (du -c "$initdir" | sort -n)
|
||||
|
||||
# strip binaries
|
||||
if [ "$do_strip" = "yes" ] ; then
|
||||
for p in strip objdump sed grep find; do
|
||||
if ! which $p >/dev/null 2>&1; 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 \) -exec file {} \; |
|
||||
grep -v ' shared object,' |
|
||||
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do
|
||||
dinfo "Stripping $f"
|
||||
strip -g "$f" || :
|
||||
#
|
||||
# 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" || :
|
||||
done
|
||||
fi
|
||||
|
||||
( cd "$initdir"; find . |cpio -H newc -o |gzip -9 > "$outfile"; )
|
||||
|
||||
[[ "$beverbose" = "yes" ]] && ls -lh "$outfile"
|
||||
|
124
dracut-catimages
Executable file
124
dracut-catimages
Executable file
@@ -0,0 +1,124 @@
|
||||
#!/bin/bash --norc
|
||||
|
||||
# Copyright 2009 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/>.
|
||||
#
|
||||
|
||||
|
||||
dwarning() {
|
||||
echo "Warning: $@" >&2
|
||||
}
|
||||
|
||||
dinfo() {
|
||||
[[ $beverbose ]] && echo "$@" >&2
|
||||
}
|
||||
|
||||
derror() {
|
||||
echo "Error: $@" >&2
|
||||
}
|
||||
|
||||
usage() {
|
||||
# 80x25 linebreak here ^
|
||||
echo "Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
|
||||
Creates initial ramdisk image by concatenating several images from the command
|
||||
line and /boot/dracut/
|
||||
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-i, --imagedir Directory with additional images to add
|
||||
(default: /boot/dracut/)
|
||||
-o, --overlaydir Overlay directory, which contains files that
|
||||
will be used to create an additional image
|
||||
--nooverlay Do not use the overlay directory
|
||||
--noimagedir Do not use the additional image directory
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
-v, --verbose Verbose output during the build process
|
||||
"
|
||||
}
|
||||
|
||||
|
||||
imagedir=/boot/dracut/
|
||||
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 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
outfile=$1; shift
|
||||
|
||||
if [ -z "$outfile" ]; then
|
||||
derror "No output file specified."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
baseimage=$1; shift
|
||||
|
||||
if [ -z "$baseimage" ]; then
|
||||
derror "No base image specified."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f $outfile -a -z "$force" ]; then
|
||||
derror "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$no_imagedir" -a ! -d "$imagedir" ]; then
|
||||
derror "Image directory $overlay is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$no_overlay" -a ! -d "$overlay" ]; then
|
||||
derror "Overlay $overlay is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$no_overlay" ]; then
|
||||
ofile="$imagedir/90-overlay.img"
|
||||
dinfo "Creating image $ofile from directory $overlay"
|
||||
( cd "$overlay"; find . |cpio --quiet -H newc -o |gzip -9 > "$ofile"; )
|
||||
fi
|
||||
|
||||
if [ -z "$no_imagedir" ]; then
|
||||
images=$(for i in $imagedir/*.img;do [ -f $i ] || continue; echo $i; done)
|
||||
fi
|
||||
|
||||
images="$images $@"
|
||||
|
||||
dinfo "Using base image $baseimage"
|
||||
cat $baseimage > $outfile
|
||||
|
||||
for i in $images; do
|
||||
dinfo "Appending $i"
|
||||
cat $i >> $outfile
|
||||
done
|
||||
|
||||
dinfo "Created $outfile"
|
||||
|
||||
exit 0
|
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# functions used by mkinitrd and other tools.
|
||||
# functions used by dracut and other tools.
|
||||
#
|
||||
# Copyright 2005-2008 Red Hat, Inc. All rights reserved.
|
||||
# Copyright 2005-2009 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
|
||||
@@ -17,10 +17,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Authors:
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
# Jeremy Katz <katzj@redhat.com>
|
||||
# Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
IF_RTLD=""
|
||||
IF_dynamic=""
|
||||
@@ -87,7 +83,7 @@ inst_library() {
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
local binpath="/bin /sbin /usr/bin /usr/sbin" p
|
||||
[[ -x $1 ]] && { echo $1; return 0; }
|
||||
[[ -z ${1##/*} && -x $1 ]] && { echo $1; return 0; }
|
||||
for p in $binpath; do
|
||||
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
|
||||
done
|
||||
@@ -111,11 +107,13 @@ inst_binary() {
|
||||
derror "dracut cannot create an initrd."
|
||||
exit 1
|
||||
fi
|
||||
[[ $line =~ ([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*) ]] || continue
|
||||
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
|
||||
[[ $line =~ $so_regex ]] || continue
|
||||
FILE=${BASH_REMATCH[1]}
|
||||
[[ -f ${initdir}$FILE ]] && continue
|
||||
# see if we are loading an optimized version of a shared lib.
|
||||
if [[ $FILE =~ ^(/lib[^/]*).* ]]; then
|
||||
lib_regex='^(/lib[^/]*).*'
|
||||
if [[ $FILE =~ $lib_regex ]]; then
|
||||
TLIBDIR=${BASH_REMATCH[1]}
|
||||
BASE="${FILE##*/}"
|
||||
# prefer nosegneg libs, then unoptimized ones.
|
||||
@@ -141,7 +139,8 @@ inst_script() {
|
||||
read -r -n 80 line <"$1"
|
||||
# If debug is set, clean unprintable chars to prevent messing up the term
|
||||
[[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]')
|
||||
[[ $line =~ (#! *)(/[^ ]+).* ]] || return 1
|
||||
shebang_regex='(#! *)(/[^ ]+).*'
|
||||
[[ $line =~ $shebang_regex ]] || return 1
|
||||
inst "${BASH_REMATCH[2]}" && inst_simple "$@"
|
||||
}
|
||||
|
||||
@@ -204,12 +203,25 @@ inst_hook() {
|
||||
}
|
||||
|
||||
dracut_install() {
|
||||
local optional=
|
||||
while (($# > 0)); do
|
||||
# Might be nice to optionally install a binary
|
||||
if [ "$1" == "-o" ]; then
|
||||
optional="yes"
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
if inst "$1" ; then
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
derror "Failed to install $1"; exit 1
|
||||
if [ "$optional" == "yes" ]; then
|
||||
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
|
||||
shift
|
||||
continue
|
||||
else
|
||||
derror "Failed to install $1"; exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -238,6 +250,10 @@ check_module_deps() {
|
||||
should_source_module() {
|
||||
local dep
|
||||
[[ -x $1/install ]] || return 1
|
||||
if [[ "$kernel_only" = "yes" ]]; then
|
||||
[[ -x $1/installkernel ]] && return 0
|
||||
return 1
|
||||
fi
|
||||
[[ -x $1/check ]] || return 0
|
||||
"$1/check" $hostonly || return 1
|
||||
for dep in $("$1/check" -d); do
|
||||
@@ -266,8 +282,8 @@ check_modules() {
|
||||
|
||||
# install kernel modules, and handle installing all their dependencies as well.
|
||||
instmods() {
|
||||
[[ "$no_kernel" = "yes" ]] && return
|
||||
local mod mpargs modpath modname cmd
|
||||
local srcmods="/lib/modules/$kernel/"
|
||||
while (($# > 0)); do
|
||||
mod=${1%.ko}
|
||||
case $mod in
|
||||
@@ -295,7 +311,7 @@ instmods() {
|
||||
[[ $hostonly ]] && ! grep -q "$mod" /proc/modules && {
|
||||
shift; continue;
|
||||
}
|
||||
modprobe $mpargs --ignore-install --set-version $kernel \
|
||||
modprobe $mpargs --ignore-install --set-version $kernel -d ${srcmods%%/lib/modules/*}/ \
|
||||
--show-depends $mod 2>/dev/null | \
|
||||
while read cmd modpath options; do
|
||||
[[ $cmd = insmod ]] || continue
|
||||
@@ -305,14 +321,20 @@ instmods() {
|
||||
dinfo "Installing dependencies for $mod ($modpath)"
|
||||
instmods $mpargs $modname
|
||||
fi
|
||||
inst_simple "$modpath"
|
||||
done
|
||||
for fw in $(modinfo -F firmware $mod 2>/dev/null); do
|
||||
if [[ -f /lib/firmware/$fw ]]; then
|
||||
inst_simple "/lib/firmware/$fw"
|
||||
else
|
||||
dwarning "Possible missing firmware /lib/firmware/${fw} for module ${mod}.ko"
|
||||
fi
|
||||
inst_simple "$modpath" "/lib/modules/$kernel/${modpath##*/lib/modules/$kernel/}"
|
||||
for fw in $(modinfo -k $kernel -F firmware $modpath 2>/dev/null); do
|
||||
unset found
|
||||
IFS=:
|
||||
for fwdir in $fw_dir; do
|
||||
if [ -d "$fwdir" -a -f $fwdir/$fw ]; then
|
||||
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
|
||||
found=yes
|
||||
fi
|
||||
done
|
||||
if [ "$found" != "yes" ]; then
|
||||
dwarning "Possible missing firmware ${fw} for module ${mod}.ko"
|
||||
fi
|
||||
done
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash --norc
|
||||
#
|
||||
#
|
||||
# Copyright 2005-2008 Red Hat, Inc. All rights reserved.
|
||||
# Copyright 2005-2009 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
|
||||
@@ -143,7 +142,7 @@ resolve_device_name() {
|
||||
# echo "resolve_device_name $1" 1>&2
|
||||
}
|
||||
|
||||
readlink() {
|
||||
freadlink() {
|
||||
/usr/bin/readlink -f "$1"
|
||||
}
|
||||
|
||||
@@ -183,11 +182,11 @@ finddevicedriverinsys () {
|
||||
}
|
||||
|
||||
findstoragedriverinsys () {
|
||||
local sysfs=$(readlink "$1")
|
||||
local sysfs=$(freadlink "$1")
|
||||
|
||||
# if its a partition look at the device holding the partition
|
||||
if [ -f "$sysfs/start" ]; then
|
||||
sysfs=$(readlink ${sysfs%/*})
|
||||
sysfs=$(freadlink ${sysfs%/*})
|
||||
fi
|
||||
|
||||
if [[ ! "$sysfs" =~ '^/sys/.*block/.*$' ]]; then
|
||||
@@ -216,7 +215,7 @@ findstoragedriverinsys () {
|
||||
done
|
||||
|
||||
if [ -L "$sysfs/device" ]; then
|
||||
qpushd $(readlink "$sysfs/device")
|
||||
qpushd $(freadlink "$sysfs/device")
|
||||
finddevicedriverinsys
|
||||
qpopd
|
||||
fi
|
||||
@@ -675,10 +674,26 @@ done
|
||||
. /etc/sysconfig/keyboard
|
||||
. /etc/sysconfig/i18n
|
||||
|
||||
for i in KEYBOARDTYPE KEYTABLE SYSFONT SYSFONTACM UNIMAP LANG; do
|
||||
for i in KEYTABLE SYSFONT SYSFONTACM UNIMAP LANG; do
|
||||
val=$(eval echo \$$i)
|
||||
[[ $val ]] && echo -n "$i=$val "
|
||||
done
|
||||
|
||||
if [ -n "$KEYBOARDTYPE" -a "$KEYBOARDTYPE" != "pc" ]; then
|
||||
echo -n "KEYBOARDTYPE=$KEYBOARDTYPE "
|
||||
fi
|
||||
|
||||
if [ -n "$rootdev" ]; then
|
||||
echo -n "root=$rootdev "
|
||||
fi
|
||||
|
||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
||||
theme=$(basename \
|
||||
$(dirname \
|
||||
$(readlink -f \
|
||||
/usr/share/plymouth/themes/default.plymouth)))
|
||||
[ -n "$theme" ] && echo -n "rd_plytheme=$theme "
|
||||
fi
|
||||
|
||||
echo
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
49
dracut.8
49
dracut.8
@@ -30,6 +30,24 @@ add a space-separated list of dracut modules.
|
||||
.BR \-d ", " \-\-drivers " \fILIST\fR"
|
||||
specify a space-separated list of kernel modules to include in the initramfs.
|
||||
.TP
|
||||
.BR \-k ", " \-\-kmoddir " \fI{DIR}\fR
|
||||
specify the directory, where to look for kernel modules
|
||||
.TP
|
||||
.BR " \-\-fwdir " \fI{DIR}\fR
|
||||
specify additional directory, where to look for firmwares
|
||||
.TP
|
||||
.BR \-\-kernel-only
|
||||
only install kernel drivers and firmware files
|
||||
.TP
|
||||
.BR \-\-no-kernel
|
||||
do not install kernel drivers and firmware files
|
||||
.TP
|
||||
.BR \-\-strip
|
||||
strip binaries in the initramfs (default)
|
||||
.TP
|
||||
.BR \-\-nostrip
|
||||
do not strip binaries in the initramfs
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
display help text and exit.
|
||||
.TP
|
||||
@@ -125,6 +143,9 @@ only activate the LUKS partitions with the given UUID
|
||||
.B rd_NO_MD
|
||||
disable MD RAID detection
|
||||
.TP
|
||||
.B rd_NO_MDIMSM
|
||||
no MD RAID for imsm/isw raids, use dmraid instead
|
||||
.TP
|
||||
.B rd_MD_UUID=<md uuid>
|
||||
only activate the raid sets with the given UUID
|
||||
|
||||
@@ -136,6 +157,11 @@ disable DM RAID detection
|
||||
.B rd_DM_UUID=<dmraid uuid>
|
||||
only activate the raid sets with the given UUID
|
||||
|
||||
.SH DASD
|
||||
.TP
|
||||
.B dasd=....
|
||||
same syntax as the kernel module parameter (s390 only)
|
||||
|
||||
.SH DHCP
|
||||
.TP
|
||||
.B root=dhcp
|
||||
@@ -166,7 +192,7 @@ This is supported by dracut but not recommended.
|
||||
|
||||
.SH iSCSI
|
||||
.TP
|
||||
.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
.B root=iscsi:[username:password[reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
protocol defaults to "6", LUN defaults to "0".
|
||||
|
||||
If the "servername" field is provided by BOOTP or DHCP, then that
|
||||
@@ -179,18 +205,16 @@ associated fields.
|
||||
http://tools.ietf.org/html/rfc4173
|
||||
|
||||
.TP
|
||||
.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
.B root=iscsi:[username:password[:reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
|
||||
.TP
|
||||
.B root=??? netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
|
||||
.B root=??? netroot=iscsi:[username:password[:reverse:password]@][<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
|
||||
multiple netroot options allow setting up multiple iscsi disks
|
||||
e.g.
|
||||
root=UUID=12424547 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
|
||||
.B not yet implemented
|
||||
.TP
|
||||
.B root=??? iscsi_initiator= iscsi_target_name= iscsi_target_ip= iscsi_target_port= iscsi_target_group= iscsi_username= iscsi_password= iscsi_in_username= iscsi_in_password=
|
||||
|
||||
.TP
|
||||
.B root=??? iscsi_firmware
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
@@ -209,13 +233,13 @@ This syntax is only usable in cases where you are directly mounting the volume a
|
||||
.TP bootdev=<interface>
|
||||
.B specify the network interface to boot from
|
||||
.TP
|
||||
.B ip=[dhcp|on|any]
|
||||
.B ip={dhcp|on|any}
|
||||
get ip from dhcp server from all interfaces. If root=dhcp, loop sequentially through all interfaces (eth0, eth1, ...) and use the first with a valid DHCP root-path.
|
||||
.TP
|
||||
.B ip=<interface>:[dhcp|on|any]
|
||||
.B ip=<interface>:{dhcp|on|any}
|
||||
get ip from dhcp server on a specific interface
|
||||
.TP
|
||||
.B ip=<client-IP-number>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|]
|
||||
.B ip=<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{none|off}
|
||||
explicit network configuration
|
||||
|
||||
.SH Misc
|
||||
@@ -226,13 +250,16 @@ do not load kernel module <drivername>
|
||||
.SH Debug
|
||||
.TP
|
||||
.B rdshell
|
||||
drop to a shell, if the imitramfs fails
|
||||
allow dropping to a shell, if root mounting fails
|
||||
.TP
|
||||
.B rdinitdebug
|
||||
set -x for the dracut shell
|
||||
.TP
|
||||
.B rdbreak=[pre-udev|pre-mount|mount|pre-pivot|]
|
||||
drop the shell on defined breakpoint
|
||||
.B rdbreak
|
||||
drop to a shell at the end
|
||||
.TP
|
||||
.B rdbreak={pre-udev|pre-mount|mount|pre-pivot|commandline|initqueue}
|
||||
drop to a shell on defined breakpoint
|
||||
.TP
|
||||
.B rdudevinfo
|
||||
set udev to loglevel info
|
||||
|
76
dracut.spec
76
dracut.spec
@@ -1,7 +1,7 @@
|
||||
%if 0%{?fedora} < 12
|
||||
%define with_switch_root 1
|
||||
%else
|
||||
%define with_switch_root 1
|
||||
%define with_switch_root 0
|
||||
%endif
|
||||
|
||||
%if %{defined gittag}
|
||||
@@ -12,7 +12,7 @@
|
||||
%endif
|
||||
|
||||
Name: dracut
|
||||
Version: 0.5
|
||||
Version: 0.8
|
||||
Release: 1%{?rdist}
|
||||
Summary: Initramfs generator using udev
|
||||
Group: System Environment/Base
|
||||
@@ -22,22 +22,26 @@ Source0: dracut-%{version}%{?dashgittag}.tar.bz2
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Requires: udev
|
||||
Requires: util-linux-ng
|
||||
Requires: module-init-tools
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: cpio
|
||||
Requires: coreutils
|
||||
Requires: findutils
|
||||
Requires: binutils
|
||||
Requires: grep
|
||||
Requires: mktemp
|
||||
Requires: which
|
||||
Requires: mktemp >= 1.5-5
|
||||
Requires: mount
|
||||
Requires: bash
|
||||
Requires: /bin/sh
|
||||
Requires: fileutils, grep, mount, gzip, tar, mktemp >= 1.5-5, findutils
|
||||
Requires: fileutils, gzip, tar
|
||||
Requires: lvm2 >= 2.02.33-9, dhclient
|
||||
Requires: filesystem >= 2.1.0, cpio, device-mapper, initscripts >= 8.63-1
|
||||
Requires: e2fsprogs >= 1.38-12, libselinux, libsepol, coreutils
|
||||
Requires: mdadm, elfutils-libelf, plymouth >= 0.7.0
|
||||
Requires: cryptsetup-luks
|
||||
Requires: bridge-utils
|
||||
Requires: file
|
||||
Requires: bzip2
|
||||
%ifnarch s390 s390x
|
||||
Requires: dmraid
|
||||
Requires: kbd
|
||||
@@ -51,25 +55,41 @@ BuildArch: noarch
|
||||
%description
|
||||
dracut is a new, event-driven initramfs infrastructure based around udev.
|
||||
|
||||
|
||||
%package generic
|
||||
Summary: Metapackage to build a generic initramfs
|
||||
Summary: Metapackage to build a generic initramfs with dracut
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: rpcbind nfs-utils
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: nbd
|
||||
Requires: net-tools iproute
|
||||
Requires: kernel-firmware
|
||||
Requires: plymouth-system-theme plymouth-theme-charge plymouth-theme-solar
|
||||
|
||||
%description generic
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with dracut.
|
||||
|
||||
%package kernel
|
||||
Summary: Metapackage to build generic initramfs with dracut with only kernel modules
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: ql2100-firmware
|
||||
Requires: ql2200-firmware
|
||||
Requires: ql23xx-firmware
|
||||
Requires: ql2400-firmware
|
||||
Requires: ql2500-firmware
|
||||
Requires: plymouth-system-theme plymouth-theme-charge plymouth-theme-solar
|
||||
|
||||
%description generic
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs.
|
||||
%description kernel
|
||||
This package requires everything which is needed to build a initramfs with all
|
||||
kernel modules and firmware files needed by dracut modules.
|
||||
|
||||
%package tools
|
||||
Summary: dracut tools to build the local initramfs
|
||||
Requires: coreutils cryptsetup-luks device-mapper
|
||||
Requires: diffutils dmraid findutils gawk grep lvm2
|
||||
Requires: module-init-tools sed
|
||||
Requires: cpio gzip
|
||||
|
||||
%description tools
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?dashgittag}
|
||||
@@ -86,6 +106,9 @@ make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin sysconfdir=/etc mandir=%{_man
|
||||
rm -f $RPM_BUILD_ROOT/sbin/switch_root
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
@@ -93,7 +116,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS
|
||||
/sbin/dracut
|
||||
/sbin/dracut-gencmdline
|
||||
%if 0%{?with_switch_root}
|
||||
/sbin/switch_root
|
||||
%endif
|
||||
@@ -107,15 +129,43 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README.generic
|
||||
|
||||
%files kernel
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README.kernel
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
/sbin/dracut-gencmdline
|
||||
/sbin/dracut-catimages
|
||||
%dir /boot/dracut
|
||||
%dir /var/lib/dracut
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%changelog
|
||||
* Thu Aug 06 2009 Harald Hoyer <harald@redhat.com> 0.8-1
|
||||
- version 0.8
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Jul 24 2009 Harald Hoyer <harald@redhat.com> 0.7-1
|
||||
- version 0.7
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Wed Jul 22 2009 Harald Hoyer <harald@redhat.com> 0.6-1
|
||||
- version 0.6
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Jul 17 2009 Harald Hoyer <harald@redhat.com> 0.5-1
|
||||
- version 0.5
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Sat Jul 04 2009 Harald Hoyer <harald@redhat.com> 0.4-1
|
||||
- version 0.4
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Thu Jul 02 2009 Harald Hoyer <harald@redhat.com> 0.3-1
|
||||
- version 0.3
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Wed Jul 01 2009 Harald Hoyer <harald@redhat.com> 0.2-1
|
||||
- version 0.2
|
||||
|
@@ -5,6 +5,7 @@ inst_key_val()
|
||||
[ -n "$value" ] && printf '%s="%s"\n' $1 $value >> $2
|
||||
initrdargs="$initrdargs $1"
|
||||
}
|
||||
|
||||
mkdir -p /etc/sysconfig
|
||||
inst_key_val KEYBOARDTYPE /etc/sysconfig/keyboard
|
||||
inst_key_val KEYTABLE /etc/sysconfig/keyboard
|
||||
@@ -12,3 +13,9 @@ inst_key_val SYSFONT /etc/sysconfig/i18n
|
||||
inst_key_val SYSFONTACM /etc/sysconfig/i18n
|
||||
inst_key_val UNIMAP /etc/sysconfig/i18n
|
||||
inst_key_val LANG /etc/sysconfig/i18n
|
||||
|
||||
if [ -f /etc/sysconfig/i18n ]; then
|
||||
. /etc/sysconfig/i18n
|
||||
export LANG
|
||||
fi
|
||||
|
||||
|
@@ -1,4 +1,19 @@
|
||||
#!/bin/sh
|
||||
which ip dhclient hostname brctl >/dev/null 2>&1 || exit 1
|
||||
|
||||
. $dracutfunctions
|
||||
|
||||
for program in ip hostname; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" required by network."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
for program in dhclient brctl; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" it might be required by network."
|
||||
fi
|
||||
done
|
||||
exit 255
|
||||
|
||||
|
@@ -7,7 +7,7 @@ setup_interface() {
|
||||
bcast=$new_broadcast_address
|
||||
gw=${new_routers%%,*}
|
||||
domain=$new_domain_name
|
||||
search=$new_domain_search
|
||||
search=$(printf "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
|
||||
@@ -23,12 +23,12 @@ setup_interface() {
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
|
||||
[ -n "${search}${domain}" ] && echo search $search $domain > /tmp/net.$netif.resolv.conf
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
fi >> /tmp/resolv.conf
|
||||
|
||||
[ -n "$hostname" ] && echo hostname $hostname > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
@@ -100,10 +100,8 @@ ip=$(getarg ip)
|
||||
|
||||
# Specific configuration, spin through the kernel command line
|
||||
# looking for ip= lines
|
||||
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
|
||||
for p in $CMDLINE; do
|
||||
[ -n "${p%ip=*}" ] && continue
|
||||
ip_to_var ${p#ip=}
|
||||
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
|
||||
|
@@ -1,22 +1,9 @@
|
||||
#!/bin/bash
|
||||
dracut_install ip dhclient hostname brctl
|
||||
# Include wired net drivers, excluding wireless
|
||||
for modname in $(find "/lib/modules/$kernel/kernel/drivers" -name '*.ko'); do
|
||||
if nm -uPA $modname | grep -q eth_type_trans; then
|
||||
if echo "$modname" | grep -q wireless; then
|
||||
continue
|
||||
else
|
||||
instmods $modname
|
||||
fi
|
||||
fi
|
||||
done
|
||||
inst "$moddir/ifup" "/sbin/ifup"
|
||||
inst "$moddir/netroot" "/sbin/netroot"
|
||||
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
|
||||
@@ -25,6 +12,6 @@ inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# TODO ifcfg config style is redhat specific, this should probably
|
||||
# go into its own module at one time
|
||||
inst_hook pre-pivot 20 "$moddir/write-ifcfg.sh"
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
|
||||
mkdir -p "${initdir}/var/run"
|
||||
|
14
modules.d/40network/installkernel
Executable file
14
modules.d/40network/installkernel
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Include wired net drivers, excluding wireless
|
||||
for modname in $(find "$srcmods/kernel/drivers" -name '*.ko'); do
|
||||
if nm -uPA $modname | egrep -q 'eth_type_trans|register_virtio_device'; then
|
||||
if echo "$modname" | egrep -q '/wireless/|/isdn/|/uwb/'; then
|
||||
continue
|
||||
else
|
||||
instmods $modname
|
||||
fi
|
||||
fi
|
||||
done
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
@@ -90,7 +90,7 @@ done
|
||||
|
||||
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
|
||||
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
|
||||
[ -e /tmp/net.$netif.resolv.conf ] && cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
|
||||
[ -e /tmp/resolv.conf ] && cp -f /tmp/resolv.conf /etc/resolv.conf
|
||||
|
||||
# Source netroot hooks before we start the handler
|
||||
source_all netroot
|
||||
|
@@ -37,6 +37,7 @@ unset bridgename ethname
|
||||
|
||||
# Parse bridge for bridgename and ethname
|
||||
if getarg bridge >/dev/null; then
|
||||
initrdargs="$initrdargs bridge"
|
||||
# Read bridge= parameters if they exist
|
||||
bridge="$(getarg bridge=)"
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
|
@@ -52,10 +52,9 @@ fi
|
||||
|
||||
# Count ip= lines to decide whether we need bootdev= or not
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
|
||||
local count=0
|
||||
for p in $CMDLINE; do
|
||||
[ "${p%%=*}" = "ip" ] && count=$(( $count + 1 ))
|
||||
for p in $(getargs ip=); do
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
@@ -68,11 +67,8 @@ fi
|
||||
|
||||
# Check ip= lines
|
||||
# XXX Would be nice if we could errorcheck ip addresses here as well
|
||||
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
|
||||
for p in $CMDLINE; do
|
||||
[ -n "${p%ip=*}" ] && continue
|
||||
|
||||
ip_to_var ${p#ip=}
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# We need to have an ip= line for the specified bootdev
|
||||
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
|
||||
@@ -85,28 +81,28 @@ for p in $CMDLINE; do
|
||||
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option '$p'";;
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off) \
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument '$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
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"
|
||||
;;
|
||||
dhcp|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, '$p' does not make sense for multiple interface configurations"
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument '$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument '$p'\nSorry, unknown value '$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 '$p'\nDuplication configurations for '$dev'"
|
||||
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
|
||||
done
|
||||
fi
|
||||
# IFACES list for later use
|
||||
|
@@ -1,47 +1,52 @@
|
||||
#!/bin/sh
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
udevadm settle --timeout=30
|
||||
# Don't write anything if we don't know our bootdev
|
||||
[ -f /tmp/net.ifaces ] || return 1
|
||||
|
||||
read IFACES < /tmp/net.ifaces
|
||||
|
||||
for netif in $IFACES ; do
|
||||
mkdir -p /tmp/ifcfg/
|
||||
# bridge?
|
||||
unset bridge
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
echo "# Generated by dracut initrd" > /tmp/net.$netif.ifcfg
|
||||
echo "DEVICE=$netif" >> /tmp/net.$netif.ifcfg
|
||||
echo "ONBOOT=yes" >> /tmp/net.$netif.ifcfg
|
||||
echo "# Generated by dracut initrd" > /tmp/ifcfg/ifcfg-$netif
|
||||
echo "DEVICE=$netif" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "ONBOOT=yes" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "NETBOOT=yes" >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
echo "BOOTPROTO=dhcp" >> /tmp/net.$netif.ifcfg
|
||||
echo "BOOTPROTO=dhcp" >> /tmp/ifcfg/ifcfg-$netif
|
||||
else
|
||||
echo "BOOTPROTO=none" >> /tmp/net.$netif.ifcfg
|
||||
echo "BOOTPROTO=none" >> /tmp/ifcfg/ifcfg-$netif
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
. /tmp/net.$netif.override
|
||||
echo "IPADDR=$ip" >> /tmp/net.$netif.ifcfg
|
||||
echo "NETMASK=$mask" >> /tmp/net.$netif.ifcfg
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw" >> /tmp/net.$netif.ifcfg
|
||||
echo "IPADDR=$ip" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "NETMASK=$mask" >> /tmp/ifcfg/ifcfg-$netif
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw" >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
# bridge needs differente things written to ifcfg
|
||||
if [ -z "$bridge" ]; then
|
||||
# standard interface
|
||||
echo "HWADDR=$(cat /sys/class/net/$netif/address)" >> /tmp/net.$netif.ifcfg
|
||||
echo "TYPE=Ethernet" >> /tmp/net.$netif.ifcfg
|
||||
echo "NAME=\"Boot Disk\"" >> /tmp/net.$netif.ifcfg
|
||||
echo "HWADDR=$(cat /sys/class/net/$netif/address)" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
else
|
||||
# bridge
|
||||
echo "TYPE=Bridge" >> /tmp/net.$netif.ifcfg
|
||||
echo "NAME=\"Boot Disk\"" >> /tmp/net.$netif.ifcfg
|
||||
echo "TYPE=Bridge" >> /tmp/ifcfg/ifcfg-$netif
|
||||
echo "NAME=\"Boot Disk\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
echo "DEVICE=$ethname" >> /tmp/net.$ethname.ifcfg
|
||||
echo "TYPE=Ethernet" >> /tmp/net.$ethname.ifcfg
|
||||
echo "ONBOOT=yes" >> /tmp/net.$ethname.ifcfg
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)" >> /tmp/net.$ethname.ifcfg
|
||||
echo "BRIDGE=$netif" >> /tmp/net.$ethname.ifcfg
|
||||
echo "NAME=$ethname" >> /tmp/net.$ethname.ifcfg
|
||||
echo "DEVICE=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "ONBOOT=yes" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "NETBOOT=yes" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "BRIDGE=$netif" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
echo "NAME=$ethname" >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
done
|
||||
|
@@ -5,7 +5,3 @@ inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
# Include KMS capable drm drivers
|
||||
for modname in $(find "/lib/modules/$kernel/kernel/drivers/gpu/drm" -name '*.ko'); do
|
||||
nm -uPA $modname | grep -q drm_crtc_init && instmods $modname
|
||||
done
|
||||
|
5
modules.d/50plymouth/installkernel
Executable file
5
modules.d/50plymouth/installkernel
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Include KMS capable drm drivers
|
||||
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" -name '*.ko'); do
|
||||
nm -uPA $modname | grep -q drm_crtc_init && instmods $modname
|
||||
done
|
@@ -42,6 +42,7 @@ else
|
||||
done
|
||||
for x in ${LIBDIR}/plymouth/*.so ; do
|
||||
[[ -f "$x" ]] || continue
|
||||
[[ "$x" != "${x%%/label.so}" ]] && continue
|
||||
dracut_install "$x"
|
||||
done
|
||||
(
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
# first trigger graphics and tty subsystem
|
||||
udevadm trigger --subsystem-match=graphics --subsystem-match=tty >/dev/null 2>&1
|
||||
udevadm trigger --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1
|
||||
|
||||
udevadm settle --timeout=30 2>&1 | vinfo
|
||||
[ -c /dev/zero ] || mknod /dev/zero c 1 5
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
inst cryptsetup
|
||||
instmods dm_crypt cbc aes sha256 xts
|
||||
inst_rules "$moddir/70-luks.rules"
|
||||
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
|
2
modules.d/90crypt/installkernel
Executable file
2
modules.d/90crypt/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods dm_crypt cbc aes sha256 xts
|
@@ -13,7 +13,7 @@ TEST=="/tmp/.dmraid_scan-%k", GOTO="dm_end"
|
||||
|
||||
RUN+="/bin/sh -c '>/tmp/.dmraid_scan-%k; /bin/ln -fs /sbin/dmraid_scan /initqueue/dmraid_scan.sh'"
|
||||
|
||||
ATTR{partition}!="?*", \
|
||||
RUN+="/sbin/partx -d $env{DEVNAME}"
|
||||
ENV{DEVTYPE}!="partition", \
|
||||
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
|
||||
LABEL="dm_end"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
dracut_install dmraid
|
||||
dracut_install dmraid partx
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
inst_rules 64-md-raid.rules
|
||||
inst_rules "$moddir/61-dmraid-imsm.rules"
|
||||
|
12
modules.d/90dmsquash-live/check
Executable file
12
modules.d/90dmsquash-live/check
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# if dmsetup is not installed, then we cannot support fedora/red hat
|
||||
# style live images
|
||||
which dmsetup >/dev/null 2>&1 || exit 1
|
||||
|
||||
# a live host-only image doesn't really make a lot of sense
|
||||
if [ "$1" = "-h" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
13
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
Normal file
13
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
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", RUN+="/sbin/initqueue --onetime /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --onetime /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
|
||||
) >> /etc/udev/rules.d/99-live-mount.rules
|
||||
fi
|
177
modules.d/90dmsquash-live/dmsquash-live-root
Executable file
177
modules.d/90dmsquash-live/dmsquash-live-root
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
[ -f /tmp/root.info ] && . /tmp/root.info
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
if getarg rdlivedebug; then
|
||||
exec > /tmp/liveroot.$$.out
|
||||
exec 2>> /tmp/liveroot.$$.out
|
||||
set -x
|
||||
fi
|
||||
|
||||
[ -z "$1" ] && exit 1
|
||||
livedev="$1"
|
||||
|
||||
# parse various live image specific options that make sense to be
|
||||
# specified as their own things
|
||||
live_dir=$(getarg live_dir)
|
||||
[ -z "$live_dir" ] && live_dir="LiveOS"
|
||||
getarg live_ram && live_ram="yes"
|
||||
getarg reset_overlay && reset_overlay="yes"
|
||||
overlay=$(getarg overlay)
|
||||
|
||||
# FIXME: we need to be able to hide the plymouth splash for the check really
|
||||
[ -e $livedev ] & fs=$(blkid -s TYPE -o value $livedev)
|
||||
if [ "$fs" == "iso9660" -o "$fs" = "udf" ]; then
|
||||
check="yes"
|
||||
fi
|
||||
getarg check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
checkisomd5 --verbose $livedev || :
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "CD check failed!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
getarg ro && liverw=ro
|
||||
getarg rw && liverw=rw
|
||||
[ -z "$liverw" ] && liverw=ro
|
||||
# mount the backing of the live image first
|
||||
mount -n -t $fstype -o $liverw $livedev $NEWROOT
|
||||
RES=$?
|
||||
if [ "$RES" != "0" ]; then
|
||||
echo "Failed to mount block device of live image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# overlay setup helper function
|
||||
do_live_overlay() {
|
||||
# create a sparse file for the overlay
|
||||
# overlay: if non-ram overlay searching is desired, do it,
|
||||
# otherwise, create traditional overlay in ram
|
||||
OVERLAY_LOOPDEV=$( losetup -f )
|
||||
|
||||
l=$(blkid -s LABEL -o value $livedev) || l=""
|
||||
u=$(blkid -s UUID -o value $livedev) || u=""
|
||||
|
||||
if [ -z "$overlay" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
elif ( echo $overlay | grep -q ":" ); then
|
||||
# pathspec specified, extract
|
||||
pathspec=$( echo $overlay | sed -e 's/^.*://' )
|
||||
fi
|
||||
|
||||
if [ -z "$pathspec" -o "$pathspec" == "auto" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
fi
|
||||
devspec=$( echo $overlay | sed -e 's/:.*$//' )
|
||||
|
||||
# need to know where to look for the overlay
|
||||
setup=""
|
||||
if [ -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
|
||||
mkdir /overlayfs
|
||||
mount -n -t auto $devspec /overlayfs || :
|
||||
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
|
||||
fi
|
||||
setup="yes"
|
||||
fi
|
||||
umount -l /overlayfs || :
|
||||
fi
|
||||
|
||||
if [ -z "$setup" ]; then
|
||||
if [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
echo "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
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
fi
|
||||
|
||||
# set up the snapshot
|
||||
echo 0 `blockdev --getsize $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create live-rw
|
||||
}
|
||||
|
||||
# live cd helper function
|
||||
do_live_from_base_loop() {
|
||||
do_live_overlay
|
||||
}
|
||||
|
||||
# we might have a genMinInstDelta delta file for anaconda to take advantage of
|
||||
if [ -e $NEWROOT/${live_dir}/osmin.img ]; then
|
||||
OSMINSQFS=$NEWROOT/${live_dir}/osmin.img
|
||||
fi
|
||||
|
||||
if [ -n "$OSMINSQFS" ]; then
|
||||
# decompress the delta data
|
||||
dd if=$OSMINSQFS of=/osmin.img 2> /dev/null
|
||||
OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
|
||||
losetup -r $OSMIN_SQUASHED_LOOPDEV /osmin.img
|
||||
mkdir -p /squashfs.osmin
|
||||
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /squashfs.osmin
|
||||
OSMIN_LOOPDEV=$( losetup -f )
|
||||
losetup -r $OSMIN_LOOPDEV /squashfs.osmin/osmin
|
||||
umount -l /squashfs.osmin
|
||||
fi
|
||||
|
||||
# we might have just an embedded ext3 to use as rootfs (uncompressed live)
|
||||
if [ -e $NEWROOT/${live_dir}/ext3fs.img ]; then
|
||||
EXT3FS="$NEWROOT/${live_dir}/ext3fs.img"
|
||||
fi
|
||||
|
||||
if [ -n "$EXT3FS" ] ; then
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
losetup -r $BASE_LOOPDEV $EXT3FS
|
||||
umount -l $NEWROOT
|
||||
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
|
||||
# we might have an embedded ext3 on squashfs to use as rootfs (compressed live)
|
||||
if [ -e $NEWROOT/${live_dir}/squashfs.img ]; then
|
||||
SQUASHED="$NEWROOT/${live_dir}/squashfs.img"
|
||||
fi
|
||||
|
||||
if [ -e "$SQUASHED" ] ; then
|
||||
if [ -n "$live_ram" ] ; then
|
||||
echo "Copying live image to RAM..."
|
||||
echo "(this may take a few minutes)"
|
||||
dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
|
||||
umount -n $NEWROOT
|
||||
echo "Done copying live image to RAM."
|
||||
eject -p $livedev || :
|
||||
SQUASHED="/squashed.img"
|
||||
fi
|
||||
|
||||
SQUASHED_LOOPDEV=$( losetup -f )
|
||||
losetup -r $SQUASHED_LOOPDEV $SQUASHED
|
||||
mkdir -p /squashfs
|
||||
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /squashfs
|
||||
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
losetup -r $BASE_LOOPDEV /squashfs/LiveOS/ext3fs.img
|
||||
|
||||
umount -l /squashfs
|
||||
if [ -z "$live_ram" ] ; then
|
||||
umount -l $NEWROOT
|
||||
fi
|
||||
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
|
||||
if [ -b "$OSMIN_LOOPDEV" ]; then
|
||||
# set up the devicemapper snapshot device, which will merge
|
||||
# the normal live fs image, and the delta, into a minimzied fs image
|
||||
echo "0 $( blockdev --getsize $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV p 8" | dmsetup create --readonly live-osimg-min
|
||||
fi
|
||||
|
||||
ln -s /dev/mapper/live-rw /dev/root
|
||||
printf '/bin/mount /dev/mapper/live-rw %s\n' "$NEWROOT" > /mount/01-$$-live.sh
|
||||
|
||||
exit 0
|
13
modules.d/90dmsquash-live/install
Executable file
13
modules.d/90dmsquash-live/install
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
inst dmsetup
|
||||
inst blkid
|
||||
inst dd
|
||||
inst losetup
|
||||
inst eject
|
||||
inst blockdev
|
||||
which checkisomd5 >/dev/null 2>&1 && inst checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
40
modules.d/90dmsquash-live/parse-dmsquash-live.sh
Executable file
40
modules.d/90dmsquash-live/parse-dmsquash-live.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
# live images are specified with
|
||||
# root=live:backingdev
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
# support legacy syntax of passing liveimg and then just the base root
|
||||
if getarg liveimg; then
|
||||
liveroot="live:$root"
|
||||
fi
|
||||
|
||||
if [ "${root%%:*}" = "live" ] ; then
|
||||
liveroot=$root
|
||||
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=}"
|
||||
rootok=1 ;;
|
||||
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=}"
|
||||
rootok=1 ;;
|
||||
/dev/*)
|
||||
root="live:${root}"
|
||||
rootok=1 ;;
|
||||
esac
|
||||
echo "root was $root, liveroot is now $liveroot"
|
||||
|
||||
|
||||
# make sure that init doesn't complain
|
||||
[ -z "$root" ] && root="live"
|
@@ -1,13 +1,3 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$drivers" ]; then
|
||||
drivers="sd_mod =fs"
|
||||
# Include block controller drivers
|
||||
for modname in $(find "/lib/modules/$kernel/kernel/drivers" -name '*.ko'); do
|
||||
if nm -uPA $modname | egrep -q 'ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register'; then
|
||||
drivers="${drivers} $modname"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
instmods $drivers
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
|
||||
|
18
modules.d/90kernel-modules/installkernel
Executable file
18
modules.d/90kernel-modules/installkernel
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$drivers" ]; then
|
||||
drivers="sd_mod =fs"
|
||||
# Include block controller drivers
|
||||
blockfuncs='ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
|
||||
for modname in $(find "$srcmods/kernel/drivers" -name '*.ko'); do
|
||||
if nm -uPA $modname | egrep -q "$blockfuncs"; then
|
||||
drivers="${drivers} $modname"
|
||||
fi
|
||||
done
|
||||
instmods $drivers
|
||||
# hardcoded list of exceptions
|
||||
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
|
||||
else
|
||||
instmods $drivers
|
||||
fi
|
||||
|
||||
|
@@ -15,8 +15,11 @@ IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
|
||||
|
||||
LABEL="do_md_inc"
|
||||
|
||||
RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}", RUN+="/bin/sh -c '>/tmp/.mdraid_start-%k; /bin/ln -s /sbin/mdraid_start /initqueue/mdraid_start.sh'"
|
||||
ENV{DEVTYPE}!="partition", \
|
||||
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
|
||||
ATTR{partition}!="?*", RUN+="/sbin/partx -d $env{DEVNAME}"
|
||||
RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}"
|
||||
|
||||
RUN+="/bin/sh -c '>/tmp/.mdraid_start-%k; /bin/ln -s /sbin/mdraid_start /initqueue/mdraid_start.sh'"
|
||||
|
||||
LABEL="md_inc_end"
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#!/bin/bash
|
||||
dracut_install mdadm
|
||||
|
||||
dracut_install mdadm partx
|
||||
|
||||
|
||||
# XXX: mdmon really needs to run as non-root?
|
||||
# If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group)
|
||||
# in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
|
||||
@@ -8,8 +11,6 @@ dracut_install mdadm
|
||||
# inst /etc/passwd
|
||||
# inst /etc/group
|
||||
|
||||
instmods =drivers/md
|
||||
|
||||
if [ -x /lib/udev/vol_id ]; then
|
||||
inst_rules "$moddir/61-mdadm.rules"
|
||||
else
|
||||
@@ -22,7 +23,6 @@ if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
|
||||
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
|
||||
fi
|
||||
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
[ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf
|
||||
|
3
modules.d/90mdraid/installkernel
Executable file
3
modules.d/90mdraid/installkernel
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
instmods =drivers/md
|
||||
|
@@ -12,7 +12,7 @@ else
|
||||
[ -e "$f" ] || continue
|
||||
mv $f ${f}.bak
|
||||
while read line; do
|
||||
if [ "${line/UUID CHECK//}" != "$line" ]; then
|
||||
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
|
||||
done;
|
||||
@@ -29,4 +29,4 @@ fi
|
||||
if getarg rd_NO_MDIMSM; then
|
||||
info "rd_NO_MDIMSM: no MD RAID for imsm/isw raids"
|
||||
udevadm control --property=rd_NO_MDIMSM=1
|
||||
fi
|
||||
fi
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
dracut_install ps grep more cat rm strace free showmount
|
||||
dracut_install ping netstat rpcinfo
|
||||
dracut_install -o ps grep more cat rm strace free showmount
|
||||
dracut_install -o ping netstat rpcinfo
|
||||
|
@@ -6,4 +6,3 @@ inst iscsi-iname
|
||||
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
|
||||
inst "$moddir/iscsiroot" "/sbin/iscsiroot"
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
instmods iscsi_tcp crc32c
|
||||
|
2
modules.d/95iscsi/installkernel
Executable file
2
modules.d/95iscsi/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods iscsi_tcp crc32c iscsi_ibft
|
@@ -28,23 +28,29 @@ fi
|
||||
|
||||
# root is in the form root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
netif="$1"
|
||||
root="$2"
|
||||
iroot="$2"
|
||||
|
||||
# read static conf settings
|
||||
for conf in conf/conf.d/*; do
|
||||
[ -f ${conf} ] && . ${conf}
|
||||
done
|
||||
source_all /etc/conf.d
|
||||
|
||||
# If it's not iscsi we don't continue
|
||||
[ "${root%%:*}" = "iscsi" ] || exit 1
|
||||
[ "${iroot%%:*}" = "iscsi" ] || exit 1
|
||||
|
||||
iroot=${iroot#iscsi:}
|
||||
|
||||
# XXX modprobe crc32c should go in the cmdline parser, but I haven't yet
|
||||
# figured out a way how to check whether this is built-in or not
|
||||
modprobe crc32c
|
||||
|
||||
|
||||
[ -e /tmp/root.info ] && . /tmp/root.info
|
||||
|
||||
if getarg iscsi_firmware ; then
|
||||
iscsistart -b
|
||||
exit 0
|
||||
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
|
||||
fi
|
||||
iscsistart -b
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# override conf settings by command line options
|
||||
@@ -67,15 +73,27 @@ arg=$(getarg iscsi_in_username)
|
||||
arg=$(getarg iscsi_in_password)
|
||||
[ -n "$arg" ] && iscsi_in_password=$arg
|
||||
|
||||
if [ $root = ${root#iscsi:} ]; then
|
||||
iroot=$(getarg iscsiroot)
|
||||
else
|
||||
iroot=${root#iscsi:}
|
||||
fi
|
||||
|
||||
# override conf/commandline options by dhcp root_path
|
||||
# FIXME this assumes that all values have been provided
|
||||
OLDIFS="$IFS"
|
||||
IFS=@
|
||||
set $iroot
|
||||
if [ $# -gt 1 ]; then
|
||||
authinfo=$1; shift
|
||||
iroot=$*
|
||||
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
|
||||
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
|
||||
if [ -n "$authinfo" ]; then
|
||||
IFS=:
|
||||
set $authinfo
|
||||
iscsi_username=$1
|
||||
iscsi_password=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
iscsi_in_username=$3
|
||||
iscsi_in_password=$4
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
IFS=:
|
||||
set $iroot
|
||||
iscsi_target_ip=$1; shift
|
||||
|
@@ -53,6 +53,7 @@ fi
|
||||
# iscsi_firmware does not need argument checking
|
||||
if [ -n "$iscsi_firmware" ] ; then
|
||||
netroot=${netroot:-iscsi}
|
||||
modprobe iscsi_ibft
|
||||
fi
|
||||
|
||||
# If it's not iscsi we don't continue
|
||||
|
@@ -9,4 +9,3 @@ else
|
||||
fi
|
||||
|
||||
inst "$moddir/nbdroot" "/sbin/nbdroot"
|
||||
instmods nbd
|
||||
|
2
modules.d/95nbd/installkernel
Executable file
2
modules.d/95nbd/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods nbd
|
@@ -14,9 +14,18 @@ else
|
||||
fi
|
||||
|
||||
dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap*.so* 2>/dev/null )
|
||||
dracut_install $(ls {/usr,}$LIBDIR/libnss*.so 2>/dev/null)
|
||||
|
||||
instmods nfs sunrpc ipv6
|
||||
nsslibs=$(for j in $(for i in \
|
||||
$(egrep -v '^#.*' /etc/nsswitch.conf|cut -f2 -d :\
|
||||
|fgrep -v NOTFOUND); do \
|
||||
echo "libnss_${i}.so";\
|
||||
done|sort -u); do \
|
||||
echo -n "|$j";\
|
||||
done)
|
||||
nsslibs=${nsslibs##|}
|
||||
|
||||
dracut_install $(for i in $(ls {/usr,}$LIBDIR/libnss*.so 2>/dev/null); do echo $i;done | egrep "$nsslibs")
|
||||
|
||||
inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
|
||||
inst_hook pre-pivot 70 "$moddir/nfsroot-cleanup.sh"
|
||||
inst "$moddir/nfsroot" "/sbin/nfsroot"
|
||||
|
2
modules.d/95nfs/installkernel
Executable file
2
modules.d/95nfs/installkernel
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
instmods nfs sunrpc ipv6
|
@@ -1,3 +1,6 @@
|
||||
[ -f /tmp/nfs.rpc_pipefs_path ] && rpcpipefspath=`cat /tmp/nfs.rpc_pipefs_path`
|
||||
[ -z "$rpcpipefspath" ] && rpcpipefspath=var/lib/nfs/rpc_pipefs
|
||||
|
||||
pid=$(pidof rpc.statd)
|
||||
[ -n "$pid" ] && kill $pid
|
||||
|
||||
@@ -9,10 +12,10 @@ pid=$(pidof rpcbind)
|
||||
|
||||
if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
|
||||
# try to create the destination directory
|
||||
[ -d $NEWROOT/var/lib/nfs/rpc_pipefs ] || mkdir -p $NEWROOT/var/lib/nfs/rpc_pipefs 2>/dev/null
|
||||
[ -d $NEWROOT/$rpcpipefspath ] || mkdir -p $NEWROOT/$rpcpipefspath 2>/dev/null
|
||||
|
||||
if [ -d $NEWROOT/var/lib/nfs/rpc_pipefs ]; then
|
||||
mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/var/lib/nfs/rpc_pipefs
|
||||
if [ -d $NEWROOT/$rpcpipefspath ]; then
|
||||
mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
|
||||
else
|
||||
umount /var/lib/nfs/rpc_pipefs
|
||||
fi
|
||||
|
5
modules.d/95s390/check
Executable file
5
modules.d/95s390/check
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
arch=$(arch)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1
|
||||
|
||||
exit 0
|
3
modules.d/95s390/install
Executable file
3
modules.d/95s390/install
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
inst_hook cmdline 30 "$moddir/parse-s390.sh"
|
||||
|
5
modules.d/95s390/installkernel
Executable file
5
modules.d/95s390/installkernel
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
instmods dasd_mod dasd_eckd_mod dasd_fba_mod \
|
||||
zfcp
|
||||
|
9
modules.d/95s390/parse-s390.sh
Executable file
9
modules.d/95s390/parse-s390.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
initrdargs="$initrdargs dasd"
|
||||
|
||||
[ -d /etc/modprobe.d ] || mkdir /etc/modprobe.d
|
||||
|
||||
dasd_arg=$(getarg dasd=)
|
||||
if [ -n "$dasd_arg" ]; then
|
||||
echo "option dasd_mod dasd=$dasd_arg" >> /etc/modprobe.d/dasd.conf
|
||||
fi
|
||||
unset dasd_arg
|
@@ -1,3 +1,8 @@
|
||||
#!/bin/bash
|
||||
# terminfo bits make things work better if you fall into interactive mode
|
||||
dracut_install $(find /lib/terminfo -type f)
|
||||
TERMINFODIR="/lib/terminfo"
|
||||
|
||||
[ ! -d ${TERMINFODIR} -a -d "/etc/terminfo" ] && \
|
||||
TERMINFODIR="/etc/terminfo"
|
||||
|
||||
dracut_install $(find ${TERMINFODIR} -type f)
|
||||
|
@@ -1,6 +1,10 @@
|
||||
getarg() {
|
||||
local o line
|
||||
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
|
||||
if [ -z "$CMDLINE" ]; then
|
||||
[ -f /etc/cmdline ] && read CMDLINE_ETC </etc/cmdline;
|
||||
read CMDLINE </proc/cmdline;
|
||||
CMDLINE="$CMDLINE $CMDLINE_ETC"
|
||||
fi
|
||||
for o in $CMDLINE; do
|
||||
[ "$o" = "$1" ] && return 0
|
||||
[ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
|
||||
@@ -10,7 +14,11 @@ getarg() {
|
||||
|
||||
getargs() {
|
||||
local o line found
|
||||
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
|
||||
if [ -z "$CMDLINE" ]; then
|
||||
[ -f /etc/cmdline ] && read CMDLINE_ETC </etc/cmdline;
|
||||
read CMDLINE </proc/cmdline;
|
||||
CMDLINE="$CMDLINE $CMDLINE_ETC"
|
||||
fi
|
||||
for o in $CMDLINE; do
|
||||
[ "$o" = "$1" ] && return 0
|
||||
if [ "${o%%=*}" = "${1%=}" ]; then
|
||||
@@ -28,6 +36,12 @@ source_all() {
|
||||
for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
|
||||
}
|
||||
|
||||
source_conf() {
|
||||
local f
|
||||
[ "$1" ] && [ -d "/$1" ] || return
|
||||
for f in "/$1"/*.conf; do [ -f "$f" ] && . "$f"; done
|
||||
}
|
||||
|
||||
die() {
|
||||
{
|
||||
echo "<1>dracut: FATAL: $@";
|
||||
|
@@ -59,6 +59,8 @@ mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1
|
||||
|
||||
UDEVVERSION=$(udevadm --version)
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
# run scriptlets to parse the command line
|
||||
getarg 'rdbreak=cmdline' && emergency_shell "Break before cmdline"
|
||||
source_all cmdline
|
||||
@@ -210,7 +212,7 @@ initrdargs="$initrdargs console BOOT_IMAGE rdbreak rdinitdebug rdudevinfo rdudev
|
||||
|
||||
for x in "$@"; do
|
||||
for s in $initrdargs; do
|
||||
[ "${x%%=*}" = $s ] && continue 1
|
||||
[ "${x%%=*}" = $s ] && continue 2
|
||||
done
|
||||
initargs="$initargs $x"
|
||||
done
|
||||
@@ -221,6 +223,8 @@ if getarg rdcopystate; then
|
||||
cp /tmp/* /dev/.initramfs/ >/dev/null 2>&1
|
||||
else
|
||||
cp /tmp/net.* /dev/.initramfs/ >/dev/null 2>&1
|
||||
cp /tmp/resolv.conf /dev/.initramfs/ >/dev/null 2>&1
|
||||
cp -a /tmp/ifcfg/ /dev/.initramfs/ >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
exec switch_root "$NEWROOT" "$INIT" $initargs || {
|
||||
|
@@ -1,10 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if getarg rdblacklist= >/dev/null ; then
|
||||
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
|
||||
for p in $CMDLINE; do
|
||||
[ -n "${p%rdblacklist=*}" ] && continue
|
||||
|
||||
echo "blacklist ${p#rdblacklist=}" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
done
|
||||
fi
|
||||
for p in $(getargs rdblacklist=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
done
|
||||
|
Reference in New Issue
Block a user