minor updates and log

This commit is contained in:
mfgbhatti 2022-02-12 20:26:38 +00:00
parent dd24702483
commit 282f9d4d5c
6 changed files with 72 additions and 109 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ install.conf
installlog.txt installlog.txt
archnikus.code-workspace archnikus.code-workspace
setup.conf setup.conf
main.log

View File

@ -20,7 +20,7 @@ do_btrfs() {
mkfs.btrfs -L "$1" "$2" -f mkfs.btrfs -L "$1" "$2" -f
mount -t btrfs "$2" "$MOUNTPOINT" mount -t btrfs "$2" "$MOUNTPOINT"
title "Creating subvolumes and directories" echo "Creating subvolumes and directories"
for x in "${SUBVOLUMES[@]}"; do for x in "${SUBVOLUMES[@]}"; do
btrfs subvolume create "$MOUNTPOINT"/"${x}" btrfs subvolume create "$MOUNTPOINT"/"${x}"
done done
@ -110,22 +110,21 @@ lvm_mount() {
do_partition() { do_partition() {
if [[ "$UEFI" -eq 1 ]]; then if [[ "$UEFI" -eq 1 ]]; then
wipefs -a "$DISK" wipefs -a "$DISK" # wipe any file system
sgdisk -Z "$DISK" # zap all on disk sgdisk -Z "$DISK" # zap all on disk
sgdisk -a 2048 -o "$DISK" # new gpt disk 2048 alignment sgdisk -a 2048 -o "$DISK" # new gpt disk 2048 alignment
sgdisk -n 1::+300M --typecode=1:ef00 --change-name=1:"$BOOT" "$DISK" # partition 2 (UEFI Boot Partition) sgdisk -n 1::+300M --typecode=1:ef00 --change-name=1:"$BOOT" "$DISK" # partition 1 (UEFI Boot Partition)
sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK" # partition 3 (Root), default start, remaining sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK" # partition 2 (Root), default start, remaining
else else
wipefs -a "$DISK" wipefs -a "$DISK"
sgdisk -Z "$DISK" # zap all on disk sgdisk -Z "$DISK"
sgdisk -a 2048 -o "$DISK" sgdisk -a 2048 -o "$DISK"
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:"BIOSBOOT" "$DISK" # partition 1 (BIOS Boot Partition) sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:"BIOSBOOT" "$DISK"
sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK" sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK"
fi fi
} }
# mount boot partition
mount_boot() { mount_boot() {
if [[ "$UEFI" -eq 1 ]]; then if [[ "$UEFI" -eq 1 ]]; then
mkdir "$MOUNTPOINT"/boot mkdir "$MOUNTPOINT"/boot
@ -133,10 +132,9 @@ mount_boot() {
fi fi
} }
# format a partition from given list of filesystems
logo logo
title "Setting up mirrors for faster downloads" title "Preinstall setup"
echo "Setting up mirrors for faster downloads"
install_pkg pacman-contrib reflector rsync gptfdisk install_pkg pacman-contrib reflector rsync gptfdisk
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
@ -149,7 +147,7 @@ fi
reflector --age 48 --country "$ISO" -f 5 --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist reflector --age 48 --country "$ISO" -f 5 --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
mkdir "$MOUNTPOINT" &>/dev/null # Hiding error message if any mkdir "$MOUNTPOINT" &>/dev/null # Hiding error message if any
title "File system setup" echo "File system setup"
if [[ "$SDD" -eq 1 ]]; then if [[ "$SDD" -eq 1 ]]; then
PART1=${DISK}p1 PART1=${DISK}p1
PART2=${DISK}p2 PART2=${DISK}p2
@ -180,9 +178,7 @@ elif [[ "$LVM" -eq 1 ]]; then
elif [[ "$LUKS" -eq 1 ]]; then elif [[ "$LUKS" -eq 1 ]]; then
do_partition do_partition
make_boot make_boot
# enter luks password to cryptsetup and format root partition
echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART2" - echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART2" -
# open luks container and ROOT will be place holder
# $LUKS_PATH "/dev/mapper/luks" # $LUKS_PATH "/dev/mapper/luks"
echo -n "$LUKS_PASSWORD" | cryptsetup open "$PART2" luks - echo -n "$LUKS_PASSWORD" | cryptsetup open "$PART2" luks -
pvcreate "$LUKS_PATH" pvcreate "$LUKS_PATH"
@ -218,7 +214,7 @@ if [[ "$(grep -E "$MOUNTPOINT" /proc/mounts -c)" -eq "0" ]]; then
exit 1 exit 1
fi fi
title "Arch Install on Main Drive" echo "Arch Install on Main Drive"
# for test purposes # for test purposes
pacstrap "$MOUNTPOINT" base linux linux-firmware vim --needed --noconfirm pacstrap "$MOUNTPOINT" base linux linux-firmware vim --needed --noconfirm
#pacstrap "$MOUNTPOINT" base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed #pacstrap "$MOUNTPOINT" base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed
@ -233,7 +229,7 @@ cp /etc/pacman.d/mirrorlist "$MOUNTPOINT"/etc/pacman.d/mirrorlist
# TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') # TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
TOTALMEM="$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')" TOTALMEM="$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')"
if [[ $TOTALMEM -lt 8000000 ]]; then if [[ $TOTALMEM -lt 8000000 ]]; then
title "Checking for low memory systems <8G " echo "Checking for low memory systems <8G "
# Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything. # Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything.
mkdir -p "$MOUNTPOINT"/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly. mkdir -p "$MOUNTPOINT"/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly.
chattr +C "$MOUNTPOINT"/opt/swap # apply NOCOW, btrfs needs that. chattr +C "$MOUNTPOINT"/opt/swap # apply NOCOW, btrfs needs that.
@ -246,4 +242,4 @@ if [[ $TOTALMEM -lt 8000000 ]]; then
echo "/opt/swap/swapfile none swap sw 0 0" >>"$MOUNTPOINT"/etc/fstab # Add swap to fstab, so it KEEPS working after installation. echo "/opt/swap/swapfile none swap sw 0 0" >>"$MOUNTPOINT"/etc/fstab # Add swap to fstab, so it KEEPS working after installation.
fi fi
title "SYSTEM READY FOR 1-setup.sh" title "System ready for 1-setup.sh"

View File

@ -45,9 +45,6 @@ locale-gen
timedatectl --no-ask-password set-timezone "$TIMEZONE" timedatectl --no-ask-password set-timezone "$TIMEZONE"
timedatectl --no-ask-password set-ntp 1 timedatectl --no-ask-password set-ntp 1
localectl --no-ask-password set-locale LANG="$LOCALE" LC_TIME="$LOCALE" localectl --no-ask-password set-locale LANG="$LOCALE" LC_TIME="$LOCALE"
# Set keymaps
# echo "KEYMAP=$KEYMAP" >>/etc/vconsole.conf
localectl --no-ask-password set-keymap --no-convert "$KEYMAP" localectl --no-ask-password set-keymap --no-convert "$KEYMAP"
# Add sudo no password rights # Add sudo no password rights
@ -65,7 +62,6 @@ refresh_pacman
title Installing desktop title Installing desktop
case "$DESKTOP" in case "$DESKTOP" in
"default") "default")
# cat /root/ArchTitus/pkg-files/pacman-pkgs.txt | while read line
while IFS= read -r LINE; do while IFS= read -r LINE; do
echo "INSTALLING: $LINE" echo "INSTALLING: $LINE"
install_pkg "$LINE" install_pkg "$LINE"
@ -163,14 +159,16 @@ else
fi fi
title Adding User title Adding User
if [ "$(whoami)" = "root" ]; then if [ "$(id -u)" = "0" ]; then
if [[ "$LAYOUT" -eq 1 ]]; then
groupadd libvirt
useradd -m -G wheel,libvirt -s /bin/bash "$USERNAME"
else
useradd -m -G wheel -s /bin/bash "$USERNAME" useradd -m -G wheel -s /bin/bash "$USERNAME"
fi
# use chpasswd to enter $USERNAME:$password
echo "$USERNAME:$PASSWORD" | chpasswd echo "$USERNAME:$PASSWORD" | chpasswd
cp -R /root/ArchTitus /home/"$USERNAME"/ cp -R /root/ArchTitus /home/"$USERNAME"/
chown -R "$USERNAME": /home/"$USERNAME"/ArchTitus chown -R "$USERNAME": /home/"$USERNAME"/ArchTitus
# enter $nameofmachine to /etc/hostname
echo "$HOSTNAME" >>/etc/hostname echo "$HOSTNAME" >>/etc/hostname
else else
echo "You are already a user proceed with aur installs" echo "You are already a user proceed with aur installs"
@ -190,4 +188,4 @@ if [[ -f "/etc/mkinitcpio.conf" ]];then
mkinitcpio -p linux mkinitcpio -p linux
fi fi
title SYSTEM READY FOR 2-user.sh title "System ready for 2-user.sh"

View File

@ -34,4 +34,4 @@ konsave -i ~/ArchTitus/kde.knsv
sleep 1 sleep 1
konsave -a kde konsave -a kde
title SYSTEM READY FOR 3-post-setup.sh title "System ready for 3-post-setup.sh"

View File

@ -1,39 +1,58 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1091 # shellcheck disable=SC1091
# shellcheck source=./setup.conf
# Find the name of the folder the scripts are in # Find the name of the folder the scripts are in
pacman -Sy --noconfirm
pacman -S --noconfirm --needed terminus-font
setfont ter-v22b setfont ter-v22b
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" clear
echo -ne " SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
-------------------------------------------------------------------------
CONFIG_FILE="$SCRIPT_DIR"/setup.conf
LOG="${SCRIPT_DIR}/main.log"
[[ -f "$LOG" ]] && rm -f "$LOG"
logo() {
echo -ne "
------------------------------------------------------------------------
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
-------------------------------------------------------------------------
Automated Arch Linux Installer
-------------------------------------------------------------------------
Scripts are in directory named ArchTitus
" "
bash startup.sh }
source "$SCRIPT_DIR"/setup.conf
sequence() {
echo -ne "Starting ArchTitus...\n"
if [[ -f "$CONFIG_FILE" ]]; then
source "$CONFIG_FILE"
else
echo "ERROR! Missing file: setup.conf"
exit 1
fi
bash 0-preinstall.sh bash 0-preinstall.sh
arch-chroot /mnt /root/ArchTitus/1-setup.sh arch-chroot /mnt /root/ArchTitus/1-setup.sh
arch-chroot /mnt /usr/bin/runuser -u "$USERNAME" -- /home/"$USERNAME"/ArchTitus/2-user.sh arch-chroot /mnt /usr/bin/runuser -u "$USERNAME" -- /home/"$USERNAME"/ArchTitus/2-user.sh
arch-chroot /mnt /root/ArchTitus/3-post-setup.sh arch-chroot /mnt /root/ArchTitus/3-post-setup.sh
logo
echo -ne " echo -ne "
-------------------------------------------------------------------------
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
------------------------------------------------------------------------- -------------------------------------------------------------------------
Automated Arch Linux Installer Automated Arch Linux Installer
------------------------------------------------------------------------- -------------------------------------------------------------------------
Done - Please Eject Install Media and Reboot Done - Please Eject Install Media and Reboot
" "
}
logo
echo -ne "
-------------------------------------------------------------------------
Automated Arch Linux Installer
-------------------------------------------------------------------------
Scripts are in directory named ArchTitus
"
bash startup.sh
sequence |& tee "$LOG"

View File

@ -9,34 +9,27 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
# Set up a config file # Set up a config file
CONFIG_FILE="$SCRIPT_DIR"/setup.conf CONFIG_FILE="$SCRIPT_DIR"/setup.conf
# Check if file exists and remove it if it does
[[ -f "$CONFIG_FILE" ]] && rm -f "$CONFIG_FILE" >/dev/null 2>&1 [[ -f "$CONFIG_FILE" ]] && rm -f "$CONFIG_FILE" >/dev/null 2>&1
# Set options in setup.conf
set_option() { set_option() {
# Check if option exists
if grep -Eq "^${1}.*" "$CONFIG_FILE"; then if grep -Eq "^${1}.*" "$CONFIG_FILE"; then
# delete option if exists
sed -i -e "/^${1}.*/d" "$CONFIG_FILE" sed -i -e "/^${1}.*/d" "$CONFIG_FILE"
fi fi
# Else add option
echo "${1}=${2}" >>"$CONFIG_FILE" echo "${1}=${2}" >>"$CONFIG_FILE"
} }
# Adding global functions and variables to use in this script # Adding global functions and variables to use in this script
# Check for root user
check_root() { check_root() {
if [[ "$(id -u)" != "0" ]]; then if [[ "$(id -u)" != "0" ]]; then
echo -ne "ERROR! This script has to be run under the 'root' user!" echo -ne "ERROR! This script must be running under the 'root' user!"
exit 1 exit 1
fi fi
} }
# Check if distro is arch
check_arch() { check_arch() {
if [[ ! -e /etc/arch-release ]]; then if [[ ! -e /etc/arch-release ]]; then
echo -ne "ERROR! This script has to be run under Arch Linux!" echo -ne "ERROR! This script must be run in Arch Linux!"
exit 1 exit 1
fi fi
} }
@ -49,44 +42,31 @@ check_pacman() {
fi fi
} }
# Check for internet connection
connection_test() { connection_test() {
ping -q -w 1 -c 1 "$(ip r | grep default | awk 'NR==1 {print $3}')" &>/dev/null && return 1 || return 0 ping -q -w 1 -c 1 "$(ip r | grep default | awk 'NR==1 {print $3}')" &>/dev/null && return 1 || return 0
} }
# Check coutry for mirrorlist
do_curl() { do_curl() {
_ISO=$(curl --fail https://ifconfig.co/country-iso) _ISO=$(curl --fail https://ifconfig.co/country-iso)
set_option "ISO" "$_ISO" set_option "ISO" "$_ISO"
} }
# Install fonts
install_font() {
pacman -S --noconfirm --needed terminus-font
}
# timedatectl set-ntp true
set_ntp() { set_ntp() {
timedatectl set-ntp true timedatectl set-ntp true
} }
# Check for UEFI
efi_check() { efi_check() {
if [[ -d "/sys/firmware/efi/" ]]; then if [[ -d "/sys/firmware/efi/" ]]; then
if (mount | grep /sys/firmware/efi/efivars); then if (mount | grep /sys/firmware/efi/efivars); then
(mount -t efivarfs efivarfs /sys/firmware/efi/efivars) >/dev/null 2>&1 (mount -t efivarfs efivarfs /sys/firmware/efi/efivars) >/dev/null 2>&1
fi fi
# UEFI detected
set_option "UEFI" 1 set_option "UEFI" 1
else else
# No UEFI detected
set_option "UEFI" 0 set_option "UEFI" 0
fi fi
} }
# if btrfs is selected
set_btrfs() { set_btrfs() {
# Used -a to get more than one argument
echo "Please enter your btrfs subvolumes separated by space" echo "Please enter your btrfs subvolumes separated by space"
echo "usualy they start with @." echo "usualy they start with @."
echo "[like @home, default are @home, @var, @tmp, @.snapshots]" echo "[like @home, default are @home, @var, @tmp, @.snapshots]"
@ -95,25 +75,19 @@ set_btrfs() {
if [[ -z "${ARR[*]}" ]]; then if [[ -z "${ARR[*]}" ]]; then
set_option "SUBVOLUMES" "(@ @home @var @tmp @.snapshots)" set_option "SUBVOLUMES" "(@ @home @var @tmp @.snapshots)"
else else
# An array is a list of values.
NAMES=(@) NAMES=(@)
for i in "${ARR[@]}"; do for i in "${ARR[@]}"; do
# Check for user input for @
if [[ $i =~ [@] ]]; then if [[ $i =~ [@] ]]; then
# push values to array
NAMES+=("$i") NAMES+=("$i")
else else
NAMES+=(@"${i}") NAMES+=(@"${i}")
fi fi
done done
# Check for duplicates
IFS=" " read -r -a SUBS <<<"$(tr ' ' '\n' <<<"${NAMES[@]}" | awk '!x[$0]++' | tr '\n' ' ')" IFS=" " read -r -a SUBS <<<"$(tr ' ' '\n' <<<"${NAMES[@]}" | awk '!x[$0]++' | tr '\n' ' ')"
# Set to config file
set_option "SUBVOLUMES" "${SUBS[*]}" set_option "SUBVOLUMES" "${SUBS[*]}"
fi fi
} }
# If lvm is selected
set_lvm() { set_lvm() {
read -r -p "Name your lvm volume group [like MyVolGroup, default is MyVolGroup]: " _VG read -r -p "Name your lvm volume group [like MyVolGroup, default is MyVolGroup]: " _VG
if [[ -z "$_VG" ]]; then if [[ -z "$_VG" ]]; then
@ -131,7 +105,6 @@ set_lvm() {
_PART_NUM=1 _PART_NUM=1
_LVM_NAMES+=("root") _LVM_NAMES+=("root")
LVM_SIZES+=("100%FREE") LVM_SIZES+=("100%FREE")
# Stop loop if only 1 partition
i=2 i=2
fi fi
while [[ $i -le "$_PART_NUM" ]]; do while [[ $i -le "$_PART_NUM" ]]; do
@ -148,19 +121,15 @@ set_lvm() {
set_option "LVM_SIZES" "(${LVM_SIZES[*]})" set_option "LVM_SIZES" "(${LVM_SIZES[*]})"
} }
# Check if an element exists
elements_present() { elements_present() {
for e in "${@:2}"; do [[ "$e" == "$1" ]] && break; done for e in "${@:2}"; do [[ "$e" == "$1" ]] && break; done
} }
# Invalid option message
invalid_option() { invalid_option() {
echo -ne "Your selected option is invalid, retry \n" echo -ne "Your selected option is invalid, retry \n"
} }
# Password helper function
set_password() { set_password() {
# Read password without echoing (-s)
read -rs -p "Please enter password: " PASSWORD1 read -rs -p "Please enter password: " PASSWORD1
echo -ne "\n" echo -ne "\n"
read -rs -p "Please re-enter password: " PASSWORD2 read -rs -p "Please re-enter password: " PASSWORD2
@ -173,7 +142,6 @@ set_password() {
fi fi
} }
# Make a title
title() { title() {
echo -ne "\n" echo -ne "\n"
echo -ne "------------------------------------------------------------------------\n" echo -ne "------------------------------------------------------------------------\n"
@ -216,10 +184,6 @@ something_failed() {
exit 1 exit 1
} }
# Setup for logging
# LOG="${SCRIPT_DIR}/main.log"
# [[ -f \$LOG ]] && rm -f "\$LOG"
logo () { logo () {
echo -ne " echo -ne "
------------------------------------------------------------------------ ------------------------------------------------------------------------
@ -240,10 +204,8 @@ MOUNTPOINT=/mnt
EOF EOF
} }
# Ask user for option
PROMPT="Please enter your option: " PROMPT="Please enter your option: "
# This will be shown on every set as user is progressing
logo() { logo() {
echo -ne " echo -ne "
------------------------------------------------------------------------ ------------------------------------------------------------------------
@ -257,7 +219,6 @@ logo() {
" "
} }
# Backround checks
background_check() { background_check() {
write_to_config write_to_config
if connection_test; then if connection_test; then
@ -271,11 +232,8 @@ background_check() {
check_root check_root
set_ntp set_ntp
do_curl do_curl
install_font
setfont ter-v22b
} }
# This function will handle file systems.
set_filesystem() { set_filesystem() {
title "Setup File System" title "Setup File System"
FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "vfat" "xfs") FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "vfat" "xfs")
@ -292,7 +250,6 @@ set_filesystem() {
done done
} }
# Set partioning layouts
set_partion_layout() { set_partion_layout() {
title "Setup Partioning Layout" title "Setup Partioning Layout"
LAYOUTS=("Default" "LVM" "LVM+LUKS" "Maintain Current") LAYOUTS=("Default" "LVM" "LVM+LUKS" "Maintain Current")
@ -306,7 +263,6 @@ set_partion_layout() {
;; ;;
2) 2)
set_option "LVM" 1 set_option "LVM" 1
# just weired bug with set_option
set_lvm set_lvm
break break
;; ;;
@ -401,7 +357,6 @@ set_timezone() {
esac esac
} }
# These are default key maps as presented in official arch repo archinstall
set_keymap() { set_keymap() {
title "Setup Keymap" title "Setup Keymap"
KEYMAPS=("by" "ca" "cf" "cz" "de" "dk" "es" "et" "fa" "fi" "fr" "gr" "hu" "il" "it" "lt" "lv" "mk" "nl" "no" "pl" "ro" "ru" "sg" "ua" "uk" "us") KEYMAPS=("by" "ca" "cf" "cz" "de" "dk" "es" "et" "fa" "fi" "fr" "gr" "hu" "il" "it" "lt" "lv" "mk" "nl" "no" "pl" "ro" "ru" "sg" "ua" "uk" "us")
@ -418,7 +373,6 @@ set_keymap() {
done done
} }
# Confirm if ssd is present
ssd_drive() { ssd_drive() {
title "SSD Drive Confirmation" title "SSD Drive Confirmation"
read -r -p "Is this system using an SSD? [like yes/no]: " _SSD read -r -p "Is this system using an SSD? [like yes/no]: " _SSD
@ -438,15 +392,12 @@ ssd_drive() {
esac esac
} }
# Selection for disk type
disk_selection() { disk_selection() {
# show disks present on system
title "Disk Selection" title "Disk Selection"
DISKLIST="$(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2" - "$3}')" # show disks with /dev/ prefix and size DISKLIST="$(lsblk -n --output TYPE,KNAME,SIZE | awk '$1=="disk"{print "/dev/"$2" - "$3}')" # show disks with /dev/ prefix and size
PS3="$PROMPT" PS3="$PROMPT"
select _DISK in "${DISKLIST[@]}"; do select _DISK in "${DISKLIST[@]}"; do
if elements_present "$_DISK" "${DISKLIST[@]}"; then if elements_present "$_DISK" "${DISKLIST[@]}"; then
# remove size from string
DISK=$(echo "$_DISK" | awk '{print $1}') DISK=$(echo "$_DISK" | awk '{print $1}')
set_option "DISK" "$DISK" set_option "DISK" "$DISK"
break break
@ -464,6 +415,7 @@ user_info() {
read -r -p "Please enter your username [default is archtitus]: " USERNAME read -r -p "Please enter your username [default is archtitus]: " USERNAME
if [[ -z "$USERNAME" ]]; then if [[ -z "$USERNAME" ]]; then
set_option "USERNAME" "archtitus" set_option "USERNAME" "archtitus"
break
elif [[ "${USERNAME,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]; then elif [[ "${USERNAME,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]; then
set_option "USERNAME" "${USERNAME,,}" # convert to lower case as in issue #109 set_option "USERNAME" "${USERNAME,,}" # convert to lower case as in issue #109
break break
@ -477,6 +429,7 @@ user_info() {
read -r -p "Please enter your hostname [default is archlinux]: " HOSTNAME read -r -p "Please enter your hostname [default is archlinux]: " HOSTNAME
if [[ -z "$HOSTNAME" ]]; then if [[ -z "$HOSTNAME" ]]; then
set_option "HOSTNAME" "archlinux" set_option "HOSTNAME" "archlinux"
break
elif [[ "${HOSTNAME,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]; then elif [[ "${HOSTNAME,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]; then
set_option "HOSTNAME" "${HOSTNAME,,}" set_option "HOSTNAME" "${HOSTNAME,,}"
break break
@ -487,7 +440,6 @@ user_info() {
done done
} }
# Set locale
set_locale() { set_locale() {
title "Setup Locale" title "Setup Locale"
LOCALES=($(grep UTF-8 /etc/locale.gen | sed 's/\..*$//' | sed '/@/d' | awk '{print $1}' | uniq | sed 's/#//g')) LOCALES=($(grep UTF-8 /etc/locale.gen | sed 's/\..*$//' | sed '/@/d' | awk '{print $1}' | uniq | sed 's/#//g'))
@ -504,7 +456,6 @@ set_locale() {
done done
} }
# Desktop selection
set_desktop() { set_desktop() {
title "Select either desktop Environment or Window Manager" title "Select either desktop Environment or Window Manager"
SELECTION=("Default (KDE)" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps" "Deepin" "Budgie") SELECTION=("Default (KDE)" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps" "Deepin" "Budgie")
@ -528,7 +479,6 @@ set_desktop() {
} }
# Make choice for installation
make_choice() { make_choice() {
title "Your system choice" title "Your system choice"
CHOICE=("Default Install" "Custom Install") CHOICE=("Default Install" "Custom Install")
@ -547,7 +497,6 @@ make_choice() {
1) 1)
clear clear
logo logo
# title "Please select presetup \n\t\t\tsettings for your system"
user_info user_info
disk_selection disk_selection
clear clear