18 inst_multiple mount mknod mkdir
sleep chroot chown \
19 sed ls flock
cp mv dmesg
rm ln rmmod
mkfifo umount readlink setsid \
22 inst_multiple
-o findmnt
less kmod
24 if [ ! -e "${initdir}/bin/sh" ]; then
26 (ln -s bash
"${initdir}/bin/sh" ||
:)
29 # add common users in /etc/passwd, it will be used by nfs/ssh currently
30 # use password for hostonly images to facilitate secure sulogin in emergency console
31 [[ $hostonly ]] && pwshadow
='x'
32 grep '^root:' "$initdir/etc/passwd" 2>/dev
/null ||
echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
33 grep '^nobody:' $dracutsysrootdir/etc
/passwd
>> "$initdir/etc/passwd"
35 [[ $hostonly ]] && grep '^root:' $dracutsysrootdir/etc
/shadow
>> "$initdir/etc/shadow"
37 # install our scripts and hooks
38 inst_script
"$moddir/init.sh" "/init"
39 inst_script
"$moddir/initqueue.sh" "/sbin/initqueue"
40 inst_script
"$moddir/loginit.sh" "/sbin/loginit"
41 inst_script
"$moddir/rdsosreport.sh" "/sbin/rdsosreport"
42 inst_script
"$moddir/memtrace-ko.sh" "/sbin/tracekomem"
44 [ -e "${initdir}/lib" ] || mkdir
-m 0755 -p ${initdir}/lib
45 mkdir
-m 0755 -p ${initdir}/lib
/dracut
46 mkdir
-m 0755 -p ${initdir}/lib
/dracut
/hooks
48 mkdir
-p ${initdir}/tmp
50 inst_simple
"$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
51 mkdir
-p "${initdir}/var"
53 if ! dracut_module_included
"systemd"; then
54 inst_multiple switch_root || dfatal
"Failed to install switch_root"
55 inst_hook cmdline
10 "$moddir/parse-root-opts.sh"
56 inst_multiple
-o $systemdutildir/systemd-timestamp
59 if [[ $realinitpath ]]; then
60 for i
in $realinitpath; do
61 echo "rd.distroinit=$i"
62 done > "${initdir}/etc/cmdline.d/distroinit.conf"
65 ln -fs /proc
/self
/mounts
"$initdir/etc/mtab"
66 if [[ $ro_mnt = yes ]]; then
67 echo ro
>> "${initdir}/etc/cmdline.d/base.conf"
70 [ -e "${initdir}/usr/lib" ] || mkdir
-m 0755 -p ${initdir}/usr
/lib
74 # Derive an os-release file from the host, if it exists
75 if [ -e $dracutsysrootdir/etc
/os-release
]; then
76 .
$dracutsysrootdir/etc
/os-release
77 grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' $dracutsysrootdir/etc
/os-release
>${initdir}/usr
/lib
/initrd-release
78 [[ -n ${VERSION} ]] && VERSION
+=" "
79 [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME
+=" "
81 # Fall back to synthesizing one, since dracut is presently used
82 # on non-systemd systems as well.
86 echo VERSION_ID
=\"$DRACUT_VERSION\"
87 echo ANSI_COLOR
='"0;34"'
88 } >${initdir}/usr
/lib
/initrd-release
90 VERSION
+="dracut-$DRACUT_VERSION"
91 PRETTY_NAME
+="dracut-$DRACUT_VERSION (Initramfs)"
93 echo VERSION
=\"$VERSION\"
94 echo PRETTY_NAME
=\"$PRETTY_NAME\"
95 # This addition is relatively new, intended to allow software
96 # to easily detect the dracut version if need be without
97 # having it mixed in with the real underlying OS version.
98 echo DRACUT_VERSION
=\"${DRACUT_VERSION}\"
99 } >> $initdir/usr
/lib
/initrd-release
100 echo dracut-
$DRACUT_VERSION > $initdir/lib
/dracut
/dracut-
$DRACUT_VERSION
101 ln -sf ..
/usr
/lib
/initrd-release
$initdir/etc
/initrd-release
102 ln -sf initrd-release
$initdir/usr
/lib
/os-release
103 ln -sf initrd-release
$initdir/etc
/os-release
105 ## save host_devs which we need bring up
106 if [[ $hostonly_cmdline == "yes" ]]; then
107 if [[ -n "${host_devs[@]}" ]]; then
108 dracut_need_initqueue
110 if [[ -f "$initdir/lib/dracut/need-initqueue" ]] ||
! dracut_module_included
"systemd"; then
112 if dracut_module_included
"systemd"; then
117 .
"$moddir/dracut-lib.sh"
119 for _dev
in "${host_devs[@]}"; do
120 for _dev2
in "${root_devs[@]}"; do
121 [[ "$_dev" == "$_dev2" ]] && continue 2
124 # We only actually wait for real devs - swap is only needed
125 # for resume and udev rules generated when parsing resume=
126 # argument take care of the waiting for us
127 for _dev2
in "${swap_devs[@]}"; do
128 [[ "$_dev" == "$_dev2" ]] && continue 2
131 _pdev
=$
(get_persistent_dev
$_dev)
134 /dev
/?
*) wait_for_dev
$_pdev;;