3 type getarg
>/dev
/null
2>&1 || .
/lib
/dracut-lib.sh
4 type det_fs
>/dev
/null
2>&1 || .
/lib
/fs-lib.sh
9 # sanity - determine/fix fstype
10 rootfs
=$
(det_fs
"${root#block:}" "$fstype")
12 journaldev
=$
(getarg
"root.journaldev=")
13 if [ -n "$journaldev" ]; then
16 rflags
="${rflags:+${rflags},}logdev=$journaldev"
19 fsckoptions
="-j $journaldev $fsckoptions"
20 rflags
="${rflags:+${rflags},}jdev=$journaldev"
26 _rflags_ro
="$rflags,ro"
27 _rflags_ro
="${_rflags_ro##,}"
29 while ! mount
-t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
30 warn
"Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"
36 if [ -f "$NEWROOT"/etc
/sysconfig
/readonly-root
]; then
37 .
"$NEWROOT"/etc
/sysconfig
/readonly-root
40 if getargbool
0 "readonlyroot=" -y readonlyroot
; then
44 if getarg noreadonlyroot
; then
48 if [ -f "$NEWROOT"/fastboot
] || getargbool
0 fastboot
; then
52 if ! getargbool
0 rd.skipfsck
; then
53 if [ -f "$NEWROOT"/fsckoptions
]; then
54 fsckoptions
=$
(cat "$NEWROOT"/fsckoptions
)
57 if [ -f "$NEWROOT"/forcefsck
] || getargbool
0 forcefsck
; then
58 fsckoptions
="-f $fsckoptions"
59 elif [ -f "$NEWROOT"/.autofsck
]; then
60 [ -f "$NEWROOT"/etc
/sysconfig
/autofsck
] && \
61 .
"$NEWROOT"/etc
/sysconfig
/autofsck
62 if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
63 AUTOFSCK_OPT
="$AUTOFSCK_OPT -f"
65 if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
66 warn
"*** Warning -- the system did not shut down cleanly. "
67 warn
"*** Dropping you to a shell; the system will continue"
68 warn
"*** when you leave the shell."
71 fsckoptions
="$AUTOFSCK_OPT $fsckoptions"
76 if getargbool
1 rd.fstab
-d -n rd_NO_FSTAB \
77 && ! getarg rootflags \
78 && [ -f "$NEWROOT/etc/fstab" ] \
79 && ! [ -L "$NEWROOT/etc/fstab" ]; then
80 # if $NEWROOT/etc/fstab contains special mount options for
81 # the root filesystem,
82 # remount it with the proper options
84 while read dev mp fs opts dump fsck ||
[ -n "$dev" ]; do
86 [ "${dev%%#*}" != "$dev" ] && continue
88 if [ "$mp" = "/" ]; then
89 # sanity - determine/fix fstype
90 rootfs
=$
(det_fs
"${root#block:}" "$fs")
95 done < "$NEWROOT/etc/fstab"
98 # we want rootflags (rflags) to take precedence so prepend rootopts to
100 rflags
="${rootopts},${rflags}"
104 # backslashes are treated as escape character in fstab
105 # esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
106 # printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab
109 if fsck_able
"$rootfs" && \
110 [ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] && \
111 ! strstr
"${rflags}" _netdev
&& \
112 ! getargbool
0 rd.skipfsck
; then
114 fsck_single
"${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
119 echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 $rootfsck" >> /etc
/fstab
121 if ! ismounted
"$NEWROOT"; then
122 info
"Mounting ${root#block:} with -o ${rflags}"
123 mount
"$NEWROOT" 2>&1 | vinfo
124 elif ! are_lists_eq
, "$rflags" "$_rflags_ro" defaults
; then
125 info
"Remounting ${root#block:} with -o ${rflags}"
126 mount
-o remount
"$NEWROOT" 2>&1 | vinfo
129 if ! getargbool
0 rd.skipfsck
; then
130 [ -f "$NEWROOT"/forcefsck
] && rm -f -- "$NEWROOT"/forcefsck
2>/dev
/null
131 [ -f "$NEWROOT"/.autofsck
] && rm -f -- "$NEWROOT"/.autofsck
2>/dev
/null
135 if [ -n "$root" -a -z "${root%%block:*}" ]; then