summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-09-01 15:35:51 +0200
committerChristian Breunig <christian@breunig.cc>2026-09-01 15:37:23 +0200
commit50055b79b1c75837549de02e05c4b9877e4c4262 (patch)
tree13f30b85cf2e2f3d124d017608e461886ff909a9 /scripts
parent8f372f6d6811bbe4df35b4ec81a68ea8f3813a87 (diff)
downloadvyos-build-50055b79b1c75837549de02e05c4b9877e4c4262.tar.gz
vyos-build-50055b79b1c75837549de02e05c4b9877e4c4262.zip
oci: T9269: use list of dependent tools
Instead of duplicating the code testing if a binary is present required for the script, use a list and loop instead.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/iso-to-oci33
1 files changed, 16 insertions, 17 deletions
diff --git a/scripts/iso-to-oci b/scripts/iso-to-oci
index 6c3f58c9..bc132681 100755
--- a/scripts/iso-to-oci
+++ b/scripts/iso-to-oci
@@ -20,23 +20,22 @@ fi
# ensure clean working directory
cleanup
-if ! command -v xorriso >/dev/null 2>&1; then
- echo "E: missing dependency: xorriso"
- echo " Install xorriso (recommended) or run inside the vyos-build container."
- exit 2
-fi
-
-if ! command -v unsquashfs >/dev/null 2>&1; then
- echo "E: missing dependency: unsquashfs"
- echo " Install squashfs-tools or run inside the vyos-build container."
- exit 2
-fi
-
-if ! command -v jq >/dev/null 2>&1; then
- echo "E: missing dependency: jq"
- echo " Install jq or run inside the vyos-build container."
- exit 2
-fi
+# required commands and the Debian package providing them
+declare -A REQUIRED_COMMANDS=(
+ [xorriso]="xorriso"
+ [unsquashfs]="squashfs-tools"
+ [jq]="jq"
+ [tar]="tar"
+ [xz]="xz-utils"
+)
+
+for cmd in "${!REQUIRED_COMMANDS[@]}"; do
+ if ! command -v "${cmd}" >/dev/null 2>&1; then
+ echo "E: missing dependency: ${cmd}"
+ echo " Install ${REQUIRED_COMMANDS[$cmd]} or run inside the vyos-build container."
+ exit 2
+ fi
+done
WORKDIR="$(mktemp -d -t iso-to-oci.XXXXXXXXXX)"
trap cleanup EXIT