#!/bin/bash # shellcheck disable=SC2181 disable=SC1091 disable=SC2236 source "${TMPDIR}/androot.source" source "${TMPDIR}/androot.env" log_diag "rootfsinstall is now executing, with arguments \"${*}\"" case "${1}" in "--download") log_diag "Using download mode" log_exec "Downloading bootscripts" echo "#### download bootscripts repository" &>> "${TMPDIR}/androot.log" git clone --quiet --verbose -b "${BRANCH}-bootscripts" "${DOWNLOADSERVER_BOOTSCRIPTS}" "${LOCATION}/bootscripts" &>> "${TMPDIR}/androot.log" if [ ! "${?}" == "0" ]; then log_fail exit 1 fi log_ok;; "--configure") log_diag "Using configure mode" log_exec "Configuring bootscript scripts" cd "${LOCATION}/bootscripts/"||{ log_error "cd failed";exit 1; } echo "#### writing bootscripts config.env" &>> "${TMPDIR}/androot.log" cat << EOF >> "${LOCATION}/bootscripts/config.env" COMMIT=$(git rev-parse HEAD) LOCATION=${LOCATION} IS_ANDROID=${IS_ANDROID} EOF log_ok;; "--install-qemu") log_diag "Using install-qemu mode" for ARCH_DOWNLOAD in ${ARCH_EXECUTORS}; do log_exec "Installing qemu-static for ${ARCH_DOWNLOAD}" echo "#### download qemu-static for ${ARCH_DOWNLOAD}" &>> "${TMPDIR}/androot.log" wget "${DOWNLOADSERVER_QEMUSTATIC}${ARCH_DOWNLOAD}.tar.gz" -qqq -O "${TMPDIR}/${ARCH_DOWNLOAD}.tar.gz" &>> "${TMPDIR}/androot.log" if [ ! "${?}" == "0" ]; then log_fail; exit 1 fi echo "#### extract qemu-static for ${ARCH_DOWNLOAD}" &>> "${TMPDIR}/androot.log" mkdir -p "${LOCATION}/bootscripts/qemu-static/${ARCH_DOWNLOAD}" if [ ! "${?}" == "0" ]; then log_fail; exit 1 fi bsdtar -xf "${TMPDIR}/${ARCH_DOWNLOAD}.tar.gz" -C "${LOCATION}/bootscripts/qemu-static/${ARCH_DOWNLOAD}/" &>> "${TMPDIR}/andronix.log" if [ ! "${?}" == "0" ]; then log_fail; exit 1 fi log_ok done;; *) log_error "--download or --decompress required" exit 1;; esac