androot/systeminstall.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

45 lines
1.5 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 "systeminstall is now executing, with arguments \"${*}\""
case "${1}" in
"--configure")
log_diag "Using configure mode"
indicate_exec "Configuring rootfs"
if ! log_execute rm -rf "${LOCATION}/rootfs/etc/resolv.conf"; then indicate_fail; exit 1; fi
echo "nameserver 1.1.1.1" > "${LOCATION}/rootfs/etc/resolv.conf"
if [ "${DISTRIBUTION}" == "archlinux" ]; then
if ! chroot_env "${LOCATION}/mountdir" "pacman-key --init"; then
indicate_fail
exit 1
fi
if ! chroot_env "${LOCATION}/mountdir" "pacman-key --populate"; then
indicate_fail
exit 1
fi
OUTPUT=$(sed "s/\#Server \= https\:\/\/geo\.mirror\.pkgbuild\.com\/\\\$repo\/os\/\\\$arch/Server \= https\:\/\/geo\.mirror\.pkgbuild\.com\/\\\$repo\/os\/\\\$arch/g" < "${LOCATION}/rootfs/etc/pacman.d/mirrorlist")
echo "${OUTPUT}" &> "${LOCATION}/rootfs/etc/pacman.d/mirrorlist"
fi
indicate_ok
;;
"--update")
log_diag "Using update mode"
indicate_exec "Updating rootfs"
if [ "${DISTRIBUTION}" == "archlinux" ]; then
if ! chroot_env "${LOCATION}/mountdir" "pacman -Syu --noconfirm"; then
indicate_fail
exit 1
fi
fi
indicate_ok
;;
*)
log_error "--configure or --update required"
exit 1
;;
esac