Compare commits
156 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
19d69051a3 | ||
![]() |
31737a05e1 | ||
![]() |
1161f03777 | ||
![]() |
cf24ac8c19 | ||
![]() |
af3ef92a6b | ||
![]() |
c46cda8260 | ||
![]() |
34bd2be23f | ||
![]() |
c3dd68fcf1 | ||
![]() |
3e35441f18 | ||
![]() |
dde2db3da9 | ||
![]() |
cbc21754e5 | ||
![]() |
eb2dc8c34b | ||
![]() |
c4e098a514 | ||
![]() |
72875215a3 | ||
![]() |
335bc217b3 | ||
![]() |
510aecdbd8 | ||
![]() |
9dd9d81fc6 | ||
![]() |
a5b48ce798 | ||
![]() |
59afbd8e73 | ||
![]() |
348baca3e4 | ||
![]() |
83691c413f | ||
![]() |
ca36b9b8f8 | ||
![]() |
a9c7dc74c4 | ||
![]() |
ce862de624 | ||
![]() |
500861cd05 | ||
![]() |
44d26d9209 | ||
![]() |
35270e34d0 | ||
![]() |
fe654ff0aa | ||
![]() |
5e1e1ec060 | ||
![]() |
2673ff1932 | ||
![]() |
e8f7ea6794 | ||
![]() |
3899211bfc | ||
![]() |
6e0c1c448d | ||
![]() |
6ae68b4674 | ||
![]() |
41eba87b32 | ||
![]() |
a1084c02fd | ||
![]() |
5ac8420abc | ||
![]() |
24d009507f | ||
![]() |
e9020221a7 | ||
![]() |
b59e9e5724 | ||
![]() |
b5859d6359 | ||
![]() |
dbfaae0e34 | ||
![]() |
8d85429a44 | ||
![]() |
3e4ab73cd4 | ||
![]() |
4e32b2e916 | ||
![]() |
356333b331 | ||
![]() |
f62f3a2191 | ||
![]() |
389333396a | ||
![]() |
cfb7410cd0 | ||
![]() |
f672b1c399 | ||
![]() |
f12f694355 | ||
![]() |
9a9c6e1256 | ||
![]() |
9c65c125a9 | ||
![]() |
7d4d3f8da6 | ||
![]() |
569ffe77bf | ||
![]() |
a42b2b8133 | ||
![]() |
31ba4de21d | ||
![]() |
a005c47763 | ||
![]() |
5db6ca5a4b | ||
![]() |
1a6fdf2417 | ||
![]() |
27a2c3a406 | ||
![]() |
b347edfa23 | ||
![]() |
3ed09d970e | ||
![]() |
a28e2aeefe | ||
![]() |
c6a71c7b8a | ||
![]() |
6ecb9a2d68 | ||
![]() |
918a6874df | ||
![]() |
2663232a01 | ||
![]() |
cebab07e68 | ||
![]() |
a04f3077cd | ||
![]() |
04b873598b | ||
![]() |
22137f9cac | ||
![]() |
54665349ec | ||
![]() |
f251a89772 | ||
![]() |
fbdfa57746 | ||
![]() |
6b095274fb | ||
![]() |
11174408e8 | ||
![]() |
c2117747fd | ||
![]() |
4f6e293308 | ||
![]() |
d9076cac19 | ||
![]() |
ff52ca1b57 | ||
![]() |
8a3c4957fc | ||
![]() |
3f54a83ca8 | ||
![]() |
7fa3b9e376 | ||
![]() |
39135af155 | ||
![]() |
02640e8e65 | ||
![]() |
579f385384 | ||
![]() |
56d60c4b2d | ||
![]() |
62fd2b3644 | ||
![]() |
cd9072d342 | ||
![]() |
19bab59c48 | ||
![]() |
d8b627b9dc | ||
![]() |
6320d072a1 | ||
![]() |
7abeb49878 | ||
![]() |
14fcfbec3e | ||
![]() |
fa9f15e3be | ||
![]() |
ae4758ce0d | ||
![]() |
66f01450a8 | ||
![]() |
e5786ed1b7 | ||
![]() |
b47517140b | ||
![]() |
3de6001e1e | ||
![]() |
c8d685c9d3 | ||
![]() |
d6d3173916 | ||
![]() |
8b6bf0ef57 | ||
![]() |
7bd8f23303 | ||
![]() |
a08ea34aba | ||
![]() |
6cb77ea91f | ||
![]() |
c586b033a7 | ||
![]() |
a9f634f815 | ||
![]() |
551c2dd71f | ||
![]() |
ffc4f173b6 | ||
![]() |
ebd1d65a1b | ||
![]() |
5b68300899 | ||
![]() |
2b6dd6a1fc | ||
![]() |
1d22c670b0 | ||
![]() |
0ae480dcbf | ||
![]() |
256cba18c3 | ||
![]() |
e6fcec9173 | ||
![]() |
1db3d2615d | ||
![]() |
5204d1d36d | ||
![]() |
3fa59d171d | ||
![]() |
d7264a3cc0 | ||
![]() |
9078167927 | ||
![]() |
3bd7fba7af | ||
![]() |
b455451f49 | ||
![]() |
efa5eb424d | ||
![]() |
3baa150bd4 | ||
![]() |
43cc4d84bc | ||
![]() |
6b84015e67 | ||
![]() |
60bbb8fcc9 | ||
![]() |
16c84f2873 | ||
![]() |
579238a3ac | ||
![]() |
2b5cd3dbf8 | ||
![]() |
3d8a164d0e | ||
![]() |
00ae54f00a | ||
![]() |
488d55c546 | ||
![]() |
9d6165f235 | ||
![]() |
2258f00e91 | ||
![]() |
2bac2d6d76 | ||
![]() |
b6b895bab5 | ||
![]() |
fdeae2a3ac | ||
![]() |
040f388331 | ||
![]() |
7990578443 | ||
![]() |
528ae4f46c | ||
![]() |
0fb7b847c5 | ||
![]() |
a67a6f957d | ||
![]() |
965edeb63b | ||
![]() |
329bbd797f | ||
![]() |
065fc56ab2 | ||
![]() |
64d144aece | ||
![]() |
2d9b156e9e | ||
![]() |
2b9be6f707 | ||
![]() |
b26897fb60 | ||
![]() |
8bf25df640 | ||
![]() |
e743cfdd4b | ||
![]() |
636e5cd2d5 |
16
50-dracut.install
Executable file
16
50-dracut.install
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
ret=0
|
||||
case "$1" in
|
||||
add)
|
||||
dracut "$3"/initrd "$2"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
rm -f "$3"/initrd
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
8
Makefile
8
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=024
|
||||
VERSION=026
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
-include Makefile.inc
|
||||
@@ -24,10 +24,11 @@ man8pages = dracut.8 \
|
||||
mkinitrd.8 \
|
||||
modules.d/98systemd/dracut-cmdline.service.8 \
|
||||
modules.d/98systemd/dracut-initqueue.service.8 \
|
||||
modules.d/98systemd/dracut-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-mount.service.8 \
|
||||
modules.d/98systemd/dracut-pre-pivot.service.8 \
|
||||
modules.d/98systemd/dracut-pre-trigger.service.8 \
|
||||
modules.d/98systemd/dracut-pre-udev.service.8 \
|
||||
modules.d/98systemd/initrd-switch-root.service.8 \
|
||||
modules.d/98systemd/udevadm-cleanup-db.service.8
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
@@ -91,6 +92,7 @@ install: dracut-version.sh
|
||||
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
|
||||
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
|
||||
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
|
||||
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
|
||||
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
@@ -114,6 +116,8 @@ endif
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
fi
|
||||
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
|
||||
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
|
||||
|
||||
dracut-version.sh:
|
||||
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
|
||||
|
42
NEWS
42
NEWS
@@ -1,3 +1,45 @@
|
||||
dracut-026
|
||||
==========
|
||||
- introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
|
||||
|
||||
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
|
||||
filenames in /etc/dracut.conf.d.
|
||||
|
||||
Packages should use /usr/lib/dracut/dracut.conf.d rather than
|
||||
/etc/dracut.conf.d for drop-in configuration files.
|
||||
|
||||
/etc/dracut.conf and /etc/dracut.conf.d belong to the system administrator.
|
||||
|
||||
- uses systemd-198 native initrd units
|
||||
- totally rely on the fstab-generator in systemd mode for block devices
|
||||
- dracut systemd now uses dracut.target rather than basic.target
|
||||
- dracut systemd services optimize themselves away
|
||||
- fixed hostonly parameter generation
|
||||
- turn off curl globbing (fixes IPv6)
|
||||
- modify the udev rules on install and not runtime time
|
||||
- enable initramfs building without kernel modules (fixed regression)
|
||||
- in the initqueue/timeout,
|
||||
reset the main loop counter, as we see new udev events or initqueue/work
|
||||
- fixed udev rule installation
|
||||
|
||||
dracut-025
|
||||
==========
|
||||
- do not strip signed kernel modules
|
||||
- add sosreport script and generate /run/initramfs/sosreport.txt
|
||||
- make short uuid specification for allow-discards work
|
||||
- turn off RateLimit for the systemd journal
|
||||
- fixed MAC address assignment
|
||||
- add systemd checkisomd5 service
|
||||
- splitout drm kernel modules from plymouth module
|
||||
- add 'swapoff' to initramfs to fix shutdown/reboot
|
||||
- add team device support
|
||||
- add pre-shutdown hook
|
||||
- kill all processes in shutdown and report remaining ones
|
||||
- "--device" changed to "--add-device" and "add_device=" added for conf files
|
||||
- add memory usage trace to different hook points
|
||||
- cope with optional field #7 in /proc/self/mountinfo
|
||||
- lots of small bugfixes
|
||||
|
||||
dracut-024
|
||||
==========
|
||||
- new dracut option "--device"
|
||||
|
3
TODO
3
TODO
@@ -7,7 +7,6 @@ Items are ordered in priority.
|
||||
INITRAMFS TODO
|
||||
|
||||
- use info and warn prefix
|
||||
- add sosreport
|
||||
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
|
||||
- put "root=" parsing hooks in separate hook dir
|
||||
- call "root=" parsing hooks after getting new rootpath from dhcp
|
||||
@@ -20,10 +19,10 @@ INITRAMFS TODO
|
||||
- disable write-ifcfg https://bugzilla.redhat.com/show_bug.cgi?id=840784
|
||||
- check for /var to be mounted in convertfs https://bugzilla.redhat.com/show_bug.cgi?id=848172
|
||||
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
|
||||
- iscsi livecd boot
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
- add presets (predefined set of modules)
|
||||
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
|
||||
- provide "installkernel" and "new-kernel-pkg"
|
||||
- add mechanism for module specific command line options
|
||||
|
@@ -106,10 +106,18 @@ fi
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot "
|
||||
hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
|
||||
hookdirs+="pre-mount pre-pivot cleanup mount "
|
||||
hookdirs+="emergency shutdown-emergency shutdown "
|
||||
hookdirs+="emergency shutdown-emergency pre-shutdown shutdown "
|
||||
export hookdirs
|
||||
}
|
||||
|
||||
dracut_need_initqueue() {
|
||||
>"$initdir/lib/dracut/need-initqueue"
|
||||
}
|
||||
|
||||
dracut_module_included() {
|
||||
strstr "$mods_to_load $modules_loaded" "$@"
|
||||
}
|
||||
|
||||
# Create all subdirectories for given path without creating the last element.
|
||||
# $1 = path
|
||||
mksubdirs() { [[ -e ${1%/*} ]] || mkdir -m 0755 -p ${1%/*}; }
|
||||
@@ -311,10 +319,17 @@ get_maj_min() {
|
||||
# $ find_block_device /usr
|
||||
# 8:4
|
||||
find_block_device() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
|
||||
_find_mpt="$1"
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_mpt = $1 ]] || continue
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
@@ -332,7 +347,7 @@ find_block_device() {
|
||||
while read _dev _mpt _fs _x; do
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
|
||||
if [[ $_mpt = $1 ]]; then
|
||||
if [[ $_mpt = $_find_mpt ]]; then
|
||||
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
|
||||
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
|
||||
@@ -355,16 +370,40 @@ find_block_device() {
|
||||
# $ 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
|
||||
[[ $_dev = $1 ]] || continue
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_dev
|
||||
_find_dev="$1"
|
||||
strstr "$_find_dev" "/dev" || _find_dev="/dev/block/$_find_dev"
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
strstr "$_dev" "/dev" || continue
|
||||
[[ $_dev -ef $_find_dev ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[[ $_dev = $1 ]] || continue
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
case "$_dev" in
|
||||
LABEL=*)
|
||||
_dev="$(echo $_dev | sed 's,/,\\x2f,g')"
|
||||
_dev="/dev/disk/by-label/${_dev#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
_dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
|
||||
;;
|
||||
esac
|
||||
|
||||
[[ $_dev -ef $_find_dev ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
@@ -381,16 +420,25 @@ find_dev_fstype() {
|
||||
# $ find_mp_fstype /;echo
|
||||
# ext4
|
||||
find_mp_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min
|
||||
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
|
||||
[[ $_mpt = $1 ]] || continue
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
|
||||
_find_mpt="$1"
|
||||
while read _x; do
|
||||
set -- $_x
|
||||
_majmin="$3"
|
||||
_mpt="$5"
|
||||
[[ $8 = "-" ]] && shift
|
||||
_fs="$8"
|
||||
_dev="$9"
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /proc/self/mountinfo
|
||||
|
||||
# fall back to /etc/fstab
|
||||
while read _dev _mpt _fs _x; do
|
||||
[[ $_mpt = $1 ]] || continue
|
||||
[ "${_dev%%#*}" != "$_dev" ] && continue
|
||||
[[ $_mpt = $_find_mpt ]] || continue
|
||||
echo -n $_fs;
|
||||
return 0;
|
||||
done < /etc/fstab
|
||||
@@ -830,7 +878,7 @@ inst_rule_programs() {
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
@@ -845,7 +893,7 @@ inst_rule_programs() {
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
@@ -860,7 +908,7 @@ inst_rule_programs() {
|
||||
_bin=""
|
||||
if [ -x ${udevdir}/$_prog ]; then
|
||||
_bin=${udevdir}/$_prog
|
||||
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
|
||||
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
|
||||
_bin=$(find_binary "$_prog") || {
|
||||
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
|
||||
continue;
|
||||
@@ -892,6 +940,12 @@ inst_rule_group_owner() {
|
||||
fi
|
||||
}
|
||||
|
||||
inst_rule_initqueue() {
|
||||
if grep -q -F initqueue "$1"; then
|
||||
dracut_need_initqueue
|
||||
fi
|
||||
}
|
||||
|
||||
# udev rules always get installed in the same place, so
|
||||
# create a function to install them to make life simpler.
|
||||
inst_rules() {
|
||||
@@ -900,12 +954,13 @@ inst_rules() {
|
||||
inst_dir "${udevdir}/rules.d"
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
if [ "${rule#/}" = "$rule" ]; then
|
||||
if [ "${_rule#/}" = "$_rule" ]; then
|
||||
for r in ${udevdir}/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_rule_initqueue "$_found"
|
||||
inst_simple "$_found"
|
||||
fi
|
||||
done
|
||||
@@ -915,6 +970,7 @@ inst_rules() {
|
||||
_found="${r}$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
inst_rule_initqueue "$_found"
|
||||
inst_simple "$_found" "$_target/${_found##*/}"
|
||||
fi
|
||||
done
|
||||
@@ -922,6 +978,33 @@ inst_rules() {
|
||||
done
|
||||
}
|
||||
|
||||
prepare_udev_rules() {
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
|
||||
for f in "$@"; do
|
||||
f="${initdir}/etc/udev/rules.d/$f"
|
||||
[ -e "$f" ] || continue
|
||||
while read line; do
|
||||
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 174 ]; then
|
||||
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
|
||||
fi
|
||||
elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
|
||||
if [ $UDEVVERSION -ge 176 ]; then
|
||||
printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
|
||||
else
|
||||
printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
|
||||
fi
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
}
|
||||
|
||||
# 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.
|
||||
@@ -1459,13 +1542,16 @@ module_is_host_only() (
|
||||
|
||||
find_kernel_modules_by_path () (
|
||||
local _OLDIFS
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = kernel*/$1/* ]] || continue
|
||||
echo $srcmods/$a
|
||||
done < $srcmods/modules.dep
|
||||
IFS=$_OLDIFS
|
||||
|
||||
[[ -f $srcmods/modules.dep ]] || return 0
|
||||
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = */$1/* ]] || continue
|
||||
echo $srcmods/$a
|
||||
done < $srcmods/modules.dep
|
||||
IFS=$_OLDIFS
|
||||
return 0
|
||||
)
|
||||
|
||||
|
17
dracut.8.asc
17
dracut.8.asc
@@ -30,6 +30,13 @@ early userspace.
|
||||
|
||||
For a complete list of kernel command line options see *dracut.cmdline*(7).
|
||||
|
||||
If you are dropped to an emergency shell, while booting your initramfs,
|
||||
the file _/run/initramfs/sosreport.txt_ is created, which can be safed to a
|
||||
(to be mounted by hand) partition (usually /boot) or a USB stick.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
|
||||
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
|
||||
EXAMPLE
|
||||
-------
|
||||
|
||||
@@ -325,8 +332,11 @@ provide a valid _/etc/fstab_.
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
|
||||
options>_ in the initramfs
|
||||
|
||||
**--device** _<device>_ ::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name
|
||||
**--add-device** _<device>_ ::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
|
||||
This can be useful in hostonly mode for resume support when your swap is on
|
||||
LVM or an encrypted partition.
|
||||
[NB --device can be used for compatibility with earlier releases]
|
||||
|
||||
**-i, --include** _<SOURCE>_ _<TARGET>_::
|
||||
include the files in the SOURCE directory into the
|
||||
@@ -414,6 +424,9 @@ _/etc/dracut.conf_::
|
||||
_/etc/dracut.conf.d/*.conf_::
|
||||
see dracut.conf5
|
||||
|
||||
_/usr/lib/dracut/dracut.conf.d/*.conf_::
|
||||
see dracut.conf5
|
||||
|
||||
Configuration in the initramfs
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_/etc/conf.d/_::
|
||||
|
25
dracut.asc
25
dracut.asc
@@ -79,7 +79,7 @@ udev pulls in modules matching the computer's detected hardware.
|
||||
initialized and a user-space helper started to paint animations onto the display
|
||||
in lockstep with the boot process.
|
||||
|
||||
* If the root file system is on NFS, dracut does then:
|
||||
* If the root file system is on NFS, dracut does then:
|
||||
** Bring up the primary network interface.
|
||||
** Invoke a DHCP client, with which it can obtain a DHCP lease.
|
||||
** Extract the name of the NFS share and the address of the NFS server from the
|
||||
@@ -120,6 +120,26 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be
|
||||
rotated away. Instead, it is simply emptied and the final root file system
|
||||
mounted over the top.
|
||||
|
||||
== Dracut on shutdown
|
||||
|
||||
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
|
||||
|
||||
The following steps are executed during a shutdown:
|
||||
|
||||
* systemd switches to the shutdown.target
|
||||
* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
|
||||
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
|
||||
which unpacks the initramfs to /run/initramfs
|
||||
* systemd finishes shutdown.target
|
||||
* systemd kills all processes
|
||||
* systemd tries to unmount everything and mounts the remaining read-only
|
||||
* systemd checks, if there is a /run/initramfs/shutdown executable
|
||||
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
|
||||
The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
|
||||
* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules
|
||||
|
||||
This ensures, that all devices are disassembled and unmounted cleanly.
|
||||
|
||||
= User Manual
|
||||
|
||||
== Creating an initramfs Image
|
||||
@@ -391,7 +411,7 @@ How to setup your PXE/TFTP server can be found in the
|
||||
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
|
||||
Hat Enterprise Linux Storage Administration Guide].
|
||||
|
||||
If you specify rd.ip=auto on the kernel command line, then dracut asks a dhcp
|
||||
If you specify ip=auto on the kernel command line, then dracut asks a dhcp
|
||||
server about the ip adress for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
@@ -466,6 +486,7 @@ dracut shell commands are printed as they are executed
|
||||
----
|
||||
# journalctl -ab
|
||||
----
|
||||
. With dracut >= 025 the file /run/initramfs/sosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
|
||||
|
||||
If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
|
||||
Then you can store the output for later inspection.
|
||||
|
@@ -124,6 +124,12 @@ Misc
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
If you are dropped to an emergency shell, the file _/run/initramfs/sosreport.txt_ is created,
|
||||
which can be safed to a (to be mounted by hand) partition (usually /boot) or a USB stick.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
|
||||
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
|
||||
**rd.info**::
|
||||
print informational output though "quiet" is set
|
||||
|
||||
@@ -131,8 +137,15 @@ Debug
|
||||
allow dropping to a shell, if root mounting fails
|
||||
|
||||
**rd.debug**::
|
||||
set -x for the dracut shell and logs to dmesg, console and
|
||||
_/run/initramfs/init.log_
|
||||
set -x for the dracut shell.
|
||||
If systemd is active in the initramfs, all output is logged to the systemd journal,
|
||||
which you can inspect with "journalctl -ab".
|
||||
If systemd is not active, the logs are written to dmesg and _/run/initramfs/init.log_.
|
||||
If "quiet" is set, it also logs to the console.
|
||||
|
||||
**rd.memdebug=[0-3]**::
|
||||
print memory usage debug info, set the verbose level from 1 to 3
|
||||
print nothing when set rd.memdebug=0
|
||||
|
||||
**rd.break**::
|
||||
drop to a shell at the end
|
||||
@@ -411,6 +424,10 @@ interface name. Better name it "bootnet" or "bluesocket".
|
||||
then its values should be separated by semicolon.
|
||||
Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
|
||||
|
||||
**team =_<teammaster>_:_<teamslaves>_**::
|
||||
Setup team device <teammaster> on top of <teamslaves>.
|
||||
<teamslaves> is a comma-separated list of physical (ethernet) interfaces.
|
||||
|
||||
**bridge=_<bridgename>_:_<ethnames>_**::
|
||||
Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
|
||||
list of physical (ethernet) interfaces. Bridge without parameters assumes bridge=br0:eth0
|
||||
@@ -583,7 +600,7 @@ ZNET
|
||||
+
|
||||
----
|
||||
rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
|
||||
rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
|
||||
rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar
|
||||
----
|
||||
|
||||
Plymouth Boot Splash
|
||||
|
10
dracut.conf
10
dracut.conf
@@ -1,11 +1,11 @@
|
||||
# PUT YOUR CONFIG HERE OR IN separate files named *.conf
|
||||
# in /etc/dracut.conf.d
|
||||
# /etc/dracut.conf.d/*.conf will override the settings in here
|
||||
# SEE man dracut.conf(5)
|
||||
|
||||
# Sample dracut config file
|
||||
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
#logfile=/var/log/dracut.log
|
||||
#fileloglvl=6
|
||||
|
||||
# Exact list of dracut modules to use. Modules not listed here are not going
|
||||
# to be included. If you only want to add some optional modules use
|
||||
@@ -29,10 +29,10 @@ fileloglvl=6
|
||||
#
|
||||
|
||||
# install local /etc/mdadm.conf
|
||||
mdadmconf="yes"
|
||||
#mdadmconf="no"
|
||||
|
||||
# install local /etc/lvm/lvm.conf
|
||||
lvmconf="yes"
|
||||
#lvmconf="no"
|
||||
|
||||
# A list of fsck tools to install. If it's not specified, module's hardcoded
|
||||
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
|
||||
|
@@ -10,17 +10,24 @@ dracut.conf - configuration file(s) for dracut
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_ _/usr/lib/dracut/dracut.conf.d/*.conf_
|
||||
|
||||
Description
|
||||
-----------
|
||||
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
|
||||
parameter will overwrite any values set here. _dracut.conf.d/*.conf_ files are
|
||||
read in alphanumerical order and will overwrite parameters set in
|
||||
parameter will overwrite any values set here.
|
||||
|
||||
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and /etc/dracut.conf.d.
|
||||
Files with the same name in /etc/dracut.conf.d will replace files in /usr/lib/dracut/dracut.conf.d.
|
||||
The files are then read in alphanumerical order and will overwrite parameters set in
|
||||
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
|
||||
indicates the beginning of a comment; following characters, up to the end of the
|
||||
line are not interpreted.
|
||||
|
||||
dracut command line options will overwrite any values set here.
|
||||
|
||||
Configuration files must have the extension .conf; other extensions are ignored.
|
||||
|
||||
*dracutmodules+=*" __<dracut modules>__ "::
|
||||
Specify a space-separated list of dracut modules to call when building the
|
||||
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
|
||||
@@ -82,6 +89,11 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*add_fstab+=*" __<filename>__ "::
|
||||
Add entries of __<filename>__ to the initramfs /etc/fstab.
|
||||
|
||||
*add_device+=*" __<device>__ "::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
|
||||
This can be useful in hostonly mode for resume support when your swap is on
|
||||
LVM an encrypted partition.
|
||||
|
||||
*mdadmconf=*"__{yes|no}__"::
|
||||
Include local _/etc/mdadm.conf_ (default=yes)
|
||||
|
||||
@@ -122,7 +134,7 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
Path to log file.
|
||||
|
||||
*show_modules=*"__{yes|no}__"::
|
||||
Print included module's name to standard output during build.
|
||||
Print the name of the included modules to standard output during build.
|
||||
|
||||
Files
|
||||
-----
|
||||
|
@@ -2,13 +2,13 @@
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
omit_drivers+=" .*/fs/ocfs/.* i2o_scsi"
|
||||
omit_drivers+=' .*/fs/ocfs/.* i2o_scsi'
|
||||
stdloglvl=3
|
||||
logfile=/var/log/dracut.log
|
||||
fileloglvl=6
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
prefix="/"
|
||||
systemdutildir=/usr/lib/systemd
|
||||
systemdsystemunitdir=/usr/lib/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
add_dracutmodules+=" systemd "
|
||||
realinitpath="/usr/lib/systemd/systemd"
|
||||
kernelcmdline+=" rd.auto=1 "
|
84
dracut.sh
84
dracut.sh
@@ -134,7 +134,7 @@ Creates initial ramdisk images for preloading modules
|
||||
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
||||
Mount device [DEV] on mountpoint [MP] with filesystem
|
||||
[FSTYPE] and options [FSOPTS] in the initramfs
|
||||
--device "[DEV]" Bring up [DEV] in initramfs
|
||||
--add-device "[DEV]" Bring up [DEV] in initramfs
|
||||
-i, --include [SOURCE] [TARGET]
|
||||
Include the files in the SOURCE directory into the
|
||||
Target directory in the final initramfs.
|
||||
@@ -235,6 +235,30 @@ read_arg() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
dropindirs_sort()
|
||||
{
|
||||
suffix=$1; shift
|
||||
args=("$@")
|
||||
files=$(
|
||||
while (( $# > 0 )); do
|
||||
for i in ${1}/*${suffix}; do
|
||||
[[ -f $i ]] && echo ${i##*/}
|
||||
done
|
||||
shift
|
||||
done | sort -Vu
|
||||
)
|
||||
|
||||
for f in $files; do
|
||||
for d in "${args[@]}"; do
|
||||
if [[ -f "$d/$f" ]]; then
|
||||
echo "$d/$f"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
verbosity_mod_l=0
|
||||
unset kernel
|
||||
unset outfile
|
||||
@@ -331,7 +355,8 @@ while :; do
|
||||
--fscks) push fscks_l "$2"; shift;;
|
||||
--add-fstab) push add_fstab_l "$2"; shift;;
|
||||
--mount) push fstab_lines "$2"; shift;;
|
||||
--device) push host_devs "$2"; shift;;
|
||||
--add-device|--device)
|
||||
push add_device_l "$2"; shift;;
|
||||
--kernel-cmdline) push kernel_cmdline_l "$2"; shift;;
|
||||
--nofscks) nofscks_l="yes";;
|
||||
--ro-mnt) ro_mnt_l="yes";;
|
||||
@@ -464,11 +489,9 @@ fi
|
||||
[[ -f $conffile ]] && . "$conffile"
|
||||
|
||||
# source our config dir
|
||||
if [[ $confdir && -d $confdir ]]; then
|
||||
for f in "$confdir"/*.conf; do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
fi
|
||||
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
|
||||
[[ -e $f ]] && . "$f"
|
||||
done
|
||||
|
||||
# these optins add to the stuff in the config file
|
||||
if (( ${#add_dracutmodules_l[@]} )); then
|
||||
@@ -688,10 +711,11 @@ esac
|
||||
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
exit 1
|
||||
}
|
||||
if [[ -d $srcmods ]]; then
|
||||
[[ -f $srcmods/modules.dep ]] || {
|
||||
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
@@ -734,6 +758,16 @@ for f in $add_fstab; do
|
||||
done < $f
|
||||
done
|
||||
|
||||
if (( ${#add_device_l[@]} )); then
|
||||
while pop add_device_l val; do
|
||||
add_device+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
for dev in $add_device; do
|
||||
push host_devs $dev
|
||||
done
|
||||
|
||||
if [[ $hostonly ]]; then
|
||||
# in hostonly mode, determine all devices, which have to be accessed
|
||||
# and examine them for filesystem types
|
||||
@@ -822,7 +856,7 @@ if [[ $prefix ]]; then
|
||||
fi
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/log $libdirs; do
|
||||
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var $libdirs; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -L "/$d" ]; then
|
||||
inst_symlink "/$d" "${prefix}/$d"
|
||||
@@ -841,6 +875,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
|
||||
ln -sfn ../run "$initdir/var/run"
|
||||
ln -sfn ../run/lock "$initdir/var/lock"
|
||||
ln -sfn ../run/log "$initdir/var/log"
|
||||
else
|
||||
for d in lib "$libdir"; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
@@ -937,7 +972,7 @@ fi
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
|
||||
|
||||
echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
[[ $kernel_cmdline ]] && echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
|
||||
while pop fstab_lines line; do
|
||||
echo "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
@@ -1031,7 +1066,7 @@ fi
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip xargs find; do
|
||||
if ! type -P $p >/dev/null; then
|
||||
derror "Could not find '$p'. You should run $0 with '--nostrip'."
|
||||
dwarn "Could not find '$p'. Not stripping the initramfs."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
@@ -1041,31 +1076,38 @@ if [[ $do_strip = yes ]] ; then
|
||||
dinfo "*** Stripping files ***"
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' ')' -print0 \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
if ! [[ -e "${f%/*}/.${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib/fipscheck/${f##*/}.hmac" ]] \
|
||||
&& ! [[ -e "/lib64/fipscheck/${f##*/}.hmac" ]]; then
|
||||
echo -n "$f"; echo -n -e "\000"
|
||||
fi
|
||||
done |xargs -r -0 strip -g 2>/dev/null
|
||||
done | xargs -r -0 strip -g 2>/dev/null
|
||||
else
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
|
||||
-or -path '*/lib/modules/*.ko' ')' -print0 \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 strip -g 2>/dev/null
|
||||
fi
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f; do
|
||||
SIG=$(tail -c 28 "$f")
|
||||
[[ $SIG == '~Module signature appended~' ]] || { echo -n "$f"; echo -n -e "\000"; }
|
||||
done | xargs -r -0 strip -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
rm -f "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
|
||||
$compress > "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
$compress > "$outfile.$$"; ); then
|
||||
dfatal "dracut: creation of $outfile.$$ failed"
|
||||
exit 1
|
||||
fi
|
||||
mv $outfile.$$ $outfile
|
||||
dinfo "*** Creating image file done ***"
|
||||
|
||||
dinfo "Wrote $outfile:"
|
||||
|
30
dracut.spec
30
dracut.spec
@@ -86,7 +86,7 @@ Requires: udev > 166
|
||||
Requires: kbd kbd-misc
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
Requires: util-linux >= 2.21
|
||||
Conflicts: systemd < 187
|
||||
Conflicts: systemd < 198
|
||||
%else
|
||||
Requires: util-linux-ng >= 2.21
|
||||
%endif
|
||||
@@ -96,6 +96,8 @@ Conflicts: initscripts < 8.63-1
|
||||
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
|
||||
%endif
|
||||
|
||||
Conflicts: mdadm < 3.2.6-14
|
||||
|
||||
%description
|
||||
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
@@ -106,6 +108,8 @@ NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
%package network
|
||||
Summary: dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: iputils
|
||||
Requires: iproute
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
|
||||
@@ -192,6 +196,11 @@ rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
|
||||
%endif
|
||||
|
||||
%if %{defined _unitdir}
|
||||
# for systemd, better use systemd-bootchart
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
|
||||
# we do not support dash in the initramfs
|
||||
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
|
||||
|
||||
@@ -213,12 +222,12 @@ touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
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
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
|
||||
@@ -256,9 +265,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/dracut-install
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
|
||||
%config /etc/dracut.conf.d/01-dist.conf
|
||||
%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%dir %{dracutlibdir}/dracut.conf.d
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man8/*service.8*
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -268,12 +278,17 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%if %{defined _unitdir}
|
||||
%{dracutlibdir}/modules.d/00systemd-bootchart
|
||||
%else
|
||||
%{dracutlibdir}/modules.d/00bootchart
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
%{dracutlibdir}/modules.d/10i18n
|
||||
%{dracutlibdir}/modules.d/30convertfs
|
||||
%{dracutlibdir}/modules.d/45url-lib
|
||||
%{dracutlibdir}/modules.d/50drm
|
||||
%{dracutlibdir}/modules.d/50plymouth
|
||||
%{dracutlibdir}/modules.d/80cms
|
||||
%{dracutlibdir}/modules.d/90btrfs
|
||||
@@ -321,6 +336,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_unitdir}/dracut-shutdown.service
|
||||
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%endif
|
||||
|
||||
%files network
|
||||
%defattr(-,root,root,0755)
|
||||
@@ -340,7 +358,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
|
@@ -10,12 +10,13 @@ lsinitrd - tool to show the contents of an initramfs image
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*lsinit* ['OPTION...'] [<image>]
|
||||
*lsinitrd* ['OPTION...'] [<image>]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
|
||||
lsinitrd uses the default image /boot/initramfs-<kernel version>.img.
|
||||
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
|
||||
_/boot/initramfs-<kernel-version>.img_.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
40
lsinitrd.sh
40
lsinitrd.sh
@@ -21,7 +21,13 @@
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $(${0##*/}) [-s] [<initramfs file> [<filename>]]"
|
||||
{
|
||||
echo "Usage: ${0##*/} [-s] [<initramfs file> [<filename>]]"
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
|
||||
[[ $# -le 2 ]] || { usage ; exit 1 ; }
|
||||
@@ -36,8 +42,36 @@ while getopts "s" opt; do
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
image="${1:-/boot/initramfs-$(uname -r).img}"
|
||||
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
if [[ "$1" ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
|
||||
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
|
||||
else
|
||||
image="/boot/initramfs-${KERNEL_VERSION}.img}"
|
||||
fi
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CAT=zcat
|
||||
FILE_T=$(file --dereference "$image")
|
||||
|
18
modules.d/00systemd-bootchart/module-setup.sh
Executable file
18
modules.d/00systemd-bootchart/module-setup.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
[ -x $systemdutildir/systemd-bootchart ] || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_symlink /init /sbin/init
|
||||
dracut_install $systemdutildir/systemd-bootchart
|
||||
}
|
@@ -14,7 +14,7 @@ installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt lzo"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
|
@@ -86,9 +86,11 @@ install() {
|
||||
install_base() {
|
||||
dracut_install setfont loadkeys kbd_mode stty
|
||||
|
||||
inst ${moddir}/console_init.sh /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst ${moddir}/console_init.sh /lib/udev/console_init
|
||||
inst_rules ${moddir}/10-console.rules
|
||||
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
install_all_kbd() {
|
||||
|
@@ -26,8 +26,8 @@ inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP
|
||||
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode
|
||||
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP
|
||||
|
||||
inst_key_val '' /etc/locale.conf LANG locale.LANG
|
||||
inst_key_val '' /etc/locale.conf LC_ALL locale.LC_ALL
|
||||
inst_key_val '' /etc/locale.conf locale.LANG LANG
|
||||
inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL
|
||||
|
||||
if [ -f /etc/locale.conf ]; then
|
||||
. /etc/locale.conf
|
||||
|
@@ -25,8 +25,7 @@ setup_interface() {
|
||||
if ! ip link set $netif mtu $mtu ; then
|
||||
ip link set $netif down
|
||||
ip link set $netif mtu $mtu
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
linkup $netif
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -51,6 +50,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
export PS4="dhclient.$interface.$$ + "
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
@@ -61,8 +61,7 @@ netif=$interface
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
linkup $netif
|
||||
;;
|
||||
BOUND)
|
||||
echo "dhcp: BOND setting $netif"
|
||||
@@ -89,6 +88,7 @@ case $reason in
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "> /tmp/setup_net_$netif.ok"
|
||||
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
|
||||
echo "rm -f $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
|
@@ -17,6 +17,8 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
use_bridge='false'
|
||||
use_vlan='false'
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
@@ -28,6 +30,15 @@ if [ -e /tmp/bond.info ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
for slave in $teamslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$teammaster
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
@@ -37,6 +48,7 @@ if [ -e /tmp/bridge.info ]; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
use_bridge='true'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -49,6 +61,7 @@ if [ -e /tmp/vlan.info ]; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$vlanname"
|
||||
use_vlan='true'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -84,30 +97,33 @@ do_ipv6auto() {
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
linkup $netif
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Handle static ip configuration
|
||||
do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu
|
||||
linkup $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
if strstr $ip '*:*:*'; then
|
||||
# note no ip addr flush for ipv6
|
||||
ip addr add $ip/$mask dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} dev $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask brd + dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} brd + dev $netif
|
||||
fi
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
> /tmp/setup_net_${netif}.ok
|
||||
return 0
|
||||
}
|
||||
|
||||
# loopback is always handled the same way
|
||||
@@ -143,13 +159,12 @@ if [ -e /tmp/bond.info ]; then
|
||||
fi
|
||||
done
|
||||
|
||||
ip link set $netif up
|
||||
linkup $netif
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
ip link set $slave down
|
||||
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
||||
ip link set $slave up
|
||||
wait_for_if_up $slave
|
||||
linkup $slave
|
||||
done
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
@@ -163,6 +178,28 @@ if [ -e /tmp/bond.info ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
|
||||
# We shall only bring up those _can_ come up
|
||||
# in case of some slave is gone in active-backup mode
|
||||
working_slaves=""
|
||||
for slave in $teamslaves ; do
|
||||
ip link set $slave up 2>/dev/null
|
||||
if wait_for_if_up $slave; then
|
||||
working_slaves+="$slave "
|
||||
fi
|
||||
done
|
||||
# Do not add slaves now
|
||||
teamd -d -U -n -t $teammaster -f /etc/teamd/$teammaster.conf
|
||||
for slave in $working_slaves; do
|
||||
# team requires the slaves to be down before joining team
|
||||
ip link set $slave down
|
||||
teamdctl $teammaster port add $slave
|
||||
done
|
||||
ip link set $teammaster up
|
||||
fi
|
||||
fi
|
||||
|
||||
# XXX need error handling like dhclient-script
|
||||
|
||||
@@ -176,9 +213,8 @@ if [ -e /tmp/bridge.info ]; then
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
else
|
||||
ip link set $ethname up
|
||||
linkup $ethname
|
||||
fi
|
||||
wait_for_if_up $ethname
|
||||
brctl addif $bridgename $ethname
|
||||
done
|
||||
fi
|
||||
@@ -187,10 +223,10 @@ fi
|
||||
get_vid() {
|
||||
case "$1" in
|
||||
vlan*)
|
||||
return ${1#vlan}
|
||||
echo ${1#vlan}
|
||||
;;
|
||||
*.*)
|
||||
return ${1##*.}
|
||||
echo ${1##*.}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -200,10 +236,9 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
if [ "$phydevice" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $phydevice -m
|
||||
else
|
||||
ip link set "$phydevice" up
|
||||
linkup "$phydevice"
|
||||
fi
|
||||
wait_for_if_up "$phydevice"
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
|
||||
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
@@ -225,6 +260,7 @@ if [ -z "$ip" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Specific configuration, spin through the kernel command line
|
||||
# looking for ip= lines
|
||||
for p in $(getargs ip=); do
|
||||
@@ -233,7 +269,9 @@ for p in $(getargs ip=); do
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr; do
|
||||
|
@@ -64,7 +64,8 @@ installkernel() {
|
||||
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
|
||||
| net_module_filter | instmods
|
||||
|
||||
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
|
||||
#instmods() will take care of hostonly
|
||||
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net =drivers/net/team
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -72,6 +73,8 @@ install() {
|
||||
dracut_install ip arping dhclient sed
|
||||
dracut_install -o ping ping6
|
||||
dracut_install -o brctl
|
||||
dracut_install -o teamd teamdctl teamnl
|
||||
inst_simple /etc/libnl/classid
|
||||
inst_script "$moddir/ifup.sh" "/sbin/ifup"
|
||||
inst_script "$moddir/netroot.sh" "/sbin/netroot"
|
||||
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
|
||||
@@ -82,6 +85,7 @@ install() {
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
@@ -91,5 +95,7 @@ install() {
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -24,19 +24,32 @@ fi
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES+=" ${ethnames%% *}"
|
||||
IFACES="$IFACES ${ethnames%% *}"
|
||||
fi
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
# It is enough to fire up only one
|
||||
IFACES+=" ${bondslaves%% *}"
|
||||
IFACES="$IFACES ${bondslaves%% *}"
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
fi
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
IFACES+=" $phydevice"
|
||||
IFACES="$IFACES $phydevice"
|
||||
fi
|
||||
|
||||
if [ -z "$IFACES" ]; then
|
||||
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
|
||||
fi
|
||||
|
||||
if [ -e /tmp/net.bootdev ]; then
|
||||
bootdev=$(cat /tmp/net.bootdev)
|
||||
fi
|
||||
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
@@ -47,16 +60,23 @@ fi
|
||||
if [ -n "$BOOTIF" ] ; then
|
||||
BOOTIF=$(fix_bootif "$BOOTIF")
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
|
||||
echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
|
||||
|
||||
# If we have to handle multiple interfaces, handle only them.
|
||||
elif [ -n "$IFACES" ] ; then
|
||||
for iface in $IFACES ; do
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
|
||||
if [ "$bootdev" = "$iface" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
# Fixme: waiting for the interface as well.
|
||||
else
|
||||
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
|
||||
fi
|
||||
|
||||
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
|
||||
} > /etc/udev/rules.d/90-net.rules
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
@@ -269,10 +271,15 @@ ip_to_var() {
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
2) dev=$1; autoconf=$2 ;;
|
||||
3) dev=$1; autoconf=$2; mtu=$3 ;;
|
||||
4) dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
|
||||
*) ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7; mtu=$8; macaddr=$9 ;;
|
||||
2) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2 ;;
|
||||
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
|
||||
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
|
||||
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
|
||||
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7; [ -n "$8" ] && mtu=$8;
|
||||
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
|
||||
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# anaconda-style argument cluster
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
@@ -315,3 +322,46 @@ parse_ifname_opts() {
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
# some network driver need long time to initialize, wait before it's ready.
|
||||
wait_for_if_link() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 600 ]; do
|
||||
li=$(ip -o link show dev $1 2>/dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_if_up() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 200 ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
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
|
||||
}
|
||||
|
||||
linkup() {
|
||||
wait_for_if_link $1 2>/dev/null\
|
||||
&& ip link set $1 up 2>/dev/null\
|
||||
&& wait_for_if_up $1 2>/dev/null
|
||||
}
|
||||
|
||||
|
@@ -67,6 +67,7 @@ source_hook netroot $netif
|
||||
# Run the handler; don't store the root, it may change from device to device
|
||||
# XXX other variables to export?
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
rm -f $hookdir/initqueue/finished/dhcp.sh
|
||||
# Network rootfs mount successful - save interface info for ifcfg etc.
|
||||
save_netinfo $netif
|
||||
fi
|
||||
|
44
modules.d/40network/parse-team.sh
Executable file
44
modules.d/40network/parse-team.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# team=<teammaster>:<teamslaves>
|
||||
#
|
||||
# teamslaves is a comma-separated list of physical (ethernet) interfaces
|
||||
#
|
||||
|
||||
# return if team already parsed
|
||||
[ -n "$teammaster" ] && return
|
||||
|
||||
# Check if team parameter is valid
|
||||
if getarg team= >/dev/null ; then
|
||||
:
|
||||
fi
|
||||
|
||||
parseteam() {
|
||||
local v=${1}:
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset teammaster teamslaves
|
||||
case $# in
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "team= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset teammaster teamslaves
|
||||
|
||||
if getarg team>/dev/null; then
|
||||
# Read team= parameters if they exist
|
||||
team="$(getarg team=)"
|
||||
if [ ! "$team" = "team" ]; then
|
||||
parseteam "$(getarg team=)"
|
||||
fi
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
|
||||
return
|
||||
fi
|
@@ -55,13 +55,16 @@ add_url_handler() {
|
||||
export CURL_HOME="/run/initramfs/url-lib"
|
||||
mkdir -p $CURL_HOME
|
||||
curl_args="--location --retry 3 --fail --show-error"
|
||||
getargbool 0 rd.noverifyssl && curl_args+=" --insecure"
|
||||
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"
|
||||
|
||||
proxy=$(getarg proxy=)
|
||||
[ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"
|
||||
|
||||
curl_fetch_url() {
|
||||
local url="$1" outloc="$2"
|
||||
echo "$url" > /proc/self/fd/0
|
||||
if [ -n "$outloc" ]; then
|
||||
curl $curl_args --output "$outloc" "$url" || return $?
|
||||
curl --globoff $curl_args --output "$outloc" "$url" || return $?
|
||||
else
|
||||
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
|
63
modules.d/50drm/module-setup.sh
Normal file
63
modules.d/50drm/module-setup.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
|
||||
drm_module_filter() {
|
||||
local _drm_drivers='drm_crtc_init'
|
||||
local _ret
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function nmf1() {
|
||||
local _fname _fcont
|
||||
while read _fname; do
|
||||
case "$_fname" in
|
||||
*.ko) _fcont="$(< $_fname)" ;;
|
||||
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
|
||||
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
|
||||
esac
|
||||
[[ $_fcont =~ $_drm_drivers
|
||||
&& ! $_fcont =~ iw_handler_get_spy ]] \
|
||||
&& echo "$_fname"
|
||||
done
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
fi
|
||||
done | nmf1 1>&${_merge}
|
||||
}
|
||||
# Use two parallel streams to filter alternating modules.
|
||||
set +x
|
||||
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
|
||||
[[ $debug ]] && set -x
|
||||
return 0
|
||||
}
|
||||
|
||||
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
|
||||
| drm_module_filter) ; do
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
|
||||
hostonly='' instmods $_modname
|
||||
continue
|
||||
fi
|
||||
instmods $_modname
|
||||
done
|
||||
}
|
@@ -8,59 +8,7 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
|
||||
drm_module_filter() {
|
||||
local _drm_drivers='drm_crtc_init'
|
||||
local _ret
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function nmf1() {
|
||||
local _fname _fcont
|
||||
while read _fname; do
|
||||
case "$_fname" in
|
||||
*.ko) _fcont="$(< $_fname)" ;;
|
||||
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
|
||||
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
|
||||
esac
|
||||
[[ $_fcont =~ $_drm_drivers
|
||||
&& ! $_fcont =~ iw_handler_get_spy ]] \
|
||||
&& echo "$_fname"
|
||||
done
|
||||
}
|
||||
function rotor() {
|
||||
local _f1 _f2
|
||||
while read _f1; do
|
||||
echo "$_f1"
|
||||
if read _f2; then
|
||||
echo "$_f2" 1>&${_side2}
|
||||
fi
|
||||
done | nmf1 1>&${_merge}
|
||||
}
|
||||
# Use two parallel streams to filter alternating modules.
|
||||
set +x
|
||||
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
|
||||
[[ $debug ]] && set -x
|
||||
return 0
|
||||
}
|
||||
|
||||
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
|
||||
| drm_module_filter) ; do
|
||||
# if the hardware is present, include module even if it is not currently loaded,
|
||||
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
|
||||
# loading of the driver if needed
|
||||
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
|
||||
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
|
||||
hostonly='' instmods $_modname
|
||||
continue
|
||||
fi
|
||||
instmods $_modname
|
||||
done
|
||||
echo drm
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -32,6 +32,7 @@ function cms_write_config()
|
||||
cat > /etc/sysconfig/network << EOF
|
||||
HOSTNAME=$HOSTNAME
|
||||
EOF
|
||||
echo "$HOSTNAME" > /etc/hostname
|
||||
if [ "$ipv6" ]; then
|
||||
echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
|
||||
else
|
||||
|
@@ -167,8 +167,8 @@ processcmsfile()
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f /etc/udev/rules.d/61-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/60-net.rules ]] \
|
||||
rm -f /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
|
||||
znet_cio_free
|
||||
|
@@ -29,4 +29,5 @@ install() {
|
||||
|
||||
inst_libdir_file "gconv/*"
|
||||
#inst /usr/lib/locale/locale-archive
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -1,11 +1,8 @@
|
||||
SUBSYSTEM!="block", GOTO="btrfs_end"
|
||||
ACTION!="add|change", GOTO="btrfs_end"
|
||||
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
|
||||
RUN+="/sbin/modprobe btrfs"
|
||||
RUN+="/sbin/btrfs device scan $env{DEVNAME}"
|
||||
|
||||
RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
|
||||
|
||||
LABEL="btrfs_end"
|
||||
|
||||
|
21
modules.d/90btrfs/btrfs_device_ready.sh
Executable file
21
modules.d/90btrfs/btrfs_device_ready.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
btrfs_check_complete() {
|
||||
local _rootinfo _dev
|
||||
_dev="${1:-/dev/root}"
|
||||
[ -e "$_dev" ] || return 0
|
||||
_rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
|
||||
if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
|
||||
info "Checking, if btrfs device complete"
|
||||
btrfs device ready "$_dev" >/dev/null 2>&1
|
||||
return $?
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
btrfs_check_complete $1
|
||||
exit $?
|
@@ -5,5 +5,4 @@
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
info "Scanning for all btrfs devices"
|
||||
/sbin/btrfs device scan 2>&1 | vinfo
|
||||
exit 0
|
||||
/sbin/btrfs device scan >/dev/null 2>&1
|
||||
|
@@ -26,13 +26,25 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods btrfs crc32c
|
||||
instmods btrfs
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
|
||||
inst_script "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
|
||||
if ! inst_rules 64-btrfs.rules; then
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
case "$(btrfs --help)" in
|
||||
*device\ ready*)
|
||||
inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished ;;
|
||||
*)
|
||||
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_script "$moddir/btrfs_timeout.sh" \
|
||||
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
|
||||
fi
|
||||
|
||||
dracut_install btrfsck
|
||||
inst $(command -v btrfs) /sbin/btrfs
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
@@ -11,18 +13,21 @@ if [ -f /etc/crypttab ]; then
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
allowdiscards="-"
|
||||
|
||||
# parse for allow-discards
|
||||
if strstr "$(cryptsetup --help)" "allow-discards"; then
|
||||
if discarduuids=$(getargs "rd.luks.allow-discards"); then
|
||||
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
|
||||
if strstr " $discarduuids " " ${luks##luks-}"; then
|
||||
allowdiscards="allow-discards"
|
||||
fi
|
||||
elif getargbool rd.luks.allow-discards; then
|
||||
allowdiscards="allow-discards"
|
||||
allowdiscards="allow-discards"
|
||||
fi
|
||||
elif getargbool 0 rd.luks.allow-discards; then
|
||||
allowdiscards="allow-discards"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$luks $dev none $allowdiscards" >> /etc/crypttab
|
||||
echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab
|
||||
|
||||
if command -v systemctl >/dev/null; then
|
||||
systemctl daemon-reload
|
||||
|
@@ -97,10 +97,11 @@ done
|
||||
# parse for allow-discards
|
||||
if strstr "$(cryptsetup --help)" "allow-discards"; then
|
||||
if discarduuids=$(getargs "rd.luks.allow-discards"); then
|
||||
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
|
||||
if strstr " $discarduuids " " ${luksdev##luks-}"; then
|
||||
allowdiscards="--allow-discards"
|
||||
fi
|
||||
elif getargbool rd.luks.allow-discards; then
|
||||
elif getargbool 0 rd.luks.allow-discards; then
|
||||
allowdiscards="--allow-discards"
|
||||
fi
|
||||
fi
|
||||
|
@@ -25,7 +25,7 @@ check() {
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_crypt || return 1
|
||||
for_each_host_dev_and_slaves_all check_crypt || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -46,7 +46,9 @@ install() {
|
||||
inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
fi
|
||||
[[ $hostonly ]] && inst_simple /etc/crypttab
|
||||
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
|
||||
@@ -60,4 +62,5 @@ install() {
|
||||
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
|
||||
systemd-ask-password systemd-tty-ask-password-agent
|
||||
inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -27,14 +27,6 @@ else
|
||||
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
else
|
||||
{
|
||||
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
|
||||
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
|
||||
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
|
||||
printf -- '--name crypt-run-generator-%%k %s ' $(command -v crypt-run-generator)
|
||||
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
|
||||
} >> /etc/udev/rules.d/70-luks.rules.new
|
||||
fi
|
||||
|
||||
uuid=$luksid
|
||||
|
15
modules.d/90dm/59-persistent-storage-dm.rules
Normal file
15
modules.d/90dm/59-persistent-storage-dm.rules
Normal file
@@ -0,0 +1,15 @@
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
|
||||
KERNEL!="dm-[0-9]*", GOTO="dm_end"
|
||||
ACTION=="add", GOTO="dm_end"
|
||||
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
|
||||
ENV{DM_NAME}!="?*", GOTO="dm_end"
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"
|
||||
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="dm_end"
|
||||
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="dm_end"
|
||||
IMPORT BLKID
|
||||
|
||||
LABEL="dm_end"
|
@@ -32,6 +32,9 @@ install() {
|
||||
|
||||
inst_rules "$moddir/11-dm.rules"
|
||||
|
||||
inst_rules "$moddir/59-persistent-storage-dm.rules"
|
||||
prepare_udev_rules 59-persistent-storage-dm.rules
|
||||
|
||||
inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ check() {
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_dmraid || return 1
|
||||
for_each_host_dev_and_slaves_all check_dmraid || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
|
13
modules.d/90dmsquash-live/checkisomd5@.service
Normal file
13
modules.d/90dmsquash-live/checkisomd5@.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Media check on %f
|
||||
DefaultDependencies=no
|
||||
Before=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
ExecStart=/bin/checkisomd5 --verbose %f
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
TimeoutSec=0
|
@@ -32,7 +32,12 @@ fi
|
||||
getarg rd.live.check -d check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
|
||||
checkisomd5 --verbose $livedev
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
p=$(str_replace "$livedev" "-" '\x2d')
|
||||
systemctl start checkisomd5@${p}.service
|
||||
else
|
||||
checkisomd5 --verbose $livedev
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
die "CD check failed!"
|
||||
exit 1
|
||||
@@ -105,18 +110,34 @@ do_live_overlay() {
|
||||
umount -l /run/initramfs/overlayfs || :
|
||||
fi
|
||||
|
||||
if [ -z "$setup" ]; then
|
||||
if [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
if [ -z "$setup" -o -n "$readonly_overlay" ]; then
|
||||
if [ -n "$setup" ]; then
|
||||
warn "Using temporary overlay."
|
||||
elif [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
warn "Unable to find persistent overlay; using temporary"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
||||
RO_OVERLAY_LOOPDEV=$( losetup -f )
|
||||
losetup $RO_OVERLAY_LOOPDEV /overlay
|
||||
else
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up the snapshot
|
||||
echo 0 `blockdev --getsz $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-rw
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
if [ -n "$readonly_overlay" ]; then
|
||||
echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-ro
|
||||
base="/dev/mapper/live-ro"
|
||||
over=$RO_OVERLAY_LOOPDEV
|
||||
else
|
||||
base=$BASE_LOOPDEV
|
||||
over=$OVERLAY_LOOPDEV
|
||||
fi
|
||||
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
|
||||
}
|
||||
|
||||
# live cd helper function
|
||||
|
@@ -16,7 +16,7 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods squashfs loop
|
||||
instmods squashfs loop iso9660
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -29,5 +29,6 @@ install() {
|
||||
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
||||
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -35,15 +35,21 @@ installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc ata_piix \
|
||||
pcmcia firewire-ohci yenta_socket \
|
||||
usb_storage sdhci sdhci-pci \
|
||||
sdhci_esdhc_imx mmci sdhci_tegra mvsdio \
|
||||
omap omapdrm omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv \
|
||||
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
|
||||
hid-logitech-dj hid-microsoft ehci-hcd ohci-hcd uhci-hcd xhci-hcd hid_generic \
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix \
|
||||
pcmcia usb_storage \
|
||||
ehci-hcd ehci-pci ehci-platform ohci-hcd uhci-hcd xhci-hcd hid_generic \
|
||||
unix
|
||||
|
||||
instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
|
||||
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
|
||||
hid-logitech-dj hid-microsoft firewire-ohci
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
|
||||
omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv
|
||||
fi
|
||||
|
||||
# install virtual machine support
|
||||
instmods virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
@@ -71,6 +77,8 @@ installkernel() {
|
||||
install() {
|
||||
dracut_install -o /lib/modprobe.d/*.conf
|
||||
[[ $hostonly ]] && dracut_install -o /etc/modprobe.d/*.conf /etc/modprobe.conf
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
fi
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
}
|
||||
|
@@ -2,6 +2,15 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
_modprobe_d=/etc/modprobe.d
|
||||
if [ -d /usr/lib/modprobe.d ] ; then
|
||||
_modprobe_d=/usr/lib/modprobe.d
|
||||
elif [ -d /lib/modprobe.d ] ; then
|
||||
_modprobe_d=/lib/modprobe.d
|
||||
elif [ ! -d $_modprobe_d ] ; then
|
||||
mkdir -p $_modprobe_d
|
||||
fi
|
||||
|
||||
for i in $(getargs rd.driver.pre -d rdloaddriver=); do
|
||||
(
|
||||
IFS=,
|
||||
@@ -11,19 +20,22 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do
|
||||
)
|
||||
done
|
||||
|
||||
|
||||
[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
|
||||
|
||||
for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
|
||||
done
|
||||
)
|
||||
done
|
||||
|
||||
for p in $(getargs rd.driver.post -d rdinsmodpost=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
|
||||
[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
|
||||
unset _do_insmodpost
|
||||
unset _do_insmodpost _modprobe_d
|
||||
|
@@ -14,5 +14,6 @@ install() {
|
||||
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
|
||||
inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh"
|
||||
inst_script "$moddir/livenetroot.sh" "/sbin/livenetroot"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ check() {
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves check_lvm || return 1
|
||||
for_each_host_dev_and_slaves_all check_lvm || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
|
23
modules.d/90mdraid/59-persistent-storage-md.rules
Normal file
23
modules.d/90mdraid/59-persistent-storage-md.rules
Normal file
@@ -0,0 +1,23 @@
|
||||
SUBSYSTEM!="block", GOTO="md_end"
|
||||
ACTION!="add|change", GOTO="md_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
|
||||
|
||||
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
|
||||
|
||||
# partitions have no md/{array_state,metadata_version}
|
||||
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
|
||||
|
||||
# container devices have a metadata version of e.g. 'external:ddf' and
|
||||
# never leave state 'inactive'
|
||||
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
|
||||
TEST!="md/array_state", GOTO="md_end"
|
||||
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
|
||||
|
||||
LABEL="md_ignore_state"
|
||||
|
||||
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT BLKID
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
LABEL="md_end"
|
16
modules.d/90mdraid/mdmon-pre-shutdown.sh
Executable file
16
modules.d/90mdraid/mdmon-pre-shutdown.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
_do_mdmon_takeover() {
|
||||
local ret
|
||||
mdmon --takeover --all
|
||||
ret=$?
|
||||
[ $ret -eq 0 ] && info "Taking over mdmon processes."
|
||||
return $ret
|
||||
}
|
||||
|
||||
if command -v mdmon >/dev/null; then
|
||||
_do_mdmon_takeover $1
|
||||
else
|
||||
:
|
||||
fi
|
@@ -29,9 +29,6 @@ _md_force_run() {
|
||||
|
||||
_path_d="${_path_s%/*}/degraded"
|
||||
[ ! -r "$_path_d" ] && continue
|
||||
|
||||
# workaround for mdmon bug
|
||||
[ "$(cat "$_path_d")" -gt "0" ] && mdmon $_offroot --takeover "$md"
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ check() {
|
||||
}
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_fs check_mdraid || return 1
|
||||
for_each_host_dev_and_slaves_all check_mdraid || return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -48,23 +48,18 @@ install() {
|
||||
inst $(command -v partx) /sbin/partx
|
||||
inst $(command -v mdadm) /sbin/mdadm
|
||||
|
||||
# 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
|
||||
# the system into the initrd.
|
||||
# dledford has hardware to test this, so he should be able to clean this up.
|
||||
# inst /etc/passwd
|
||||
# inst /etc/group
|
||||
|
||||
inst_rules 64-md-raid.rules
|
||||
# remove incremental assembly from stock rules, so they don't shadow
|
||||
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
|
||||
# when we explicitly don't want certain components to be incrementally
|
||||
# assembled
|
||||
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
|
||||
inst_rules 64-md-raid.rules
|
||||
# remove incremental assembly from stock rules, so they don't shadow
|
||||
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
|
||||
# when we explicitly don't want certain components to be incrementally
|
||||
# assembled
|
||||
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
|
||||
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
inst_rules "$moddir/59-persistent-storage-md.rules"
|
||||
prepare_udev_rules 59-persistent-storage-md.rules
|
||||
|
||||
# guard against pre-3.0 mdadm versions, that can't handle containers
|
||||
if ! mdadm -Q -e imsm /dev/null >/dev/null 2>&1; then
|
||||
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
|
||||
@@ -88,5 +83,8 @@ install() {
|
||||
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
|
||||
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
||||
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
||||
if [ -e /lib/systemd/system/mdmon@.service ]; then
|
||||
inst_simple /lib/systemd/system/mdmon@.service
|
||||
fi
|
||||
inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
|
||||
}
|
||||
|
||||
|
@@ -11,4 +11,5 @@ depends() {
|
||||
install() {
|
||||
dracut_install losetup
|
||||
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ echo server: $server
|
||||
echo path: $path
|
||||
echo options: $options
|
||||
|
||||
mount.cifs //$server/$path $NEWROOT -o $options && { [ -e /dev/root ] || >/dev/root ; }
|
||||
mount.cifs //$server/$path $NEWROOT -o $options && { [ -e /dev/root ] || ln -s null /dev/root ; }
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/cifs.sh
|
||||
|
@@ -43,4 +43,5 @@ install() {
|
||||
inst_hook cmdline 90 "$moddir/parse-cifsroot.sh"
|
||||
inst "$moddir/cifsroot.sh" "/sbin/cifsroot"
|
||||
inst "$moddir/cifs-lib.sh" "/lib/cifs-lib.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -16,12 +16,12 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
export PS4="fcoe-up.$1.$$ + "
|
||||
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
netif=$1
|
||||
dcb=$2
|
||||
|
||||
ip link set "$netif" up
|
||||
wait_for_if_up "$netif"
|
||||
linkup "$netif"
|
||||
|
||||
netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
|
||||
netdriver=${netdriver##*/}
|
||||
|
@@ -33,5 +33,6 @@ install() {
|
||||
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"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
@@ -43,6 +44,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; 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
|
||||
write_fs_tab /dev/root
|
||||
wait_for_dev /dev/root
|
||||
fi
|
||||
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
@@ -50,6 +53,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
done
|
||||
|
||||
iscsistart -b $iscsi_param
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi"
|
||||
echo 'started' > "/tmp/iscsistarted-firmware"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -135,14 +140,14 @@ handle_netroot()
|
||||
if [ -z "$root" -o -n "${root%%block:*}" ]; then
|
||||
# if root is not specified try to mount the whole iSCSI LUN
|
||||
printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
|
||||
udevadm control --reload
|
||||
write_fs_tab /dev/root
|
||||
wait_for_dev /dev/root
|
||||
|
||||
# install mount script
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
|
||||
fi
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/iscsi-settle.sh
|
||||
|
||||
# force udevsettle to break
|
||||
> $hookdir/initqueue/work
|
||||
|
||||
@@ -157,6 +162,10 @@ handle_netroot()
|
||||
${iscsi_netdev_name+--param iface.net_ifacename=$iscsi_netdev_name} \
|
||||
${iscsi_param} \
|
||||
|| :
|
||||
|
||||
netroot_enc=$(str_replace "$1" '/' '\2f')
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
|
||||
|
||||
}
|
||||
|
||||
# loop over all netroot parameter
|
||||
|
@@ -79,4 +79,5 @@ install() {
|
||||
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
|
||||
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
|
||||
[ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"
|
||||
|
||||
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "iscsi" ] ; then
|
||||
if [ -n "$netroot" ] ; then
|
||||
@@ -33,6 +35,8 @@ if [ "${root%%:*}" = "iscsi" ] ; 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
|
||||
root=/dev/root
|
||||
|
||||
write_fs_tab /dev/root
|
||||
fi
|
||||
|
||||
# If it's not empty or iscsi we don't continue
|
||||
@@ -58,6 +62,7 @@ if [ -n "$iscsi_firmware" ] ; then
|
||||
netroot=${netroot:-iscsi}
|
||||
modprobe -q iscsi_boot_sysfs 2>/dev/null
|
||||
modprobe -q iscsi_ibft
|
||||
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_firmware_started.sh
|
||||
fi
|
||||
|
||||
# If it's not iscsi we don't continue
|
||||
@@ -79,9 +84,17 @@ if ! [ -e /sys/module/iscsi_tcp ]; then
|
||||
modprobe -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
|
||||
fi
|
||||
|
||||
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
|
||||
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
|
||||
initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
|
||||
fi
|
||||
fi
|
||||
|
||||
netroot_enc=$(str_replace "$netroot" '/' '\2f')
|
||||
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
|
||||
# Shut up init error check
|
||||
[ -z "$root" ] && root="iscsi"
|
||||
|
||||
|
@@ -33,5 +33,6 @@ install() {
|
||||
inst nbd-client
|
||||
inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
|
||||
inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ nbdflags=${root%%:*}
|
||||
nbdopts=${root#*:}
|
||||
|
||||
# If nbdport not an integer, then assume name based import
|
||||
if [ "${nbdport%[0-9]}" = "$nbdport" ]; then
|
||||
if [ ! -z $(echo "$nbdport" | sed 's/[0-9]//g') ]; then
|
||||
nbdport="-N $nbdport"
|
||||
fi
|
||||
|
||||
@@ -101,11 +101,14 @@ nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
|
||||
# add the udev rules for mounting the nbd0 device
|
||||
root=$(getarg root=)
|
||||
if [ -z "$root" ] || strstr "$root" "nbd:" || strstr "$root" "dhcp"; then
|
||||
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; :; };} && rm $job;' \
|
||||
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; type systemctl >/dev/null 2>&1 && systemctl --no-block start sysroot.mount;:; };} && rm $job;' \
|
||||
> $hookdir/initqueue/settled/nbd.sh
|
||||
|
||||
printf '/bin/mount -t %s -o %s %s %s\n' \
|
||||
"$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
|
||||
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
write_fs_tab /dev/nbd0 "$nbdfstype" "$fsopts"
|
||||
|
||||
printf '/bin/mount %s\n' \
|
||||
"$NEWROOT" \
|
||||
> $hookdir/mount/01-$$-nbd.sh
|
||||
fi
|
||||
|
||||
|
@@ -75,5 +75,6 @@ install() {
|
||||
egrep -q '^rpc:' /etc/passwd \
|
||||
&& egrep -q '^rpc:' /etc/group \
|
||||
&& chown rpc.rpc "$initdir/var/lib/rpcbind"
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -2,16 +2,22 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Start rpcbind or rpcbind
|
||||
# FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
|
||||
command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
|
||||
command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ] && rpcbind
|
||||
|
||||
[ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
|
||||
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
|
||||
if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
|
||||
|
||||
# Start rpc.statd as mount won't let us use locks on a NFSv4
|
||||
# filesystem without talking to it. NFSv4 does locks internally,
|
||||
# rpc.lockd isn't needed
|
||||
[ -z "$(pidof rpc.statd)" ] && rpc.statd
|
||||
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
|
||||
[ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
|
||||
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
|
||||
|
||||
# Start rpcbind or rpcbind
|
||||
# FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
|
||||
command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
|
||||
command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ] && rpcbind
|
||||
|
||||
# Start rpc.statd as mount won't let us use locks on a NFSv4
|
||||
# filesystem without talking to it. NFSv4 does locks internally,
|
||||
# rpc.lockd isn't needed
|
||||
[ -z "$(pidof rpc.statd)" ] && rpc.statd
|
||||
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
|
||||
else
|
||||
warn 'Kernel module "sunrpc" not in the initramfs, or support for filesystem "rpc_pipefs" missing!'
|
||||
fi
|
||||
|
@@ -22,7 +22,9 @@ if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
|
||||
mkdir -m 0755 -p $NEWROOT/$rpcpipefspath 2>/dev/null
|
||||
|
||||
if [ -d $NEWROOT/$rpcpipefspath ]; then
|
||||
mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
|
||||
# mount --move does not seem to work???
|
||||
mount --bind /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
|
||||
umount /var/lib/nfs/rpc_pipefs
|
||||
else
|
||||
umount /var/lib/nfs/rpc_pipefs
|
||||
fi
|
||||
|
@@ -16,7 +16,9 @@ NEWROOT="$3"
|
||||
nfs_to_var $root $netif
|
||||
[ -z "$server" ] && die "Required parameter 'server' is missing"
|
||||
|
||||
mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || >/dev/root ; }
|
||||
mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ; }
|
||||
|
||||
cat $NEWROOT/etc/fstab > /dev/null
|
||||
|
||||
# inject new exit_if_exists
|
||||
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/nfs.sh
|
||||
|
@@ -14,8 +14,13 @@ install() {
|
||||
}
|
||||
done
|
||||
|
||||
inst_hook cmdline 10 "$moddir/parse-resume.sh"
|
||||
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
|
||||
inst_hook mount 10 "$moddir/resume.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 10 "$moddir/parse-resume.sh"
|
||||
else
|
||||
inst_script "$moddir/parse-resume.sh" /lib/dracut/parse-resume.sh
|
||||
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
|
||||
fi
|
||||
|
||||
inst_script "$moddir/resume.sh" /lib/dracut/resume.sh
|
||||
}
|
||||
|
||||
|
@@ -24,3 +24,51 @@ if splash=$(getarg splash=); then
|
||||
else
|
||||
unset splash
|
||||
fi
|
||||
|
||||
case "$splash" in
|
||||
quiet )
|
||||
a_splash="-P splash=y"
|
||||
;;
|
||||
* )
|
||||
a_splash="-P splash=n"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$resume" ]; then
|
||||
{
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
} >> /etc/udev/rules.d/99-resume-link.rules
|
||||
|
||||
{
|
||||
if [ -x /usr/sbin/resume ]; then
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||||
${resume#/dev/} "$a_splash" "$resume";
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
|
||||
${resume#/dev/} "$a_splash" "$resume";
|
||||
fi
|
||||
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
|
||||
${resume#/dev/};
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
|
||||
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
|
||||
|
||||
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
|
||||
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh
|
||||
|
||||
wait_for_dev "/dev/resume"
|
||||
mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh
|
||||
elif ! getarg noresume; then
|
||||
{
|
||||
if [ -x /usr/sbin/resume ]; then
|
||||
printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash"
|
||||
fi
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," \
|
||||
" RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\"";
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
fi
|
||||
|
@@ -32,8 +32,8 @@ if [ -n "$resume" ]; then
|
||||
${resume#/dev/};
|
||||
} >> /etc/udev/rules.d/99-resume.rules
|
||||
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; udevadm settle; }\n' \
|
||||
"$resume" "$resume" >> $hookdir/initqueue/settled/resume.sh
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
|
||||
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
|
||||
|
||||
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
|
||||
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh
|
||||
|
@@ -15,7 +15,7 @@ check() {
|
||||
rootopts=$opts
|
||||
break
|
||||
fi
|
||||
done < "$NEWROOT/etc/fstab"
|
||||
done < /etc/fstab
|
||||
|
||||
[ "$rootfs" = "reiserfs" ] && journaldev=$(fs_get_option $rootopts "jdev")
|
||||
[ "$rootfs" = "xfs" ] && journaldev=$(fs_get_option $rootopts "logdev")
|
||||
@@ -23,7 +23,6 @@ check() {
|
||||
echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
|
||||
fi
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
depends() {
|
||||
@@ -32,8 +31,10 @@ depends() {
|
||||
|
||||
install() {
|
||||
dracut_install umount
|
||||
inst_hook cmdline 95 "$moddir/parse-block.sh"
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_hook cmdline 95 "$moddir/parse-block.sh"
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,7 @@ mount_root() {
|
||||
fi
|
||||
|
||||
_rflags_ro="$rflags,ro"
|
||||
_rflags_ro="${_rflags_ro##,}"
|
||||
|
||||
while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
|
||||
warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"
|
||||
|
@@ -20,3 +20,5 @@ case "$root" in
|
||||
root="block:${root}"
|
||||
rootok=1 ;;
|
||||
esac
|
||||
|
||||
[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
|
||||
|
@@ -3,38 +3,7 @@ ACTION!="add|change", GOTO="ps_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end"
|
||||
|
||||
KERNEL=="cciss[0-9]*", IMPORT{builtin}="blkid"
|
||||
KERNEL=="nbd[0-9]*", IMPORT{builtin}="blkid"
|
||||
|
||||
|
||||
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
|
||||
|
||||
# partitions have no md/{array_state,metadata_version}
|
||||
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
|
||||
|
||||
# container devices have a metadata version of e.g. 'external:ddf' and
|
||||
# never leave state 'inactive'
|
||||
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
|
||||
TEST!="md/array_state", GOTO="md_end"
|
||||
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
|
||||
|
||||
LABEL="md_ignore_state"
|
||||
|
||||
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT{builtin}="blkid"
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
LABEL="md_end"
|
||||
|
||||
|
||||
KERNEL!="dm-[0-9]*", GOTO="ps_end"
|
||||
ACTION=="add", GOTO="ps_end"
|
||||
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
|
||||
ENV{DM_NAME}!="?*", GOTO="ps_end"
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="ps_end"
|
||||
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="ps_end"
|
||||
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="ps_end"
|
||||
IMPORT{builtin}="blkid"
|
||||
|
||||
KERNEL=="cciss[0-9]*", IMPORT BLKID
|
||||
KERNEL=="nbd[0-9]*", IMPORT BLKID
|
||||
|
||||
LABEL="ps_end"
|
||||
|
@@ -12,7 +12,7 @@ GOTO="pss_end"
|
||||
|
||||
LABEL="do_pss"
|
||||
# by-path (parent device path)
|
||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
|
||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT PATH_ID
|
||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
|
||||
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
|
||||
|
||||
|
@@ -34,6 +34,8 @@ install() {
|
||||
"$moddir/59-persistent-storage.rules" \
|
||||
"$moddir/61-persistent-storage.rules"
|
||||
|
||||
prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
|
||||
|
||||
inst_dir /run/udev
|
||||
inst_dir /run/udev/rules.d
|
||||
|
||||
@@ -41,7 +43,7 @@ install() {
|
||||
for i in cdrom tape dialout floppy; do
|
||||
if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||
if ! egrep "^$i:" /etc/group 2>/dev/null; then
|
||||
case $i in
|
||||
case $i in
|
||||
cdrom) echo "$i:x:11:";;
|
||||
dialout) echo "$i:x:18:";;
|
||||
floppy) echo "$i:x:19:";;
|
||||
@@ -74,5 +76,6 @@ install() {
|
||||
inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh
|
||||
|
||||
inst_libdir_file "libnss_files*"
|
||||
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ depends() {
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods 9p 9pnet_virtio
|
||||
instmods 9p 9pnet_virtio virtio_pci
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -35,5 +35,6 @@ install() {
|
||||
mkdir -m 0755 -p ${initdir}/etc/templates
|
||||
inst_simple "${moddir}/rsyslog.conf" /etc/templates
|
||||
fi
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
||||
|
@@ -12,9 +12,15 @@ Description=dracut cmdline hook
|
||||
Documentation=man:dracut-cmdline.service(8)
|
||||
DefaultDependencies=no
|
||||
Before=dracut-pre-udev.service
|
||||
Before=systemd-vconsole-setup.service
|
||||
After=systemd-journald.socket
|
||||
Wants=systemd-journald.socket
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cmdline
|
||||
ConditionKernelCommandLine=|rd.break=cmdline
|
||||
ConditionKernelCommandLine=|resume
|
||||
ConditionKernelCommandLine=|noresume
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
@@ -23,6 +29,7 @@ StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
|
@@ -7,6 +7,7 @@ export NEWROOT="/sysroot"
|
||||
[ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
|
||||
[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
|
||||
[ -d /run/lock ] || mkdir -p -m 0755 /run/lock
|
||||
[ -d /run/log ] || mkdir -p -m 0755 /run/log
|
||||
|
||||
if [ -f /dracut-state.sh ]; then
|
||||
. /dracut-state.sh 2>/dev/null
|
||||
@@ -16,16 +17,62 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
[ -f /etc/initrd-release ] && . /etc/initrd-release
|
||||
[ -n "$VERSION" ] && info "dracut-$VERSION"
|
||||
|
||||
getargbool 0 rd.udev.log-priority=info -d rd.udev.info -d -n -y rdudevinfo && echo 'udev_log="info"' >> /etc/udev/udev.conf
|
||||
getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && echo 'udev_log="debug"' >> /etc/udev/udev.conf
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
root=$(getarg root=)
|
||||
|
||||
rflags="$(getarg rootflags=)"
|
||||
getargbool 0 ro && rflags="${rflags},ro"
|
||||
getargbool 0 rw && rflags="${rflags},rw"
|
||||
rflags="${rflags#,}"
|
||||
|
||||
fstype="$(getarg rootfstype=)"
|
||||
if [ -z "$fstype" ]; then
|
||||
fstype="auto"
|
||||
fi
|
||||
|
||||
export root
|
||||
export rflags
|
||||
export fstype
|
||||
|
||||
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
|
||||
# run scriptlets to parse the command line
|
||||
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
|
||||
source_hook cmdline
|
||||
|
||||
[ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh
|
||||
|
||||
case "$root" in
|
||||
block:LABEL=*|LABEL=*)
|
||||
root="${root#block:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="block:/dev/disk/by-label/${root#LABEL=}"
|
||||
rootok=1 ;;
|
||||
block:UUID=*|UUID=*)
|
||||
root="${root#block:}"
|
||||
root="block:/dev/disk/by-uuid/${root#UUID=}"
|
||||
rootok=1 ;;
|
||||
block:PARTUUID=*|PARTUUID=*)
|
||||
root="${root#block:}"
|
||||
root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
|
||||
rootok=1 ;;
|
||||
/dev/*)
|
||||
root="block:${root}"
|
||||
rootok=1 ;;
|
||||
esac
|
||||
|
||||
[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
|
||||
|
||||
[ -z "$root" ] && die "No or empty root= argument"
|
||||
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
|
||||
export root rflags fstype netroot NEWROOT
|
||||
|
||||
export -p > /dracut-state.sh
|
||||
|
||||
service="${0##*/}"
|
||||
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
|
||||
exit 0
|
||||
|
@@ -8,15 +8,16 @@
|
||||
# See systemd.special(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=Emergency Shell
|
||||
Description=Dracut Emergency Shell
|
||||
DefaultDependencies=no
|
||||
After=systemd-vconsole-setup.service
|
||||
Wants=systemd-vconsole-setup.service
|
||||
Conflicts=emergency.service emergency.target
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/
|
||||
WorkingDirectory=/
|
||||
ExecStartPre=-/bin/plymouth quit
|
||||
ExecStartPre=-/bin/echo -e '\n\nEntering emergency mode. Exit the shell to continue.\nType "journalctl" to view system logs.\n'
|
||||
ExecStart=-/bin/sh -i -l
|
||||
ExecStart=/bin/dracut-emergency
|
||||
ExecStopPost=-/bin/rm -f /.console_lock
|
||||
Type=oneshot
|
||||
StandardInput=tty-force
|
||||
|
41
modules.d/98systemd/dracut-emergency.sh
Executable file
41
modules.d/98systemd/dracut-emergency.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
export DRACUT_SYSTEMD=1
|
||||
if [ -f /dracut-state.sh ]; then
|
||||
. /dracut-state.sh 2>/dev/null
|
||||
fi
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
[ -x /bin/plymouth ] && /bin/plymouth quit
|
||||
|
||||
export _rdshell_name="dracut" action="Boot" hook="emergency"
|
||||
|
||||
source_hook "$hook"
|
||||
|
||||
|
||||
if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
|
||||
echo
|
||||
sosreport
|
||||
echo
|
||||
echo
|
||||
echo 'Entering emergency mode. Exit the shell to continue.'
|
||||
echo 'Type "journalctl" to view system logs.'
|
||||
echo 'You might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot'
|
||||
echo 'after mounting them and attach it to a bug report.'
|
||||
echo
|
||||
echo
|
||||
[ -f /etc/profile ] && . /etc/profile
|
||||
[ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
|
||||
exec sh -i -l
|
||||
else
|
||||
warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/bin/rm -f /.console_lock
|
||||
|
||||
exit 0
|
@@ -14,6 +14,9 @@ DefaultDependencies=no
|
||||
After=systemd-udev-trigger.service
|
||||
Wants=systemd-udev-trigger.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionPathExists=|/lib/dracut/need-initqueue
|
||||
ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/*.sh
|
||||
ConditionKernelCommandLine=|rd.break=pre-mount
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
@@ -22,6 +25,7 @@ StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
|
@@ -10,10 +10,11 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
|
||||
getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
|
||||
|
||||
RDRETRY=$(getarg rd.retry -d 'rd_retry=')
|
||||
RDRETRY=${RDRETRY:-30}
|
||||
RDRETRY=${RDRETRY:-180}
|
||||
RDRETRY=$(($RDRETRY*2))
|
||||
export RDRETRY
|
||||
|
||||
@@ -24,7 +25,7 @@ while :; do
|
||||
|
||||
check_finished && break
|
||||
|
||||
udevsettle
|
||||
udevadm settle --exit-if-exists=$hookdir/initqueue/work
|
||||
|
||||
check_finished && break
|
||||
|
||||
@@ -38,7 +39,7 @@ while :; do
|
||||
check_finished && break 2
|
||||
done
|
||||
|
||||
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
|
||||
udevadm settle --timeout=0 >/dev/null 2>&1 || continue
|
||||
|
||||
for job in $hookdir/initqueue/settled/*.sh; do
|
||||
[ -e "$job" ] || break
|
||||
@@ -46,17 +47,17 @@ while :; do
|
||||
check_finished && break 2
|
||||
done
|
||||
|
||||
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
|
||||
udevadm settle --timeout=0 >/dev/null 2>&1 || continue
|
||||
|
||||
# no more udev jobs and queues empty.
|
||||
sleep 0.5
|
||||
|
||||
|
||||
if [ $main_loop -gt $((2*$RDRETRY/3)) ]; then
|
||||
for job in $hookdir/initqueue/timeout/*.sh; do
|
||||
[ -e "$job" ] || break
|
||||
job=$job . $job
|
||||
main_loop=0
|
||||
udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
|
||||
[ -f $hookdir/initqueue/work ] && main_loop=0
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -69,42 +70,8 @@ unset queuetriggered
|
||||
unset main_loop
|
||||
unset RDRETRY
|
||||
|
||||
|
||||
# pre-mount happens before we try to mount the root filesystem,
|
||||
# and happens once.
|
||||
getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
|
||||
source_hook pre-mount
|
||||
|
||||
|
||||
getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
|
||||
# mount scripts actually try to mount the root filesystem, and may
|
||||
# be sourced any number of times. As soon as one suceeds, no more are sourced.
|
||||
i=0
|
||||
while :; do
|
||||
if ismounted "$NEWROOT"; then
|
||||
usable_root "$NEWROOT" && break;
|
||||
umount "$NEWROOT"
|
||||
fi
|
||||
for f in $hookdir/mount/*.sh; do
|
||||
[ -f "$f" ] && . "$f"
|
||||
if ismounted "$NEWROOT"; then
|
||||
usable_root "$NEWROOT" && break;
|
||||
warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
|
||||
umount "$NEWROOT"
|
||||
rm -f "$f"
|
||||
fi
|
||||
done
|
||||
|
||||
i=$(($i+1))
|
||||
[ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
|
||||
done
|
||||
|
||||
{
|
||||
echo -n "Mounted root filesystem "
|
||||
while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
|
||||
} | vinfo
|
||||
|
||||
|
||||
export -p > /dracut-state.sh
|
||||
|
||||
service="${0##*/}"
|
||||
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
|
||||
exit 0
|
||||
|
31
modules.d/98systemd/dracut-mount.service
Normal file
31
modules.d/98systemd/dracut-mount.service
Normal file
@@ -0,0 +1,31 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut mount hook
|
||||
Documentation=man:dracut-mount.service(8)
|
||||
DefaultDependencies=no
|
||||
After=dracut-pre-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target
|
||||
Wants=local-fs.target
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
|
||||
ConditionKernelCommandLine=|rd.break=mount
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=-/bin/dracut-mount
|
||||
StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
KillSignal=SIGHUP
|
25
modules.d/98systemd/dracut-mount.service.8.asc
Normal file
25
modules.d/98systemd/dracut-mount.service.8.asc
Normal file
@@ -0,0 +1,25 @@
|
||||
DRACUT-MOUNT.SERVICE(8)
|
||||
=======================
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
dracut-mount.service - runs the dracut hooks after /sysroot is mounted
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
dracut-mount.service
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This service runs all dracut hooks after the real root is mounted on /sysroot.
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
41
modules.d/98systemd/dracut-mount.sh
Executable file
41
modules.d/98systemd/dracut-mount.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
export DRACUT_SYSTEMD=1
|
||||
if [ -f /dracut-state.sh ]; then
|
||||
. /dracut-state.sh 2>/dev/null
|
||||
fi
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook mount" '1:shortmem' '2+:mem' '3+:slab'
|
||||
|
||||
getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
|
||||
# mount scripts actually try to mount the root filesystem, and may
|
||||
# be sourced any number of times. As soon as one suceeds, no more are sourced.
|
||||
i=0
|
||||
while :; do
|
||||
if ismounted "$NEWROOT"; then
|
||||
usable_root "$NEWROOT" && break;
|
||||
umount "$NEWROOT"
|
||||
fi
|
||||
for f in $hookdir/mount/*.sh; do
|
||||
[ -f "$f" ] && . "$f"
|
||||
if ismounted "$NEWROOT"; then
|
||||
usable_root "$NEWROOT" && break;
|
||||
warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
|
||||
umount "$NEWROOT"
|
||||
rm -f "$f"
|
||||
fi
|
||||
done
|
||||
|
||||
i=$(($i+1))
|
||||
[ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
|
||||
done
|
||||
|
||||
export -p > /dracut-state.sh
|
||||
|
||||
service="${0##*/}"
|
||||
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
|
||||
exit 0
|
32
modules.d/98systemd/dracut-pre-mount.service
Normal file
32
modules.d/98systemd/dracut-pre-mount.service
Normal file
@@ -0,0 +1,32 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=dracut pre-mount hook
|
||||
Documentation=man:dracut-pre-mount.service(8)
|
||||
DefaultDependencies=no
|
||||
Before=sysroot.mount local-fs.target
|
||||
After=dracut-initqueue.service
|
||||
After=cryptsetup.target
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-mount
|
||||
ConditionKernelCommandLine=|rd.break=pre-mount
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=-/bin/dracut-pre-mount
|
||||
StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
KillSignal=SIGHUP
|
25
modules.d/98systemd/dracut-pre-mount.service.8.asc
Normal file
25
modules.d/98systemd/dracut-pre-mount.service.8.asc
Normal file
@@ -0,0 +1,25 @@
|
||||
DRACUT-PRE-MOUNT.SERVICE(8)
|
||||
===========================
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
dracut-pre-mount.service - runs the dracut hooks before /sysroot is mounted
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
dracut-pre-mount.service
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This service runs all dracut hooks before the real root is mounted on /sysroot.
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
22
modules.d/98systemd/dracut-pre-mount.sh
Executable file
22
modules.d/98systemd/dracut-pre-mount.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
export DRACUT_SYSTEMD=1
|
||||
if [ -f /dracut-state.sh ]; then
|
||||
. /dracut-state.sh 2>/dev/null
|
||||
fi
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
|
||||
# pre pivot scripts are sourced just before we doing cleanup and switch over
|
||||
# to the new root.
|
||||
getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
|
||||
source_hook pre-mount
|
||||
|
||||
export -p > /dracut-state.sh
|
||||
|
||||
service="${0##*/}"
|
||||
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
|
||||
exit 0
|
@@ -11,13 +11,16 @@
|
||||
Description=dracut pre-pivot and cleanup hook
|
||||
Documentation=man:dracut-pre-pivot.service(8)
|
||||
DefaultDependencies=no
|
||||
After=dracut-initqueue.service
|
||||
After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target
|
||||
Wants=local-fs.target
|
||||
Before=initrd-cleanup.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
|
||||
ConditionKernelCommandLine=|rd.break=pre-pivot
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=-/bin/dracut-pre-pivot
|
||||
ExecStopPost=-/usr/bin/systemctl --no-block isolate initrd-switch-root.target
|
||||
StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
|
@@ -10,6 +10,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
|
||||
# pre pivot scripts are sourced just before we doing cleanup and switch over
|
||||
# to the new root.
|
||||
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
|
||||
@@ -19,25 +20,11 @@ source_hook pre-pivot
|
||||
getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
|
||||
source_hook cleanup
|
||||
|
||||
# By the time we get here, the root filesystem should be mounted.
|
||||
# Try to find init.
|
||||
|
||||
for i in "$(getarg real_init=)" "$(getarg init=)"; do
|
||||
[ -n "$i" ] || continue
|
||||
|
||||
__p=$(readlink -f "${NEWROOT}/${i}")
|
||||
if [ -x "$__p" ]; then
|
||||
INIT="$i"
|
||||
echo "NEWINIT=\"$INIT\"" > /run/initramfs/switch-root.conf
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "NEWROOT=\"$NEWROOT\"" >> /run/initramfs/switch-root.conf
|
||||
getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root"
|
||||
|
||||
# remove helper symlink
|
||||
[ -h /dev/root ] && rm -f /dev/root
|
||||
|
||||
getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root"
|
||||
|
||||
service="${0##*/}"
|
||||
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
|
||||
exit 0
|
||||
|
@@ -15,6 +15,8 @@ Before=systemd-udev-trigger.service dracut-initqueue.service
|
||||
After=dracut-pre-udev.service systemd-udevd.service
|
||||
Wants=dracut-pre-udev.service systemd-udevd.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-trigger
|
||||
ConditionKernelCommandLine=|rd.break=pre-trigger
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
@@ -23,6 +25,7 @@ StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
|
@@ -10,13 +10,16 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
getargbool 0 rd.udev.info -n -y rdudevinfo && udevadm control --log-priority=info
|
||||
getargbool 0 rd.udev.debug -n -y rdudevdebug && udevadm control --log-priority=debug
|
||||
udevproperty "hookdir=$hookdir"
|
||||
make_trace_mem "hook pre-trigger" "1:shortmem" "2+:mem" "3+:slab"
|
||||
|
||||
source_hook pre-trigger
|
||||
|
||||
getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break pre-trigger"
|
||||
|
||||
udevadm control --reload >/dev/null 2>&1 || :
|
||||
|
||||
export -p > /dracut-state.sh
|
||||
|
||||
service="${0##*/}"
|
||||
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
|
||||
exit 0
|
||||
|
@@ -15,6 +15,11 @@ Before=systemd-udevd.service dracut-pre-trigger.service
|
||||
After=dracut-cmdline.service
|
||||
Wants=dracut-cmdline.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-udev
|
||||
ConditionKernelCommandLine=|rd.break=pre-udev
|
||||
ConditionKernelCommandLine=|rd.driver.blacklist
|
||||
ConditionKernelCommandLine=|rd.driver.pre
|
||||
ConditionKernelCommandLine=|rd.driver.post
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
@@ -23,6 +28,7 @@ StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
|
@@ -9,10 +9,52 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
source_conf /etc/conf.d
|
||||
|
||||
make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
|
||||
# pre pivot scripts are sourced just before we doing cleanup and switch over
|
||||
# to the new root.
|
||||
getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break pre-udev"
|
||||
source_hook pre-udev
|
||||
|
||||
_modprobe_d=/etc/modprobe.d
|
||||
if [ -d /usr/lib/modprobe.d ] ; then
|
||||
_modprobe_d=/usr/lib/modprobe.d
|
||||
elif [ -d /lib/modprobe.d ] ; then
|
||||
_modprobe_d=/lib/modprobe.d
|
||||
elif [ ! -d $_modprobe_d ] ; then
|
||||
mkdir -p $_modprobe_d
|
||||
fi
|
||||
|
||||
for i in $(getargs rd.driver.pre -d rdloaddriver=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
modprobe $p 2>&1 | vinfo
|
||||
done
|
||||
)
|
||||
done
|
||||
|
||||
|
||||
[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
|
||||
|
||||
for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
|
||||
done
|
||||
)
|
||||
done
|
||||
|
||||
for p in $(getargs rd.driver.post -d rdinsmodpost=); do
|
||||
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
|
||||
[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
|
||||
unset _do_insmodpost _modprobe_d
|
||||
unset i
|
||||
|
||||
export -p > /dracut-state.sh
|
||||
service="${0##*/}"
|
||||
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
|
||||
exit 0
|
||||
|
11
modules.d/98systemd/dracut.target
Normal file
11
modules.d/98systemd/dracut.target
Normal file
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=dracut
|
||||
Requires=basic.target
|
||||
Conflicts=rescue.service rescue.target
|
||||
After=basic.target rescue.service rescue.target
|
||||
AllowIsolate=yes
|
||||
OnFailure=emergency.target
|
||||
OnFailureIsolate=yes
|
||||
|
||||
[Install]
|
||||
Alias=default.target
|
30
modules.d/98systemd/emergency.service
Normal file
30
modules.d/98systemd/emergency.service
Normal file
@@ -0,0 +1,30 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# See systemd.special(7) for details
|
||||
|
||||
[Unit]
|
||||
Description=Emergency Shell
|
||||
DefaultDependencies=no
|
||||
After=systemd-vconsole-setup.service
|
||||
Wants=systemd-vconsole-setup.service
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/
|
||||
WorkingDirectory=/
|
||||
ExecStart=/bin/dracut-emergency
|
||||
ExecStopPost=-/usr/bin/systemctl --no-block isolate dracut.target
|
||||
Type=oneshot
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
KillSignal=SIGHUP
|
@@ -1,26 +0,0 @@
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Switch Root
|
||||
Documentation=man:initrd-switch-root.service(8)
|
||||
DefaultDependencies=no
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
OnFailure=emergency.service
|
||||
After=initrd-switch-root.target
|
||||
AllowIsolate=yes
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
EnvironmentFile=/run/initramfs/switch-root.conf
|
||||
# we have to use "--force" here, otherwise systemd would umount /run
|
||||
ExecStart=-/usr/bin/systemctl --no-block --force switch-root ${NEWROOT} ${NEWINIT}
|
||||
ExecStopPost=-/bin/rm -f /run/initramfs/switch-root.conf
|
||||
StandardInput=null
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
KillMode=none
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user