test new addition

This commit is contained in:
mfgbhatti 2022-01-28 16:19:11 +00:00
parent a1cc053985
commit 93f0edda79
1 changed files with 49 additions and 42 deletions

View File

@ -38,6 +38,7 @@ if [[ "$LAYOUT" ]]; then
PART2=${DISK}2
PART3=${DISK}3
fi
title "Creating Filesystems"
mkfs.vfat -F32 -n "EFIBOOT" "$PART2"
mkfs.btrfs -L "ROOT" "$PART3" -f
mount -t btrfs "$PART3" /mnt
@ -45,11 +46,14 @@ if [[ "$LAYOUT" ]]; then
for x in "${SUBVOLUMES[@]}"; do
btrfs subvolume create /mnt/"${x}"
done
umount /mnt
mount -o "$MOUNTOPTION",subvol=@ "$PART3" /mnt
for y in "${SUBVOLUMES[@]:1}"; do
mkdir /mnt/"${y}"
done
for z in "${SUBVOLUMES[@]:1}"; do
mount -o "$MOUNTOPTION",subvol="${z}" "$PART3" /mnt/"${z}"
done
@ -60,6 +64,27 @@ else
fi
# mount target
mkdir /mnt/boot
mkdir /mnt/boot/efi
mount -t vfat -L EFIBOOT /mnt/boot/
if ! grep -qs '/mnt' /proc/mounts; then
echo "Drive is not mounted can not continue"
echo "Rebooting in 3 Seconds ..." && sleep 1
echo "Rebooting in 2 Seconds ..." && sleep 1
echo "Rebooting in 1 Second ..." && sleep 1
reboot now
fi
title "Arch Install on Main Drive"
pacstrap /mnt base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed
echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf
genfstab -U /mnt >> /mnt/etc/fstab
cp -R "${SCRIPT_DIR}" /mnt/root/ArchTitus
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
# check if layout is default
# if [[ "$LAYOUT" == "default" ]]; then
@ -112,11 +137,7 @@ fi
# sgdisk -A 1:set:2 ${DISK}
# fi
# make filesystems
echo -ne "
-------------------------------------------------------------------------
Creating Filesystems
-------------------------------------------------------------------------
"
# createsubvolumes () {
# btrfs subvolume create /mnt/@
# btrfs subvolume create /mnt/@home
@ -178,18 +199,9 @@ echo -ne "
# mount -t btrfs -o subvol=@ -L ROOT /mnt
# fi
# mount target
mkdir /mnt/boot
mkdir /mnt/boot/efi
mount -t vfat -L EFIBOOT /mnt/boot/
# if ! grep -qs '/mnt' /proc/mounts; then
# echo "Drive is not mounted can not continue"
# echo "Rebooting in 3 Seconds ..." && sleep 1
# echo "Rebooting in 2 Seconds ..." && sleep 1
# echo "Rebooting in 1 Second ..." && sleep 1
# reboot now
# fi
# echo -ne "
# -------------------------------------------------------------------------
# Arch Install on Main Drive
@ -199,8 +211,7 @@ mount -t vfat -L EFIBOOT /mnt/boot/
# echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf
# # check pacstrap installed or not
# cp -R "${SCRIPT_DIR}" /mnt/root/ArchTitus
# cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
# echo -ne "
# -------------------------------------------------------------------------
# GRUB BIOS Bootloader Install & Check
@ -209,27 +220,23 @@ mount -t vfat -L EFIBOOT /mnt/boot/
# # if [[ ! -d "/sys/firmware/efi" ]]; then
# # grub-install --boot-directory=/mnt/boot "${DISK}"
# # fi
# echo -ne "
# -------------------------------------------------------------------------
# Checking for low memory systems <8G
# -------------------------------------------------------------------------
# "
# # TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
# TOTALMEM=$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')
# if [[ $TOTALMEM -lt 8000000 ]]; then
# # 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 /mnt/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly.
# chattr +C /mnt/opt/swap # apply NOCOW, btrfs needs that.
# dd if=/dev/zero of=/mnt/opt/swap/swapfile bs=1M count=2048 status=progress
# chmod 600 /mnt/opt/swap/swapfile # set permissions.
# chown root /mnt/opt/swap/swapfile
# mkswap /mnt/opt/swap/swapfile
# swapon /mnt/opt/swap/swapfile
# # The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the system itself.
# echo "/opt/swap/swapfile none swap sw 0 0" >> /mnt/etc/fstab # Add swap to fstab, so it KEEPS working after installation.
# fi
echo -ne "
-------------------------------------------------------------------------
SYSTEM READY FOR 1-setup.sh
-------------------------------------------------------------------------
"
title "Checking for low memory systems <8G "
# TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
TOTALMEM=$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')
if [[ $TOTALMEM -lt 8000000 ]]; then
# 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 /mnt/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly.
chattr +C /mnt/opt/swap # apply NOCOW, btrfs needs that.
dd if=/dev/zero of=/mnt/opt/swap/swapfile bs=1M count=2048 status=progress
chmod 600 /mnt/opt/swap/swapfile # set permissions.
chown root /mnt/opt/swap/swapfile
mkswap /mnt/opt/swap/swapfile
swapon /mnt/opt/swap/swapfile
# The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the system itself.
echo "/opt/swap/swapfile none swap sw 0 0" >> /mnt/etc/fstab # Add swap to fstab, so it KEEPS working after installation.
fi
title "SYSTEM READY FOR 1-setup.sh"