Can now install using manual partitioning config
This commit is contained in:
parent
6b8fc0f56f
commit
fc2a91a48c
|
|
@ -50,26 +50,6 @@ echo -ne "
|
||||||
Formating Disk
|
Formating Disk
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
"
|
"
|
||||||
umount -A --recursive /mnt # make sure everything is unmounted before we start
|
|
||||||
# disk prep
|
|
||||||
sgdisk -Z ${DISK} # zap all on disk
|
|
||||||
sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment
|
|
||||||
|
|
||||||
# create partitions
|
|
||||||
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # partition 1 (BIOS Boot Partition)
|
|
||||||
sgdisk -n 2::+300M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # partition 2 (UEFI Boot Partition)
|
|
||||||
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # partition 3 (Root), default start, remaining
|
|
||||||
if [[ ! -d "/sys/firmware/efi" ]]; then # Checking for bios system
|
|
||||||
sgdisk -A 1:set:2 ${DISK}
|
|
||||||
fi
|
|
||||||
partprobe ${DISK} # reread partition table to ensure it is correct
|
|
||||||
|
|
||||||
# make filesystems
|
|
||||||
echo -ne "
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
Creating Filesystems
|
|
||||||
-------------------------------------------------------------------------
|
|
||||||
"
|
|
||||||
createsubvolumes () {
|
createsubvolumes () {
|
||||||
btrfs subvolume create /mnt/@
|
btrfs subvolume create /mnt/@
|
||||||
btrfs subvolume create /mnt/@home
|
btrfs subvolume create /mnt/@home
|
||||||
|
|
@ -79,10 +59,10 @@ createsubvolumes () {
|
||||||
}
|
}
|
||||||
|
|
||||||
mountallsubvol () {
|
mountallsubvol () {
|
||||||
mount -o ${MOUNT_OPTIONS},subvol=@home ${partition3} /mnt/home
|
mount -o ${MOUNT_OPTIONS},subvol=@home ${rootpartition} /mnt/home
|
||||||
mount -o ${MOUNT_OPTIONS},subvol=@tmp ${partition3} /mnt/tmp
|
mount -o ${MOUNT_OPTIONS},subvol=@tmp ${rootpartition} /mnt/tmp
|
||||||
mount -o ${MOUNT_OPTIONS},subvol=@var ${partition3} /mnt/var
|
mount -o ${MOUNT_OPTIONS},subvol=@var ${rootpartition} /mnt/var
|
||||||
mount -o ${MOUNT_OPTIONS},subvol=@.snapshots ${partition3} /mnt/.snapshots
|
mount -o ${MOUNT_OPTIONS},subvol=@.snapshots ${rootpartition} /mnt/.snapshots
|
||||||
}
|
}
|
||||||
|
|
||||||
subvolumesetup () {
|
subvolumesetup () {
|
||||||
|
|
@ -91,48 +71,83 @@ subvolumesetup () {
|
||||||
# unmount root to remount with subvolume
|
# unmount root to remount with subvolume
|
||||||
umount /mnt
|
umount /mnt
|
||||||
# mount @ subvolume
|
# mount @ subvolume
|
||||||
mount -o ${MOUNT_OPTIONS},subvol=@ ${partition3} /mnt
|
mount -o ${MOUNT_OPTIONS},subvol=@ ${rootpartition} /mnt
|
||||||
# make directories home, .snapshots, var, tmp
|
# make directories home, .snapshots, var, tmp
|
||||||
mkdir -p /mnt/{home,var,tmp,.snapshots}
|
mkdir -p /mnt/{home,var,tmp,.snapshots}
|
||||||
# mount subvolumes
|
# mount subvolumes
|
||||||
mountallsubvol
|
mountallsubvol
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "${DISK}" =~ "nvme" ]]; then
|
formatandmount () {
|
||||||
partition2=${DISK}p2
|
if [[ "${FS}" == "btrfs" ]]; then
|
||||||
partition3=${DISK}p3
|
mkfs.btrfs -L ROOT ${rootpartition} -f
|
||||||
else
|
mount -t btrfs ${rootpartition} /mnt
|
||||||
partition2=${DISK}2
|
|
||||||
partition3=${DISK}3
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${FS}" == "btrfs" ]]; then
|
|
||||||
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
|
|
||||||
mkfs.btrfs -L ROOT ${partition3} -f
|
|
||||||
mount -t btrfs ${partition3} /mnt
|
|
||||||
subvolumesetup
|
subvolumesetup
|
||||||
elif [[ "${FS}" == "ext4" ]]; then
|
elif [[ "${FS}" == "ext4" ]]; then
|
||||||
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
|
mkfs.ext4 -L ROOT ${rootpartition}
|
||||||
mkfs.ext4 -L ROOT ${partition3}
|
mount -t ext4 ${rootpartition} /mnt
|
||||||
mount -t ext4 ${partition3} /mnt
|
elif [[ "${FS}" == "luks" ]]; then
|
||||||
elif [[ "${FS}" == "luks" ]]; then
|
|
||||||
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
|
|
||||||
# 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 ${partition3} -
|
echo -n "${LUKS_PASSWORD}" | cryptsetup -y -v luksFormat ${rootpartition} -
|
||||||
# open luks container and ROOT will be place holder
|
# open luks container and ROOT will be place holder
|
||||||
echo -n "${LUKS_PASSWORD}" | cryptsetup open ${partition3} ROOT -
|
echo -n "${LUKS_PASSWORD}" | cryptsetup open ${rootpartition} ROOT -
|
||||||
# now format that container
|
# now format that container
|
||||||
mkfs.btrfs -L ROOT ${partition3}
|
mkfs.btrfs -L ROOT ${rootpartition}
|
||||||
# create subvolumes for btrfs
|
# create subvolumes for btrfs
|
||||||
mount -t btrfs ${partition3} /mnt
|
mount -t btrfs ${rootpartition} /mnt
|
||||||
subvolumesetup
|
subvolumesetup
|
||||||
# store uuid of encrypted partition for grub
|
# store uuid of encrypted partition for grub
|
||||||
echo ENCRYPTED_PARTITION_UUID=$(blkid -s UUID -o value ${partition3}) >> $CONFIGS_DIR/setup.conf
|
echo ENCRYPTED_PARTITION_UUID=$(blkid -s UUID -o value ${rootpartition}) >> $CONFIGS_DIR/setup.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
umount -A --recursive /mnt # make sure everything is unmounted before we start
|
||||||
|
|
||||||
|
if [[ $INSTALL_IN = "PART" ]]; then # Checking if install to partition
|
||||||
|
EFIpartition=${BOOTPART}
|
||||||
|
rootpartition=${PART}
|
||||||
|
|
||||||
|
if [[ -d "/sys/firmware/efi" ]]; then # Checking for UEFI system
|
||||||
|
if [[ $FORMATEFI = "yes" ]]; then
|
||||||
|
mkfs.vfat -F32 -n "EFIBOOT" ${EFIpartition}
|
||||||
|
fi
|
||||||
|
formatandmount
|
||||||
|
# mount EFI partition
|
||||||
|
mkdir -p /mnt/boot/EFI
|
||||||
|
mount -t vfat ${EFIpartition} /mnt/boot/EFI
|
||||||
|
elif [[ $(sudo sudo fdisk -l | grep -i '^Disklabel type') = "Disklabel type: gpt" ]]; then # Checking for GPT Disk Label on a Legacy BIOS (non UEFI) System
|
||||||
|
formatandmount
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $INSTALL_IN = "DISK" ]]; then # Checking if install to disk
|
||||||
|
# disk prep
|
||||||
|
sgdisk -Z ${DISK} # zap all on disk
|
||||||
|
sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment
|
||||||
|
|
||||||
|
# create partitions
|
||||||
|
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:'BIOSBOOT' ${DISK} # BIOSpartition (BIOS Boot Partition)
|
||||||
|
sgdisk -n 2::+300M --typecode=2:ef00 --change-name=2:'EFIBOOT' ${DISK} # EFIpartition (UEFI Boot Partition)
|
||||||
|
sgdisk -n 3::-0 --typecode=3:8300 --change-name=3:'ROOT' ${DISK} # rootpartition (Root), default start, remaining
|
||||||
|
if [[ ! -d "/sys/firmware/efi" ]]; then # Checking for BIOS system
|
||||||
|
sgdisk -A 1:set:2 ${DISK}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${DISK}" =~ "nvme" ]]; then
|
||||||
|
EFIpartition=${DISK}p2
|
||||||
|
rootpartition=${DISK}p3
|
||||||
|
else
|
||||||
|
EFIpartition=${DISK}2
|
||||||
|
rootpartition=${DISK}3
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkfs.vfat -F32 -n "EFIBOOT" ${EFIpartition}
|
||||||
|
formatandmount
|
||||||
|
# mount EFI partition
|
||||||
|
mkdir -p /mnt/boot/EFI
|
||||||
|
mount -t vfat -L EFIBOOT /mnt/boot/EFI
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# mount target
|
|
||||||
mkdir -p /mnt/boot/efi
|
|
||||||
mount -t vfat -L EFIBOOT /mnt/boot/
|
|
||||||
|
|
||||||
if ! grep -qs '/mnt' /proc/mounts; then
|
if ! grep -qs '/mnt' /proc/mounts; then
|
||||||
echo "Drive is not mounted can not continue"
|
echo "Drive is not mounted can not continue"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue