From 195a954060081b92cf0fc8dcb57070cd271a6fdc Mon Sep 17 00:00:00 2001 From: Phillip Date: Sat, 7 Sep 2024 20:13:10 +0100 Subject: [PATCH] Added prompts for user credentials, moved some of root config script. --- scripts/0-install.sh | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/scripts/0-install.sh b/scripts/0-install.sh index fef3c09..8cd60c6 100644 --- a/scripts/0-install.sh +++ b/scripts/0-install.sh @@ -1,5 +1,5 @@ #!/bin/sh -echo "Building initial system" +echo "We just need to ask some questions before installing" # Get drive values for installation lsblk read -p 'Please enter the drive value for the root partition, this partition will be wiped and formatted: ' rootpar @@ -8,8 +8,6 @@ read -p 'Please enter the drive value for the EFI partition: ' efipar mkfs.ext4 /dev/$rootpar # Mount root partition mount /dev/$rootpar /mnt -# Run pacstrap and install base packages -pacstrap -i /mnt base base-devel linux linux-firmware linux-headers intel-ucode git openssh rsync networkmanager grub efibootmgr dosfstools os-prober nano dkms dbus-broker-units mkinitcpio iptables-nft # Ask if the EFI partition should be wiped before mounting read -p "Do you wish to wipe the EFI partition? If you already have an existing OS installed, say No. " yesno case $yesno in @@ -21,14 +19,11 @@ case $yesno in ;; * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";; esac -# Create the /boot/efi directory and mount the EFI partition to it -mkdir /mnt/boot/efi -mount /dev/$efipar /mnt/boot/efi # Ask if a home partition should be created read -p "Do you wish to set a home partition? " yesno case $yesno in [yesYesYy]* ) - read -p 'Please enter the drive value for the home partition: ' homepar + read -p 'Please enter the drive value for the home partition, this partition will be wiped: ' homepar mkfs.ext4 /dev/$homepar mount /dev/$homepar /mnt/home ;; @@ -37,6 +32,23 @@ case $yesno in ;; * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";; esac +# Get user credentials +read -p "Please enter a username " username +read -p "Please enter a password " password +read -p "Please re-enter the password " passwordconfirm +if [[ "$password" == "$password2" ]]; then + export USERNAME = $username + export PASSWORD = $password + echo "Credentials saved" +fi +# Set hostname, timezone and keyboard mapping +# We don't need to prompt for these since they will rarely change +export HOSTNAME="archlinux" +# Run pacstrap and install base packages +pacstrap -i /mnt base base-devel linux linux-firmware linux-headers intel-ucode git openssh rsync networkmanager grub efibootmgr dosfstools os-prober nano dkms dbus-broker-units mkinitcpio iptables-nft +# Create the /boot/efi directory and mount the EFI partition to it +mkdir /mnt/boot/efi +mount /dev/$efipar /mnt/boot/efi # Generate a fstab file genfstab -U /mnt >> /mnt/etc/fstab # Copy system config files into the new install @@ -51,5 +63,14 @@ cp files/sys-mkinitcpio.conf /etc/mkinitcpio.conf mkdir /mnt/buildscripts /mnt/userfiles cp scripts/* /mnt/buildscripts cp files/user-* /mnt/userfiles -# Chroot into the new system and run the next script -arch-chroot /mnt sh /buildscripts/1-root-config.sh \ No newline at end of file +# Chroot into the new system, do some setup based on earlier questions and run the next script +arch-chroot /mnt /bin/bash < /etc/locale.conf +echo "KEYMAP=uk" > /etc/vconsole.conf +sh /buildscripts/1-root-config.sh \ No newline at end of file