androot/bootscriptdl.sh
JeremyStarTM 8e0e3f63a1 Update files
- [androot.sh] Fix $DOWNLOADSERVER_BOOTSCRIPTS
- [androot.sh] Add $BRANCH variable
- [androot.sh] Introduce run_script() function
- [androot.sh] Use case instead of if
- [prepare.sh] Fix typo (executer -> executor)
- [rootfsinstall.sh] Remove "bsdtar failed" log line
- [bootscriptdl.sh] Trim download mode
- [bootscriptdl.sh] Implement install-qemu mode
- [README.md] Changed wording and added links
- [README.md] Add /dev/shm recommendation
- [Makefile,README.md] Add Makefile
2023-11-07 20:54:57 +01:00

56 lines
No EOL
2 KiB
Bash
Executable file

#!/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