From 045a13de5ef96882d20152b5e0434239532b8a46 Mon Sep 17 00:00:00 2001 From: farhan Date: Mon, 15 Nov 2021 08:42:34 +0000 Subject: [PATCH] cleaning preinstall and startup --- 0-preinstall.sh | 39 +++++++++++++++++++++------------------ startup.sh | 2 +- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/0-preinstall.sh b/0-preinstall.sh index d8e80e4..ddc03c9 100755 --- a/0-preinstall.sh +++ b/0-preinstall.sh @@ -65,6 +65,20 @@ echo -ne " Creating Filesystems ------------------------------------------------------------------------- " +createsubvolumes () { + btrfs subvolume create /mnt/@ + btrfs subvolume create /mnt/@home + btrfs subvolume create /mnt/@var + btrfs subvolume create /mnt/@tmp + btrfs subvolume create /mnt/@.snapshots +} + +mountallsubvol () { + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@home /dev/mapper/ROOT /mnt/home + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@tmp /dev/mapper/ROOT /mnt/tmp + mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots + mount -o subvol=@var /dev/mapper/ROOT /mnt/var +} if [[ "${DISK}" == "nvme" ]]; then if [[ "${FS}" == "btrfs" ]]; then mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2 @@ -84,49 +98,38 @@ if [[ "${DISK}" == "nvme" ]]; then mkfs.btrfs -L ROOT /dev/mapper/ROOT # create subvolumes for btrfs mount -t btrfs /dev/mapper/ROOT /mnt - btrfs subvolume create /mnt/@ - btrfs subvolume create /mnt/@home - btrfs subvolume create /mnt/@.snapshots - btrfs subvolume create /mnt/@var - btrfs subvolume create /mnt/@tmp + createsubvolumes umount /mnt # mount @ subvolume mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@ /dev/mapper/ROOT /mnt # make directories home, .snapshots, var, tmp mkdir -p /mnt/{home,var,tmp,.snapshots} # mount subvolumes - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@home /dev/mapper/ROOT /mnt/home - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@tmp /dev/mapper/ROOT /mnt/tmp - mount -o subvol=@var /dev/mapper/ROOT /mnt/var + mountallsubvol fi else if [[ "${FS}" == "btrfs" ]]; then mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2 mkfs.btrfs -f -L ROOT ${DISK}3 + mount -t btrfs ${DISK}3 /mnt elif [[ "${FS}" == "ext4" ]]; then mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2 mkfs.ext4 -L ROOT ${DISK}3 + mount -t ext4 ${DISK}3 /mnt elif [[ "${FS}" == "luks" ]]; then mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2 echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${DISK}3 - echo -n "${luks_password}" | cryptsetup open ${DISK}3 ROOT - mkfs.btrfs -L ROOT /dev/mapper/ROOT mount -t btrfs /dev/mapper/ROOT /mnt - btrfs subvolume create /mnt/@ - btrfs subvolume create /mnt/@home - btrfs subvolume create /mnt/@.snapshots - btrfs subvolume create /mnt/@var - btrfs subvolume create /mnt/@tmp + createsubvolumes umount /mnt # mount all the subvolumes mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@ /dev/mapper/ROOT /mnt # make directories home, .snapshots, var, tmp mkdir -p /mnt/{home,var,tmp,.snapshots} - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@home /dev/mapper/ROOT /mnt/home - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots - mount -o noatime,compress=zstd,space_cache,commit=120,subvol=@tmp /dev/mapper/ROOT /mnt/tmp - mount -o subvol=@var /dev/mapper/ROOT /mnt/var +# mount subvolumes + mountallsubvol fi fi # checking if user selected btrfs diff --git a/startup.sh b/startup.sh index 0c3d249..bc5f0c9 100644 --- a/startup.sh +++ b/startup.sh @@ -117,10 +117,10 @@ echo "hostname=$hostname" >> setup.conf } # More features in future # language (){} -logo rm -rf setup.conf &>/dev/null userinfo clear +logo diskpart clear logo