46 lines
1.5 KiB
Bash
46 lines
1.5 KiB
Bash
|
#!/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
|