androot/bootscriptdl.sh
JeremyStarTM 3f0f0e0113 Update code
CHANGES
- [androot.sh] Improve code quality
- [androot.sh] Modify DOWNLOADSERVER* variables
- [patch.sh] Implement rootfs patching
- [prepare.sh] Squashed bugs
- [rootfsbuilder/archlinux-x86_64.sh] Remove "copy pacman config" flag causing some issues
- [systeminstall.sh] Implement rootfs configuration and update script

BUGS
- [systeminstall.sh|patch.sh] Scripts only work on the same architecture as the host
2023-11-10 15:08:35 +01:00

59 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
# disable errors regarding androot.source as
# it is created and loaded at runtime
# shellcheck disable=SC1091
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"
indicate_exec "Downloading bootscripts"
log_write "#### download bootscripts repository"
if ! log_execute git clone --quiet --verbose -b "${BRANCH}-bootscripts" "${DOWNLOADSERVER_BOOTSCRIPTS}" "${LOCATION}/bootscripts"; then
indicate_fail
exit 1
fi
indicate_ok
;;
"--configure")
log_diag "Using configure mode"
indicate_exec "Configuring bootscript scripts"
log_execute cd "${LOCATION}/bootscripts/" ||{ indicate_fail; exit 1; }
log_write "#### writing bootscripts config.env"
cat << EOF >> "${LOCATION}/bootscripts/config.env"
COMMIT=$(git rev-parse HEAD)
LOCATION=${LOCATION}
ARCHITECTURE=${ARCH_TARGET}
IS_ANDROID=${IS_ANDROID}
EOF
indicate_ok
;;
"--install-qemu")
log_diag "Using install-qemu mode"
for ARCH_DOWNLOAD in ${ARCH_EXECUTORS}; do
indicate_exec "Installing qemu-static for ${ARCH_DOWNLOAD}"
log_write "#### download qemu-static for ${ARCH_DOWNLOAD}"
if ! log_execute wget "${DOWNLOADSERVER}/qemu-static/${ARCH_DOWNLOAD}.tar.gz" --no-verbose -O "${TMPDIR}/${ARCH_DOWNLOAD}.tar.gz"; then
indicate_fail;
exit 1
fi
log_write "#### extract qemu-static for ${ARCH_DOWNLOAD}"
if ! log_execute mkdir -p "${LOCATION}/bootscripts/qemu-static/${ARCH_DOWNLOAD}"; then
indicate_fail;
exit 1
fi
if ! log_execute bsdtar -xf "${TMPDIR}/${ARCH_DOWNLOAD}.tar.gz" -C "${LOCATION}/bootscripts/qemu-static/${ARCH_DOWNLOAD}/"; then
indicate_fail;
exit 1
fi
indicate_ok
done
;;
*)
log_error "--download or --decompress required"
exit 1
;;
esac