[[ ${host_fs_types[$dev]} == "reiserfs" ]] || [[ ${host_fs_types[$dev]} == "xfs" ]] || continue
rootopts=$(find_dev_fsopts "$dev")
if [[ ${host_fs_types[$dev]} == "reiserfs" ]]; then
- journaldev=$(fs_get_option $rootopts "jdev")
+ journaldev=$(fs_get_option "$rootopts" "jdev")
elif [[ ${host_fs_types[$dev]} == "xfs" ]]; then
- journaldev=$(fs_get_option $rootopts "logdev")
+ journaldev=$(fs_get_option "$rootopts" "logdev")
fi
if [ -n "$journaldev" ]; then
}
cmdline_rootfs() {
- local _block=$(find_root_block_device)
+ local _block
+ _block=$(find_root_block_device)
local _dev=/dev/block/$_block
local _fstype _flags _subvol
return
fi
- if [ -n "$_block" -a -b $_dev ]; then
+ if [ -n "$_block" -a -b "$_dev" ]; then
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")"
fi
_fstype="$(find_mp_fstype /)"
# called by dracut
install() {
if [[ $hostonly_cmdline == "yes" ]]; then
- local _journaldev=$(cmdline_journal)
+ local _journaldev
+ _journaldev=$(cmdline_journal)
[[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
- local _rootdev=$(cmdline_rootfs)
+ local _rootdev
+ _rootdev=$(cmdline_rootfs)
[[ $_rootdev ]] && printf "%s\n" "$_rootdev" >> "${initdir}/etc/cmdline.d/95root-dev.conf"
fi
type det_fs > /dev/null 2>&1 || . /lib/fs-lib.sh
mount_root() {
- local _ret
local _rflags_ro
# sanity - determine/fix fstype
rootfs=$(det_fs "${root#block:}" "$fstype")
_rflags_ro="$rflags,ro"
_rflags_ro="${_rflags_ro##,}"
- while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
+ while ! mount -t "${rootfs}" -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"
fsck_ask_err
done
READONLY=
fsckoptions=
if [ -f "$NEWROOT"/etc/sysconfig/readonly-root ]; then
+ # shellcheck disable=SC1090
. "$NEWROOT"/etc/sysconfig/readonly-root
fi
if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
fsckoptions="-f $fsckoptions"
elif [ -f "$NEWROOT"/.autofsck ]; then
+ # shellcheck disable=SC1090
[ -f "$NEWROOT"/etc/sysconfig/autofsck ] \
&& . "$NEWROOT"/etc/sysconfig/autofsck
if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
# the root filesystem,
# remount it with the proper options
rootopts="defaults"
- while read dev mp fs opts dump fsck || [ -n "$dev" ]; do
+ while read -r dev mp fs opts _ fsck || [ -n "$dev" ]; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue
# esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
# printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab
- ran_fsck=0
if fsck_able "$rootfs" \
&& [ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] \
&& ! strstr "${rflags}" _netdev \
&& ! getargbool 0 rd.skipfsck; then
umount "$NEWROOT"
fsck_single "${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
- _ret=$?
- ran_fsck=1
fi
echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 ${rootfsck:-0}" >> /etc/fstab