Skip to content

Commit 0d0a7f4

Browse files
authored
fix unexpected token `;;' on MacOS (#12)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent 29f83af commit 0d0a7f4

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

talos-bootstrap

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,23 @@ else
119119
#printf " - %s\n" $nodes
120120

121121
printf "%s\nXXX\n%s\nXXX\n" "60" "Collecting information about the nodes..."
122-
node_list=$(
123-
seen=
124-
for node in ${nodes}; do
125-
mac=$(talosctl -e "${node}" -n "${node}" get hardwareaddresses.net.talos.dev first ${OPTS} -o jsonpath='{.spec.hardwareAddr}')
126-
case " ${seen} " in *" ${mac} "*) continue ;; esac # remove duplicated nodes
127-
seen="${seen} ${mac}"
128-
name="${node}"
129-
hostname=$(talosctl -e "${node}" -n "${node}" get hostname ${OPTS} -o jsonpath='{.spec.hostname}')
130-
if [ -n "${hostname}" ]; then
131-
name="${name} (${hostname})"
132-
fi
133-
manufacturer=$(talosctl -e "${node}" -n "${node}" get cpu ${OPTS} -o jsonpath='{.spec.manufacturer}' | head -n1)
134-
cpu=$(talosctl -e "${node}" -n "${node}" get cpu ${OPTS} -o jsonpath='{.spec.threadCount}' | awk '{sum+=$1;} END{print sum "-core";}')
135-
ram=$(talosctl -e "${node}" -n "${node}" get ram -o json ${OPTS} | awk '/"sizeMiB":/ {sub(",", ""); sum+=$2} END{print sum/1024 "GB"}')
136-
disks=$(talosctl -e "${node}" -n "${node}" disks ${OPTS} | awk 'NR>1 {sub(/^[^/]*/, ""); print}' | awk -F' +' '{print $1 ":" $9}' | awk -F/ '$2 == "dev" {print $3}' | awk 'gsub(" ", "", $0)' | awk '$1=$1' RS="," OFS=",")
137-
echo "\"${name}\"" "\"${mac}, ${cpu} ${manufacturer:-CPU}, RAM: ${ram}, Disks: [${disks}]\""
138-
done
139-
)
140-
141-
echo "${node_list}" > "${node_list_file}"
122+
seen=
123+
for node in ${nodes}; do
124+
mac=$(talosctl -e "${node}" -n "${node}" get hardwareaddresses.net.talos.dev first ${OPTS} -o jsonpath='{.spec.hardwareAddr}')
125+
case " ${seen} " in *" ${mac} "*) continue ;; esac # remove duplicated nodes
126+
seen="${seen} ${mac}"
127+
name="${node}"
128+
hostname=$(talosctl -e "${node}" -n "${node}" get hostname ${OPTS} -o jsonpath='{.spec.hostname}')
129+
if [ -n "${hostname}" ]; then
130+
name="${name} (${hostname})"
131+
fi
132+
manufacturer=$(talosctl -e "${node}" -n "${node}" get cpu ${OPTS} -o jsonpath='{.spec.manufacturer}' | head -n1)
133+
cpu=$(talosctl -e "${node}" -n "${node}" get cpu ${OPTS} -o jsonpath='{.spec.threadCount}' | awk '{sum+=$1;} END{print sum "-core";}')
134+
ram=$(talosctl -e "${node}" -n "${node}" get ram -o json ${OPTS} | awk '/"sizeMiB":/ {sub(",", ""); sum+=$2} END{print sum/1024 "GB"}')
135+
disks=$(talosctl -e "${node}" -n "${node}" disks ${OPTS} | awk 'NR>1 {sub(/^[^/]*/, ""); print}' | awk -F' +' '{print $1 ":" $9}' | awk -F/ '$2 == "dev" {print $3}' | awk 'gsub(" ", "", $0)' | awk '$1=$1' RS="," OFS=",")
136+
echo "\"${name}\"" "\"${mac}, ${cpu} ${manufacturer:-CPU}, RAM: ${ram}, Disks: [${disks}]\"" >> "${node_list_file}"
137+
done
138+
142139
} | dialog --keep-tite --title talos-bootstrap --gauge "Please wait" 10 70 0 3>&1 1>&2 2>&3 || exit 0
143140

144141
node_list=$(cat "${node_list_file}")

0 commit comments

Comments
 (0)