Switch to using settings.env for configuration instead of constant prompts.
parent
788ced626c
commit
bcf9b705c2
73
install.sh
73
install.sh
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
source ./settings.env
|
||||||
|
|
||||||
echo "+===============================+"
|
echo "+===============================+"
|
||||||
echo "| Kalle's Arch Installer Script |"
|
echo "| Kalle's Arch Installer Script |"
|
||||||
echo "+===============================+"
|
echo "+===============================+"
|
||||||
|
@ -30,30 +32,15 @@ echo "+================================+"
|
||||||
echo "| Partitioning |"
|
echo "| Partitioning |"
|
||||||
echo "+================================+"
|
echo "+================================+"
|
||||||
|
|
||||||
# Print a list of block devices.
|
ls $DISK_BASE > /dev/null
|
||||||
lsblk -o NAME,LABEL,HOTPLUG,SIZE,MODEL
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "[?] Above is a list of block devices found on the system. Please choose the one that you want to use for this installation."
|
|
||||||
echo "[?] Or enter manual to drop to a shell for manual partitioning."
|
|
||||||
read -p "[/dev/sda,/dev/nvme0n1,manual,etc] " disk_base
|
|
||||||
|
|
||||||
# Check for manual mode and drop them into a shell.
|
|
||||||
if [ $disk_base == "manual" ]; then
|
|
||||||
echo "[?] Make sure to also mount the full file structure under the /mnt directory."
|
|
||||||
echo "[?] Good luck! Type exit to return to the installer."
|
|
||||||
zsh
|
|
||||||
else
|
|
||||||
ls $disk_base > /dev/null
|
|
||||||
|
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "[!] Device $disk_base does not exist."
|
echo "[!] Device $DISK_BASE does not exist."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure that the user wants to erase the full disk.
|
# Make sure that the user wants to erase the full disk.
|
||||||
read -p "[!] This will destroy all data on device $disk_base! Are you sure you want to continue? [y/N] " confirmation
|
read -p "[!] This will destroy all data on device $DISK_BASE! Are you sure you want to continue? [y/N] " confirmation
|
||||||
|
|
||||||
# If they are not exit.
|
# If they are not exit.
|
||||||
if [ $confirmation != "y" ]; then
|
if [ $confirmation != "y" ]; then
|
||||||
|
@ -63,47 +50,38 @@ else
|
||||||
|
|
||||||
echo "[?] Creating GPT"
|
echo "[?] Creating GPT"
|
||||||
# Create a new GPT.
|
# Create a new GPT.
|
||||||
parted $disk_base -- mklabel gpt
|
parted $DISK_BASE -- mklabel gpt
|
||||||
|
|
||||||
# Get the size of swap to use.
|
|
||||||
read -p "[?] How large do you want your swap to be? [GiB] " swap_size
|
|
||||||
|
|
||||||
# Create partitions.
|
# Create partitions.
|
||||||
echo "[?] Creating partitions."
|
echo "[?] Creating partitions."
|
||||||
|
|
||||||
# Create the root partition.
|
# Create the root partition.
|
||||||
parted $disk_base -- mkpart primary 512MiB -"$swap_size"GiB
|
parted $DISK_BASE -- mkpart primary 512MiB -"$SWAP_SIZE"
|
||||||
|
|
||||||
# Create the swap partition.
|
# Create the swap partition.
|
||||||
parted $disk_base -- mkpart primary linux-swap -"$swap_size"GiB 100%
|
parted $DISK_BASE -- mkpart primary linux-swap -"$SWAP_SIZE" 100%
|
||||||
|
|
||||||
# Create the EFI partition.
|
# Create the EFI partition.
|
||||||
parted $disk_base -- mkpart ESP fat32 1MiB 512MiB
|
parted $DISK_BASE -- mkpart ESP fat32 1MiB 512MiB
|
||||||
parted $disk_base -- set 3 esp on
|
parted $DISK_BASE -- set 3 esp on
|
||||||
|
|
||||||
# Get the partition prefix from the user.
|
|
||||||
echo "[?] What prefix should be used for partitions? For HDDs and SATA SSDs this is probably the same as the device you selected earlier."
|
|
||||||
echo "[?] For nvme SSDs it will most likely be something like /dev/nvme0n1p"
|
|
||||||
read -p "[?] " partition_base
|
|
||||||
|
|
||||||
# Create filesystems.
|
# Create filesystems.
|
||||||
echo "[?] Creating file systems. This might take a while."
|
echo "[?] Creating file systems. This might take a while."
|
||||||
|
|
||||||
# Create root filesystem.
|
# Create root filesystem.
|
||||||
mkfs.ext4 -L Arch "$partition_base"1
|
mkfs.ext4 -L Arch "$PARTITION_BASE"1
|
||||||
# Create swap.
|
# Create swap.
|
||||||
mkswap -L swap "$partition_base"2
|
mkswap -L swap "$PARTITION_BASE"2
|
||||||
# Create EFI filesystem.
|
# Create EFI filesystem.
|
||||||
mkfs.fat -F 32 -n boot "$partition_base"3
|
mkfs.fat -F 32 -n boot "$PARTITION_BASE"3
|
||||||
|
|
||||||
# Mount filesystems.
|
# Mount filesystems.
|
||||||
mount "$partition_base"1 /mnt
|
mount "$PARTITION_BASE"1 /mnt
|
||||||
mkdir -p /mnt/boot
|
mkdir -p /mnt/boot
|
||||||
mount "$partition_base"3 /mnt/boot
|
mount "$PARTITION_BASE"3 /mnt/boot
|
||||||
|
|
||||||
# And turn on swap
|
# And turn on swap
|
||||||
swapon "$partition_base"2
|
swapon "$PARTITION_BASE"2
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Package installation
|
# Package installation
|
||||||
|
@ -125,23 +103,17 @@ genfstab -U /mnt >> /mnt/etc/fstab
|
||||||
#
|
#
|
||||||
# Chroot part
|
# Chroot part
|
||||||
#
|
#
|
||||||
echo "[?] Package installation is done. Please enter a couple bits of information about your system."
|
|
||||||
read -p "What timezone? [Europe/Amsterdam] " time_zone
|
|
||||||
read -p "What locale? [en_US.UTF-8] " locale
|
|
||||||
read -p "What hostname? [arch] " hostname
|
|
||||||
read -p "What cpu vendor? [intel/amd]" cpu_vendor
|
|
||||||
|
|
||||||
echo "[?] Starting work in chroot now."
|
echo "[?] Starting work in chroot now."
|
||||||
echo "
|
echo "
|
||||||
ln -sf /usr/share/zoneinfo/$time_zone /etc/localtime
|
ln -sf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime
|
||||||
hwclock --systohc
|
hwclock --systohc
|
||||||
echo \"$locale UTF-8\" > /etc/locale.gen
|
echo \"$LOCALE UTF-8\" > /etc/locale.gen
|
||||||
locale-gen
|
locale-gen
|
||||||
echo \"LANG=$locale\" > /etc/locale.conf
|
echo \"LANG=$LOCALE\" > /etc/locale.conf
|
||||||
echo \"$hostname\" > /etc/hostname
|
echo \"$HOSTNAME\" > /etc/hostname
|
||||||
echo \"127.0.0.1 localhost
|
echo \"127.0.0.1 localhost
|
||||||
::1 localhost
|
::1 localhost
|
||||||
127.0.1.1 $hostname\" > /etc/hosts
|
127.0.1.1 $HOSTNAME\" > /etc/hosts
|
||||||
echo \"[!] Please set your root password below\"
|
echo \"[!] Please set your root password below\"
|
||||||
passwd
|
passwd
|
||||||
bootctl install
|
bootctl install
|
||||||
|
@ -155,5 +127,6 @@ Target = systemd
|
||||||
Description = Updating systemd-boot
|
Description = Updating systemd-boot
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
Exec = /usr/bin/bootctl update\" > /etc/pacman.d/hooks/100-systemd-boot.hook
|
Exec = /usr/bin/bootctl update\" > /etc/pacman.d/hooks/100-systemd-boot.hook
|
||||||
pacman -Sy \"$cpu_vendor\"-ucode
|
pacman -Sy \"$CPU_VENDOR\"-ucode
|
||||||
|
mkinitcpio -p
|
||||||
" > arch-chroot /mnt
|
" > arch-chroot /mnt
|
||||||
|
|
Loading…
Reference in New Issue