01: Resolve dependencies in build script, use proper, findable paths

This commit is contained in:
Salt 2019-08-30 03:27:18 -05:00
parent 44e422b591
commit 8c7e54138e

View File

@ -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"