2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
5 type info
>/dev
/null
2>&1 || .
/lib
/dracut-lib.sh
6 type fsck_single
>/dev
/null
2>&1 || .
/lib
/fs-lib.sh
15 if [ -f "$NEWROOT"/fsckoptions
]; then
16 _fsckoptions
=$
(cat "$NEWROOT"/fsckoptions
)
19 if [ -f "$NEWROOT"/forcefsck
] || getargbool
0 forcefsck
; then
20 _fsckoptions
="-f $_fsckoptions"
21 elif [ -f "$NEWROOT"/.autofsck
]; then
22 [ -f "$NEWROOT"/etc
/sysconfig
/autofsck
] && .
"$NEWROOT"/etc
/sysconfig
/autofsck
23 if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
24 AUTOFSCK_OPT
="$AUTOFSCK_OPT -f"
26 if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
27 warn
"*** Warning -- the system did not shut down cleanly. "
28 warn
"*** Dropping you to a shell; the system will continue"
29 warn
"*** when you leave the shell."
32 _fsckoptions
="$AUTOFSCK_OPT $_fsckoptions"
35 fsck_single
"$_dev" "$_fs" "$_fsopts" "$_fsckoptions"
40 local _dev _mp _fs _opts _rest _usr_found _ret _freq _passno
41 # check, if we have to mount the /usr filesystem
42 while read _dev _mp _fs _opts _freq _passno
; do
43 [ "${_dev%%#*}" != "$_dev" ] && continue
44 if [ "$_mp" = "/usr" ]; then
47 _dev
="$(echo $_dev | sed 's,/,\\x2f,g')"
48 _dev
="/dev/disk/by-label/${_dev#LABEL=}"
52 _dev
="/dev/disk/by-uuid/${_dev#UUID=}"
55 if strstr
"$_opts" "subvol=" && \
56 [ "${root#block:}" -ef $_dev ]
57 [ -n "$rflags" ]; then
58 # for btrfs subvolumes we have to mount /usr with the same rflags
59 _opts
="${_opts:+${_opts},}${rflags}"
60 elif getargbool
0 ro
; then
61 # if "ro" is specified, we want /usr to be mounted read-only
62 _opts
="${_opts:+${_opts},}ro"
63 elif getargbool
0 rw
; then
64 # if "rw" is specified, we want /usr to be mounted read-write
65 _opts
="${_opts:+${_opts},}rw"
67 echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_freq $_passno"
71 done < "$NEWROOT/etc/fstab" >> /etc
/fstab
73 if [ "x$_usr_found" != "x" ]; then
74 # we have to mount /usr
76 if ! getargbool
0 rd.skipfsck
; then
77 if [ "0" != "${_passno:-0}" ]; then
78 fsck_usr
"$_dev" "$_fs" "$_opts"
80 [ $_fsck_ret -ne 255 ] && echo $_fsck_ret >/run
/initramfs
/usr-fsck
84 info
"Mounting /usr with -o $_opts"
85 mount
"$NEWROOT/usr" 2>&1 | vinfo
87 if ! ismounted
"$NEWROOT/usr"; then
88 warn
"Mounting /usr to $NEWROOT/usr failed"
89 warn
"*** Dropping you to a shell; the system will continue"
90 warn
"*** when you leave the shell."
96 if [ -f "$NEWROOT/etc/fstab" ]; then