General improvements
- Changed swap partition to swap file. - Added the option to list the time zones before setting one - Fix spelling errors
This commit is contained in:
12
chroot.sh
12
chroot.sh
@@ -8,16 +8,26 @@ password=""
|
|||||||
echoerr() { cat <<< "$@" 1>&2; }
|
echoerr() { cat <<< "$@" 1>&2; }
|
||||||
|
|
||||||
# Set the time zone
|
# Set the time zone
|
||||||
|
while
|
||||||
|
echo "[INFO] Time zone configuration. Type \"list\" to list time zones"
|
||||||
read -p "Enter time zone (${timezone}): " input
|
read -p "Enter time zone (${timezone}): " input
|
||||||
|
|
||||||
|
if [[ "$input" == "list" ]]; then
|
||||||
|
awk '/^Z/ { print $2 }; /^L/ { print $3 }' /usr/share/zoneinfo/tzdata.zi | sort | less
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "$input" ]]; then
|
if [[ -n "$input" ]]; then
|
||||||
timezone="$input"
|
timezone="$input"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f "/usr/share/zoneinfo/${timezone}" ]]; then
|
if [[ ! -f "/usr/share/zoneinfo/${timezone}" ]]; then
|
||||||
echoerr "[ERROR] The selected time zone does not exist"
|
echoerr "[ERROR] The selected time zone does not exist"
|
||||||
exit 5
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[[ ! -f "/usr/share/zoneinfo/${timezone}" ]]
|
||||||
|
do true; done
|
||||||
|
|
||||||
echo "[INFO] Setting ${timezone} as the time zone"
|
echo "[INFO] Setting ${timezone} as the time zone"
|
||||||
ln -sf "/usr/share/zoneinfo/${timezone}" /etc/localtime
|
ln -sf "/usr/share/zoneinfo/${timezone}" /etc/localtime
|
||||||
hwclock --systohc
|
hwclock --systohc
|
||||||
|
|||||||
53
install.sh
53
install.sh
@@ -6,7 +6,7 @@
|
|||||||
# - Add support for BIOS platform
|
# - Add support for BIOS platform
|
||||||
# - Add more filesystem options (defaults to ext4)
|
# - Add more filesystem options (defaults to ext4)
|
||||||
# - Make script recoverable from errors (save script stage)
|
# - Make script recoverable from errors (save script stage)
|
||||||
# - Add support for custom localization configuration
|
# - Add support for custom localization configuration (defaults to en_US.UTF-8)
|
||||||
|
|
||||||
platform="bios"
|
platform="bios"
|
||||||
input=""
|
input=""
|
||||||
@@ -14,9 +14,9 @@ disk="/dev/sda"
|
|||||||
|
|
||||||
echoerr() { cat <<< "$@" 1>&2; }
|
echoerr() { cat <<< "$@" 1>&2; }
|
||||||
|
|
||||||
# Check is script is being run as root
|
# Check if script is being run as root
|
||||||
if [[ $(id -u) -ne 0 ]]; then
|
if [[ $(id -u) -ne 0 ]]; then
|
||||||
echoerr "[ERROR] Please run this script as root or using sudo"
|
echoerr "[ERROR] This script needs root permissions to be executed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -51,60 +51,54 @@ if [[ ! -b "$disk" ]]; then
|
|||||||
exit 4
|
exit 4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Partition the disk with the following layout:
|
# Partition the disk
|
||||||
# | Mount point | Partition Type | Size |
|
echo "[INFO] Partitioning the disk with the following layout:"
|
||||||
# |-------------|-----------------------|-------------------------|
|
echo " | Mount point | Partition Type | Size |"
|
||||||
# | /boot | EFI system partition | 1 GiB |
|
echo " |-------------|-----------------------|-------------------------|"
|
||||||
# | [SWAP] | Linux swap | 4 GiB |
|
echo " | /boot | EFI system partition | 1 GiB |"
|
||||||
# | / | Linux x86-64 root (/) | Remainder of the device |
|
echo " | /swapfile | Linux swap | 4 GiB |"
|
||||||
echo "[INFO] Partitioning the disk"
|
echo " | / | Linux x86-64 root (/) | Remainder of the device |"
|
||||||
(
|
(
|
||||||
echo g # Create a new empty GPT partition table
|
echo g # Create a new empty GPT partition table
|
||||||
|
|
||||||
# EFI system partition
|
# EFI system partition
|
||||||
echo n # Add a new partition
|
echo n # Add a new partition
|
||||||
echo 1 # Partition number
|
echo 1 # Partition number
|
||||||
echo # First sector (accept default: 2048)
|
echo # First sector (accept default)
|
||||||
echo "+1GiB" # Last sector
|
echo "+1GiB" # Last sector
|
||||||
echo t # Change partition type
|
echo t # Change partition type
|
||||||
echo "uefi" # "EFI system partition" type
|
echo "uefi" # "EFI system" partition type
|
||||||
|
|
||||||
# Swap partition
|
|
||||||
echo n # Add a new partition
|
|
||||||
echo 2 # Partition number
|
|
||||||
echo # First sector (accept default)
|
|
||||||
echo "+4GiB" # Last sector
|
|
||||||
echo t # Change partition type
|
|
||||||
echo 2 # Select partition
|
|
||||||
echo "swap" # "Linux swap partition" type
|
|
||||||
|
|
||||||
# Root partition
|
# Root partition
|
||||||
echo n # Add a new partition
|
echo n # Add a new partition
|
||||||
echo 3 # Partition number
|
echo 2 # Partition number
|
||||||
echo # First sector (accept default)
|
echo # First sector (accept default)
|
||||||
echo # Last sector (accept default)
|
echo # Last sector (accept default)
|
||||||
echo t # Change partition type
|
echo t # Change partition type
|
||||||
echo 3 # Select partition
|
echo 2 # Select partition
|
||||||
echo 23 # "Linux x86-64 root (/) Linux" partition type
|
echo 23 # "Linux root (x86-64)" partition type
|
||||||
|
|
||||||
echo w # Write changes
|
echo w # Write changes
|
||||||
) | fdisk "$disk" &>/dev/null
|
) | fdisk "$disk" &>/dev/null
|
||||||
|
|
||||||
# TODO: Check if fdisk terminated succesfully
|
# TODO: Check if fdisk terminated succesfully
|
||||||
|
|
||||||
|
# Swap file
|
||||||
|
echo "[INFO] Creating the swap file"
|
||||||
|
mkswap -U clear --size 4G --file /mnt/swapfile &>/dev/null
|
||||||
|
|
||||||
# Format the partitions
|
# Format the partitions
|
||||||
echo "[INFO] Formatting the partitions"
|
echo "[INFO] Formatting the partitions"
|
||||||
mkfs.ext4 "${disk}3" &>/dev/null
|
|
||||||
mkswap "${disk}2" &>/dev/null
|
|
||||||
mkfs.fat -F 32 "${disk}1" &>/dev/null
|
mkfs.fat -F 32 "${disk}1" &>/dev/null
|
||||||
|
mkfs.ext4 "${disk}2" &>/dev/null
|
||||||
|
|
||||||
# TODO: Check if formatting the partitions went correctly
|
# TODO: Check if formatting the partitions went correctly
|
||||||
|
|
||||||
# Mount the file systems
|
# Mount the file systems
|
||||||
echo "[INFO] Mounting the file systems"
|
echo "[INFO] Mounting the file systems"
|
||||||
mount "${disk}3" /mnt
|
mount "${disk}2" /mnt
|
||||||
mount --mkdir "${disk}1" /mnt/boot
|
mount --mkdir "${disk}1" /mnt/boot
|
||||||
swapon "${disk}2"
|
swapon /mnt/swapfile
|
||||||
|
|
||||||
# TODO: Select the mirrors for faster download speeds
|
# TODO: Select the mirrors for faster download speeds
|
||||||
|
|
||||||
@@ -115,7 +109,7 @@ pacstrap -K /mnt base linux linux-firmware \
|
|||||||
networkmanager \
|
networkmanager \
|
||||||
grub efibootmgr
|
grub efibootmgr
|
||||||
|
|
||||||
# Generate an fstab file
|
# Generate the fstab file
|
||||||
echo "[INFO] Generating fstab file"
|
echo "[INFO] Generating fstab file"
|
||||||
genfstab -U /mnt >> /mnt/etc/fstab
|
genfstab -U /mnt >> /mnt/etc/fstab
|
||||||
|
|
||||||
@@ -127,6 +121,7 @@ arch-chroot /mnt bash /chroot.sh
|
|||||||
|
|
||||||
# Unmount partitions
|
# Unmount partitions
|
||||||
umount -R /mnt
|
umount -R /mnt
|
||||||
|
swapoff -a
|
||||||
|
|
||||||
# Tell the user that it's ok to reboot now
|
# Tell the user that it's ok to reboot now
|
||||||
echo "[INFO] Now you also can say \"I use Arch, BTW\". Reboot when you're ready"
|
echo "[INFO] Now you also can say \"I use Arch, BTW\". Reboot when you're ready"
|
||||||
|
|||||||
Reference in New Issue
Block a user