Bug smashing with arch-chroot

This commit is contained in:
Price Hiller 2021-11-25 18:30:36 -06:00
parent ca6b5037fc
commit cb0e40f0e1

View File

@ -297,6 +297,9 @@ install() {
log "info" "Finished generating fstab"
log "info" "Switching to new installation and finishing up install"
arch-chroot /mnt << __END_CHROOT_CMDS__
echo Set your root password now
passwd
echo "arch" > /etc/hostname
cat << __EOF__ > "/etc/hosts"
127.0.0.1 localhost
@ -304,47 +307,23 @@ install() {
127.0.1.1 arch.localdomain arch
__EOF__
while read -r; do
if [[ "${REPLY}" = "HOOKS="* ]]; then
echo "HOOKS=(base udev autodetect keyboard modconf block encrypt filesystems fsck)"
else
echo "${REPLY}"
fi
done <<< "$(cat /etc/mkinitcpio.conf)" > mkinitcpio.tmp && mv mkinitcpio.tmp /etc/mkinitcpio.conf
sed 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
sed 's/HOOKS=(.*)/HOOKS=(base udev autodetect keyboard modconf block encrypt filesystems fsck)/' /etc/mkinitcpio.conf
mkinitcpio -P
echo "toor" | passwd root --stdin
local ucode
while read -r; do
if [[ "${REPLY}" = "*VendorID*" ]]; then
if [[ "${REPLY}" = "*AMD*" ]]; then
ucode="amd-ucode"
else
ucode="intel-ucode"
fi
fi
done <<< "$(lscpu)"
yes | pacman -S grub efibootmgr "${ucode}"
yes | pacman -S grub efibootmgr intel-ucode amd-ucode
local disk_uuid
disk_uuid="$(blkid -s UUID -o value "${install_path}p2")"
echo disk uuid: $disk_uuid
while read -r; do
if [[ "${REPLY}" = "*GRUB_CMD_LINE*" ]]; then
echo "GRUB_CMDLINE_LINUX=\"cryptdevice=UUID=${disk_uuid}:cryptroot\""
else
echo "${REPLY}"
fi
done <<< "$(cat /etc/default/grub)" > grub.tmp && mv grub.tmp /etc/default/grub
sed 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="cryptdevice=UUID=${disk_uuid}:cryptroot"'
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
yes | pacman -S networkmanager
systemctl enable NetworkManager
__END_CHROOT_CMDS__
log "info" "Finished, root password set to $(important "toor")"
log "info" "Next steps: update localities if incorrect, add your user, update the root password"
}