ansible/installeriso/build.bash
2019-08-30 04:14:49 -05:00

32 lines
926 B
Bash
Executable File

#! /bin/bash
#
# build.bash
# Copyright (C) 2019 Vintage Salt <rehashedsalt@cock.li>
#
# 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" \
"$idfile" \
"$isofile"