Browse Source

fix(nbd): shellcheck for modules.d/95nbd

master
Harald Hoyer 3 years ago committed by Harald Hoyer
parent
commit
a201be999e
  1. 0
      modules.d/95nbd/.shchkdir
  2. 2
      modules.d/95nbd/module-setup.sh
  3. 7
      modules.d/95nbd/nbdroot.sh
  4. 1
      modules.d/95nbd/parse-nbdroot.sh

0
modules.d/95nbd/.shchkdir

2
modules.d/95nbd/module-setup.sh

@ -33,7 +33,7 @@ install() { @@ -33,7 +33,7 @@ install() {
inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot"
if dracut_module_included "systemd-initrd"; then
inst_script "$moddir/nbd-generator.sh" $systemdutildir/system-generators/dracut-nbd-generator
inst_script "$moddir/nbd-generator.sh" "$systemdutildir"/system-generators/dracut-nbd-generator
fi
dracut_need_initqueue
}

7
modules.d/95nbd/nbdroot.sh

@ -14,6 +14,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin @@ -14,6 +14,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
[ -z "$3" ] && exit 1

# root is in the form root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
# shellcheck disable=SC2034
netif="$1"
nroot="$2"
NEWROOT="$3"
@ -89,7 +90,7 @@ fsopts=${fsopts:+$fsopts,}${nbdrw} @@ -89,7 +90,7 @@ fsopts=${fsopts:+$fsopts,}${nbdrw}
i=0
while [ ! -b /dev/nbd0 ]; do
[ $i -ge 20 ] && exit 1
if [ $UDEVVERSION -ge 143 ]; then
if [ "$UDEVVERSION" -ge 143 ]; then
udevadm settle --exit-if-exists=/dev/nbd0
else
sleep 0.1
@ -111,7 +112,7 @@ if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then @@ -111,7 +112,7 @@ if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then

printf '/bin/mount %s\n' \
"$NEWROOT" \
> $hookdir/mount/01-$$-nbd.sh
> "$hookdir"/mount/01-$$-nbd.sh
fi
# if we're on systemd, use the nbd-generator script
# to create the /sysroot mount.
@ -129,7 +130,7 @@ else @@ -129,7 +130,7 @@ else
fi

nbd-client -check /dev/nbd0 > /dev/null \
|| nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
|| nbd-client "$nbdserver" "$nbdport" /dev/nbd0 "$preopts" "$opts" || exit 1

# NBD doesn't emit uevents when it gets connected, so kick it
echo change > /sys/block/nbd0/uevent

1
modules.d/95nbd/parse-nbdroot.sh

@ -52,6 +52,7 @@ unset nroot @@ -52,6 +52,7 @@ unset nroot
incol2 /proc/devices nbd || modprobe nbd || die "nbdroot requested but kernel/initrd does not support nbd"

# Done, all good!
# shellcheck disable=SC2034
rootok=1

# Shut up init error check

Loading…
Cancel
Save