pushd . > /dev/null
for_each_host_dev_and_slaves is_nvmf
local _is_nvmf=$?
- popd > /dev/null
+ popd > /dev/null || exit
[[ $_is_nvmf == 0 ]] || return 255
if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ]; then
if [ ! -f /etc/nvme/discovery.conf ]; then
done
[ -z "$trtype" ] && return 0
- nvme list-subsys ${PWD##*/} | while read x dev trtype traddr host_traddr state ana; do
+ nvme list-subsys "${PWD##*/}" | while read -r _ _ trtype traddr host_traddr _; do
[ "$trtype" != "${trtype#NQN}" ] && continue
echo -n " nvmf.discover=$trtype,${traddr#traddr=},${host_traddr#host_traddr=}"
done
[[ $hostonly ]] || [[ $mount_needs ]] && {
pushd . > /dev/null
for_each_host_dev_and_slaves gen_nvmf_cmdline
- popd > /dev/null
+ popd > /dev/null || exit
}
}
# called by dracut
install() {
if [[ $hostonly_cmdline == "yes" ]]; then
- local _nvmf_args=$(cmdline)
+ local _nvmf_args
+ _nvmf_args=$(cmdline)
[[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf"
fi
inst_simple "/etc/nvme/hostnqn"
return 1
fi
- local_address=$(ip -o route get to $traddr | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
+ local_address=$(ip -o route get to "$traddr" | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
# confirm we got a local IP address
if ! is_ip "$local_address"; then
return 1
fi
- ifname=$(ip -o route get to $local_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
+ ifname=$(ip -o route get to "$local_address" | sed -n 's/.*dev \([^ ]*\).*/\1/p')
if ip l show "$ifname" > /dev/null 2>&1; then
warn "invalid network interface $ifname"
trsvcid=4420
OLDIFS="$IFS"
IFS=,
- set $1
+ # shellcheck disable=SC2086
+ set -- $1
IFS="$OLDIFS"
case $# in
if [ -f "/etc/nvme/discovery.conf" ]; then
/sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
if [ "$trtype" = "tcp" ]; then
- > /tmp/net.$ifname.did-setup
+ : > /tmp/net."$ifname".did-setup
fi
else
# No nvme command line arguments present, try autodiscovery