Started making scripted installer for archlinux with explanation about every part of the process
This commit is contained in:
135
bare-arch-install.sh
Executable file
135
bare-arch-install.sh
Executable file
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
|
||||
# BEGIN: Variables
|
||||
|
||||
HOSTNAME="ExampleHostname"
|
||||
BOOT_METHOD="EFI"
|
||||
DISK='/dev/sda'
|
||||
EFI_PARTITION=${DISK}1
|
||||
SWAP_PARTITION=${DISK}2
|
||||
ROOT_PARTITION=${DISK}3
|
||||
|
||||
TIMEZONE_INFO=America/Chicago
|
||||
LOCALE=en_US.UTF-8
|
||||
|
||||
## Commands to create disks un-interactively with fdisk
|
||||
## will clean up comments later with grep command
|
||||
FORMAT_DISK_COMMANDS="
|
||||
# Create GPT partition table
|
||||
g
|
||||
|
||||
# Create efi partition
|
||||
n
|
||||
# Enter to select default partition number
|
||||
|
||||
# Enter to select default first sector
|
||||
|
||||
# Allocate only 500 MiB for the efi partition
|
||||
+500MiB
|
||||
|
||||
# Set partition type
|
||||
t
|
||||
# Set partition type to efi (1)
|
||||
1
|
||||
|
||||
# Create Swap Partition
|
||||
n
|
||||
# Enter to select default partition number
|
||||
|
||||
# Enter to select default first sector
|
||||
|
||||
# Allocate 8 GiB to swap partition
|
||||
+8GiB
|
||||
|
||||
## Set partition type to Linux Swap (19)
|
||||
t
|
||||
### Enter to select default (last) partition (2)
|
||||
|
||||
### Set Type to swap (19)
|
||||
19
|
||||
|
||||
# Create root partition (doing single partition format)
|
||||
n
|
||||
# Enter to select default partition number
|
||||
|
||||
# Enter to select default first sector
|
||||
|
||||
# Press Enter to allocate remaining disk to your final partition
|
||||
|
||||
# No need to set partition type
|
||||
# Write changes to disk
|
||||
w
|
||||
"
|
||||
|
||||
|
||||
|
||||
# END: Variables
|
||||
|
||||
|
||||
# BEGIN: Work
|
||||
|
||||
## BEGIN: Pre-Chroot Work
|
||||
### Format Disk
|
||||
#### For this example I will be using a sata disk (/dev/sda)
|
||||
COMMANDS="$(echo -e "$FORMAT_DISK_COMMANDS" | grep -v \#)"
|
||||
|
||||
fdisk $DISK <<< "$COMMANDS"
|
||||
|
||||
### Format EFI Partition
|
||||
#### The efi partition (mounted at /boot/efi) Needs to be formatted as fat32
|
||||
mkfs.fat -F32 $EFI_PARTITION
|
||||
|
||||
### Format SWAP partition
|
||||
mkswap $SWAP_PARTITION
|
||||
### Activate swap partition
|
||||
swapon $SWAP_PARTITION
|
||||
|
||||
### Format Root Partition
|
||||
#### We will be formatting it with ext4 because that's the default for most use-cases, especially when new linux users are concerned
|
||||
mkfs.ext4 $ROOT_PARTITION
|
||||
|
||||
### Mounting the root partition to begin setting up the partitions where they need to be
|
||||
mount $ROOT_PARTITION /mnt
|
||||
### Calling the --mkdir flag for mount to create the necessary directories so that it can mount
|
||||
mount $EFI_PARTITION --mkdir /mnt/boot/efi
|
||||
|
||||
### Using pacstrap to install the necessities to be able to get a chroot env
|
||||
: "
|
||||
base:
|
||||
This is a meta-package. One that will handle installing many of the necessary programs to have a basic install of arch to chroot into
|
||||
|
||||
|
||||
linux:
|
||||
This is the actual kernel being installed. It will install the kernel & kernel-modules necessary to boot
|
||||
|
||||
|
||||
linux-headers:
|
||||
This is many other family of distros (Debian, RedHat, etc) would name linux-dev || linux-devel
|
||||
|
||||
This is a package that contains all of the kernel's header files for compiling modules for your distrobutions kernel.
|
||||
|
||||
|
||||
linux-firmware:
|
||||
This is another meta package that contains just about all of the firmware drivers you system may need. It is just a dump of firmware, not all of them will be needed for your system.
|
||||
|
||||
sudo:
|
||||
A program needed for privelege escalation. Basically to provide a user of an admin group (most often wheel in most distrobutions) to be able to execute binaries that require root level permissions in you system.
|
||||
|
||||
Installing it here because it is not installed by default. An alternative is doas, a utility to perform the same funciton.
|
||||
"
|
||||
pacstrap /mnt base linux linux-headers linux-firmware sudo
|
||||
|
||||
INSTALL_SYSTEM="
|
||||
# Updating the package manager cache
|
||||
pacman -Syy
|
||||
|
||||
# Setting the hostname of your machine
|
||||
echo '$HOSTNAME' > /etc/hostname
|
||||
|
||||
# Setting timezone of the machine
|
||||
ln -sf /usr/share/zoneinfo/$TIMEZONE_INFO /etc/localtime
|
||||
"
|
||||
|
||||
|
||||
# END: Work
|
||||
Reference in New Issue
Block a user