This commit is contained in:
mfgbhatti 2022-02-04 20:42:53 +00:00
parent 70f447d810
commit a39804bc11
1 changed files with 12 additions and 58 deletions

View File

@ -10,16 +10,15 @@ else
exit 1 exit 1
fi fi
# Common functions and varibales
BOOT=EFIBOOT
ROOT=ROOT
MOUNTPOINT="/mnt"
make_boot() { make_boot() {
mkfs.vfat -F32 -n "$1" "$2" mkfs.vfat -F32 -n "$1" "$2"
} }
something_failed() {
echo "Something failed. Exiting."
exit 1
}
do_btrfs() { do_btrfs() {
mkfs.btrfs -L "$1" "$2" -f mkfs.btrfs -L "$1" "$2" -f
mount -t btrfs "$2" "$MOUNTPOINT" mount -t btrfs "$2" "$MOUNTPOINT"
@ -61,7 +60,7 @@ do_lvm() {
} }
lvm_mount() { lvm_mount() {
mount /dev/"$LVM_VG"/"${LVM_NAMES[1]}" "$MOUNTPOINT"/ mount /dev/"$LVM_VG"/"${LVM_NAMES[0]}" "$MOUNTPOINT"/
for x in "${LVM_NAMES[@]:1}"; do for x in "${LVM_NAMES[@]:1}"; do
mkdir "$MOUNTPOINT"/"$x" mkdir "$MOUNTPOINT"/"$x"
mount /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x" mount /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x"
@ -103,6 +102,7 @@ else
PART3=${DISK}3 PART3=${DISK}3
fi fi
if [[ "$LAYOUT" -eq 1 ]]; then if [[ "$LAYOUT" -eq 1 ]]; then
do_partition do_partition
make_boot "$BOOT" "$PART2" make_boot "$BOOT" "$PART2"
@ -110,6 +110,7 @@ if [[ "$LAYOUT" -eq 1 ]]; then
elif [[ "$LVM" -eq 1 ]]; then elif [[ "$LVM" -eq 1 ]]; then
do_partition do_partition
make_boot "$BOOT" "$PART2"
pvcreate "$PART3" pvcreate "$PART3"
vgcreate "$LVM_VG" "$PART3" vgcreate "$LVM_VG" "$PART3"
do_lvm do_lvm
@ -117,6 +118,7 @@ elif [[ "$LVM" -eq 1 ]]; then
elif [[ "$LUKS" -eq 1 ]]; then elif [[ "$LUKS" -eq 1 ]]; then
do_partition do_partition
make_boot "$BOOT" "$PART2"
# enter luks password to cryptsetup and format root partition # enter luks password to cryptsetup and format root partition
echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART3" - echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART3" -
# open luks container and ROOT will be place holder # open luks container and ROOT will be place holder
@ -125,14 +127,15 @@ elif [[ "$LUKS" -eq 1 ]]; then
vgcreate "$LVM_VG" "$LUKS_PATH" vgcreate "$LVM_VG" "$LUKS_PATH"
do_lvm do_lvm
lvm_mount lvm_mount
else elif [[ "$LAYOUT" == 0 ]]; then
modprobe dm-mod modprobe dm-mod
vgscan &>/dev/null vgscan &>/dev/null
vgchange -ay &>/dev/null vgchange -ay &>/dev/null
# need to address boot partition # need to address boot partition
# need to get root partition # need to get root partition
# need to format root partition # need to format root partition
else
something_failed
fi fi
# mount target # mount target
@ -158,55 +161,6 @@ genfstab -U /mnt >>/mnt/etc/fstab
cp -R "${SCRIPT_DIR}" /mnt/root/ArchTitus cp -R "${SCRIPT_DIR}" /mnt/root/ArchTitus
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
# check if layout is default
# if [[ "$LAYOUT" == "default" ]]; then
# # check if disk is already formatted
# if [[ "$(lsblk -o NAME,FSTYPE | grep"$DISK" | awk '{print $2}')" == "btrfs" ]]; then
# echo "Disk already formatted"
# else
# # format disk
# btrfs device scan
# btrfs filesystem label "$DISK" "$LABEL"
# fi
# else
# # check if disk is already formatted
# if [[ "$(lsblk -o NAME,FSTYPE | grep "$DISK" | awk '{print $2}')" == "btrfs" ]]; then
# echo "Disk already formatted"
# else
# # format disk
# btrfs device scan
# btrfs filesystem label "$DISK" "$LABEL"
# # create partitions
# parted -s "$DISK" mklabel gpt
# parted -s "$DISK" mkpart ESP fat32 1MiB 513MiB
# parted -s "$DISK" set 1 boot on
# parted -s "$DISK" mkpart primary 513MiB 100%
# parted -s "$DISK" set 2 lvm on
# parted -s "$DISK" print
# # create volume group
# pvcreate "$DISK"2
# vgcreate "$VG" "$DISK"2
# # create logical volumes
# lvcreate -L "$LV_ROOT" -n "$LV_ROOT" "$VG"
# lvcreate -L "$LV_HOME" -n "$LV_HOME" "$VG"
# lvcreate -L "$LV_SWAP" -n "$LV_SWAP" "$VG"
# # format partitions
# mkfs.fat -F32 "$DISK"1
# mkfs.btrfs -L "$LABEL" "$DISK"2
# mkswap "$DISK"3
# # mount partitions
# mount "$DISK"2 /mnt
# mkdir /
# echo -ne "
# -------------------------------------------------------------------------
# GRUB BIOS Bootloader Install & Check
# -------------------------------------------------------------------------
# "
# # if [[ ! -d "/sys/firmware/efi" ]]; then
# # grub-install --boot-directory=/mnt/boot "${DISK}"
# # fi
title "Checking for low memory systems <8G " title "Checking for low memory systems <8G "
# TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') # TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')