fix: array iteration

This commit is contained in:
Peter Šurda 2021-03-02 15:52:44 +01:00
parent 51b53bd19a
commit 95f85da5b4
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -24,22 +24,22 @@ function update_syslinux_menu()
for part in $partitions; do for part in $partitions; do
version_from_partnum "$drive" "$part" version_from_partnum "$drive" "$part"
versions["$version"]=1 versions["$version"]=1
for f in $files; do for f in "${files[@]}"; do
if [ ! -e "$mnt"/"$imagepath"/"$f""$version" ]; then if [ ! -e "$mnt"/"$imagepath"/"$f""$version" ]; then
continue continue
fi fi
done done
cat >> "$mnt"/items.cfg << (EOL) cat >> "$mnt"/items.cfg << _EOL_
LABEL cloud-init-$version LABEL cloud-init-$version
MENU LABEL Ubuntu focal (MAAS $version) MENU LABEL Ubuntu focal (MAAS $version)
KERNEL $imagepath/boot-kernel.$version KERNEL $imagepath/boot-kernel.$version
APPEND initrd=$imagepath/boot-initrd.$version root=PARTLABEL="rootfs_$version" ip=dhcp overlayroot=tmpfs:recurse=0 ds=nocloud-net;s=https://box.sysdeploy.org/cloud-init/ APPEND initrd=$imagepath/boot-initrd.$version root=PARTLABEL="rootfs_$version" ip=dhcp overlayroot=tmpfs:recurse=0 ds=nocloud-net;s=https://box.sysdeploy.org/cloud-init/
(EOL) _EOL_
done done
# find expired # find expired
for f in $files; do for f in "${files[@]}"; do
for i in "$mnt"/"$imagepath"/"$f"*; do for i in "$mnt"/"$imagepath"/"$f"*; do
version="$(basename "$i"|cut -d_ -f2-)" version="$(basename "$i"|cut -d_ -f2-)"
if [ -z "${versions[$version]}" ]; then if [ -z "${versions[$version]}" ]; then