fix(rootfs-block): shellcheck for modules.d/95rootfs-block
parent
a15a7a1a34
commit
4cbe12a31f
|
|
@ -16,9 +16,9 @@ cmdline_journal() {
|
|||
[[ ${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
|
||||
|
|
@ -30,7 +30,8 @@ cmdline_journal() {
|
|||
}
|
||||
|
||||
cmdline_rootfs() {
|
||||
local _block=$(find_root_block_device)
|
||||
local _block
|
||||
_block=$(find_root_block_device)
|
||||
local _dev=/dev/block/$_block
|
||||
local _fstype _flags _subvol
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ cmdline_rootfs() {
|
|||
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 /)"
|
||||
|
|
@ -66,9 +67,11 @@ cmdline() {
|
|||
# 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
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
|
|||
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")
|
||||
|
|
@ -26,7 +25,7 @@ mount_root() {
|
|||
_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
|
||||
|
|
@ -34,6 +33,7 @@ mount_root() {
|
|||
READONLY=
|
||||
fsckoptions=
|
||||
if [ -f "$NEWROOT"/etc/sysconfig/readonly-root ]; then
|
||||
# shellcheck disable=SC1090
|
||||
. "$NEWROOT"/etc/sysconfig/readonly-root
|
||||
fi
|
||||
|
||||
|
|
@ -57,6 +57,7 @@ mount_root() {
|
|||
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
|
||||
|
|
@ -81,7 +82,7 @@ mount_root() {
|
|||
# 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
|
||||
|
||||
|
|
@ -105,15 +106,12 @@ mount_root() {
|
|||
# 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
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ case "${root#block:}" in
|
|||
;;
|
||||
/dev/*)
|
||||
root="block:${root#block:}"
|
||||
# shellcheck disable=SC2034
|
||||
rootok=1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue