Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion hack/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -Eeuo pipefail
OPT_MULTIPORT=false
OPT_SYNC_BRIDGE=false
OPT_ALLOW_ULA=false
OPT_NODE_IP=""

BLUEFIELD_IDENTIFIERS=("MT_0000000543" "MT_0000000541")
MAX_NUMVFS_POSSIBLE=126
Expand Down Expand Up @@ -361,7 +362,11 @@ function make_config() {
conf_pf0="$(get_ifname 0)"
conf_pf1="$(get_ifname 1)"
conf_vf_pattern="$(get_pattern "${devs[0]}")"
conf_ipv6="$(get_ipv6)"
if [[ -n "$OPT_NODE_IP" ]]; then
conf_ipv6="$OPT_NODE_IP"
else
conf_ipv6="$(get_ipv6)"
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good candidate for bash parameter expansion ${parameter:−word}

Untested, but this should be it:

conf_ipv6=${OPT_NODE_IP:-$(get_ipv6)}


{ echo "# This has been generated by prepare.sh"
echo "no-stats"
Expand Down Expand Up @@ -438,6 +443,10 @@ while [[ $# -gt 0 ]]; do
--allow-ula)
OPT_ALLOW_ULA=true
;;
--node-ip)
shift
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bash getopt expert, but why is there only this shift and not for all of the arguments?

OPT_NODE_IP="$1"
;;
*)
err "Invalid argument $1"
esac
Expand Down
Loading