@@ -21,6 +21,8 @@ arch="${arch:-$(uname -m)}"
21
21
case " ${arch} " in
22
22
amd64 | x86_64) arch=x86_64 ;;
23
23
aarch64 | arm64) arch=aarch64 ;;
24
+ armv7l | armhf) arch=armv7l ;;
25
+ riscv64) arch=riscv64 ;;
24
26
* )
25
27
echo " Unsupported arch: ${arch} " >&2
26
28
exit 1
29
31
30
32
# 2. extract location by parsing template using arch
31
33
readonly yq_filter="
32
- [
33
- .images | map(select(.arch == \" ${arch} \" )) | [.[].location]
34
- ]|flatten|.[]
34
+ .images[]|select(.arch == \" ${arch} \" )|.location
35
35
"
36
36
parsed=$( yq eval " ${yq_filter} " " ${template} " )
37
37
57
57
if [[ -z ${location} ]]; then
58
58
echo " Failed to get the image location for ${template} " >&2
59
59
exit 1
60
+ elif [[ ${location} == https://cloud-images.ubuntu.com/minimal/* ]]; then
61
+ readonly default_cmdline=" root=/dev/vda1 ro console=tty1 console=ttyAMA0"
60
62
elif [[ ${location} == https://cloud-images.ubuntu.com/* ]]; then
61
63
readonly default_cmdline=" root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyAMA0"
62
64
else
@@ -91,7 +93,7 @@ function inject_to() {
91
93
for field_name in location digest cmdline; do
92
94
[[ -z ${! field_name} ]] || fields+=(" \" ${field_name} \" : \" ${! field_name} \" " )
93
95
done
94
- yq -i -I 2 eval " setpath([(.images[] | select(.arch == \" ${arch} \" ) | path)].[${index} ] + \" ${key} \" ; { ${fields[*]} })" " ${template} "
96
+ limactl edit --log-level error --set " setpath([(.images[] | select(.arch == \" ${arch} \" ) | path)].[${index} ] + \" ${key} \" ; { ${fields[*]} })" " ${template} "
95
97
}
96
98
inject_to " ${template} " " ${arch} " " ${index} " " kernel" " ${kernel_location} " " ${kernel_digest} " " ${cmdline} "
97
99
inject_to " ${template} " " ${arch} " " ${index} " " initrd" " ${initrd_location} " " ${initrd_digest} "
0 commit comments