From 8c7e54138ef0b3d7914244e7d93c9938587cf8d4 Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 30 Aug 2019 03:27:18 -0500 Subject: [PATCH] 01: Resolve dependencies in build script, use proper, findable paths --- 01-installer-iso/build.bash | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/01-installer-iso/build.bash b/01-installer-iso/build.bash index 0f0810b..b6564e8 100755 --- a/01-installer-iso/build.bash +++ b/01-installer-iso/build.bash @@ -6,7 +6,26 @@ # Distributed under terms of the MIT license. # +bindir="$(dirname "$(readlink -f "$0")")" +pushd "$bindir" +for prog in dos2unix p7zip cpio genisoimage whois pwgen wget fakeroot /usr/lib/ISOLINUX/isolinux.bin xorriso; do + if command -v "$prog" > /dev/null 2>&1 || [ -f "$prog" ]; then continue; else + echo "Missing critical dependency: $prog" + if sudo apt install dos2unix p7zip-full cpio gzip genisoimage whois pwgen wget fakeroot isolinux xorriso -y; then + break + else + echo "Failed to install critical dependencies" + exit 51 + fi + fi +done +idfile="$PWD/id_rsa.pub" +isopath="$(realpath "$PWD/../build")" +mkdir -p "$isopath" || exit 52 +isofile="$isopath/installer.iso" +echo "Using SSH key \"$idfile\"" +echo "Writing to file \"$isofile\"" exec "./linux-unattended-installation/ubuntu/18.04/build-iso.sh" \ - "id_rsa.pub" \ - "../build/installer.iso" + "$idfile" \ + "$isofile"