1
0
mirror of https://github.com/tommytran732/Arch-Setup-Script synced 2024-11-22 01:21:34 -05:00

Better control over the swapfile creation.

This commit is contained in:
Tommaso Chiti 2021-02-01 07:20:36 +01:00
parent 20f08bb9f6
commit e520f12d9b

View File

@ -113,14 +113,17 @@ sed -i -e 's,BINARIES=(),BINARIES=(/usr/bin/btrfs),g' /mnt/etc/mkinitcpio.conf
sed -i -e 's,#COMPRESSION="zstd",COMPRESSION="zstd",g' /mnt/etc/mkinitcpio.conf sed -i -e 's,#COMPRESSION="zstd",COMPRESSION="zstd",g' /mnt/etc/mkinitcpio.conf
sed -i -e 's,modconf block filesystems keyboard,keyboard keymap modconf block encrypt filesystems,g' /mnt/etc/mkinitcpio.conf sed -i -e 's,modconf block filesystems keyboard,keyboard keymap modconf block encrypt filesystems,g' /mnt/etc/mkinitcpio.conf
# Enabling LUKS in GRUB. # Enabling LUKS in GRUB and setting the UUID of the LUKS container.
UUID=$(blkid $Cryptroot | cut -f2 -d'"') UUID=$(blkid $Cryptroot | cut -f2 -d'"')
sed -i 's/#\(GRUB_ENABLE_CRYPTODISK=y\)/\1/' /mnt/etc/default/grub sed -i 's/#\(GRUB_ENABLE_CRYPTODISK=y\)/\1/' /mnt/etc/default/grub
sed -i -e "s,quiet,quiet cryptdevice=UUID=$UUID:cryptroot root=$BTRFS,g" /mnt/etc/default/grub sed -i -e "s,quiet,quiet cryptdevice=UUID=$UUID:cryptroot root=$BTRFS,g" /mnt/etc/default/grub
# Creating a swapfile. # Creating a swapfile.
echo "How much big should the swap file be? Type the size, just a number (eg: 1 = 1GB..) " read -r -p "Do you want a swapfile? [y/N]? " response
read swap response=${response,,}
if [[ "$response" =~ ^(yes|y)$ ]]
then
read -r -p "How much big should the swap file be? Type the size, just a number (eg: 1 = 1GB..): " swap
truncate -s 0 /mnt/swap/swapfile truncate -s 0 /mnt/swap/swapfile
chattr +C /mnt/swap/swapfile chattr +C /mnt/swap/swapfile
btrfs property set /mnt/swap/swapfile compression none btrfs property set /mnt/swap/swapfile compression none
@ -129,6 +132,9 @@ chmod 600 /mnt/swap/swapfile
mkswap /mnt/swap/swapfile mkswap /mnt/swap/swapfile
swapon /mnt/swap/swapfile swapon /mnt/swap/swapfile
echo "/swap/swapfile none swap defaults 0 0" >> /mnt/etc/fstab echo "/swap/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
else
break
fi
# Configuring the system. # Configuring the system.
arch-chroot /mnt /bin/bash -xe <<"EOF" arch-chroot /mnt /bin/bash -xe <<"EOF"