mirror of
https://github.com/tommytran732/Arch-Setup-Script
synced 2024-11-09 20:21:34 -05:00
Better control over the swapfile creation.
This commit is contained in:
parent
20f08bb9f6
commit
e520f12d9b
28
easy-arch.sh
28
easy-arch.sh
@ -113,22 +113,28 @@ 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,,}
|
||||||
truncate -s 0 /mnt/swap/swapfile
|
if [[ "$response" =~ ^(yes|y)$ ]]
|
||||||
chattr +C /mnt/swap/swapfile
|
then
|
||||||
btrfs property set /mnt/swap/swapfile compression none
|
read -r -p "How much big should the swap file be? Type the size, just a number (eg: 1 = 1GB..): " swap
|
||||||
dd if=/dev/zero of=/mnt/swap/swapfile bs=1G count=$swap status=progress
|
truncate -s 0 /mnt/swap/swapfile
|
||||||
chmod 600 /mnt/swap/swapfile
|
chattr +C /mnt/swap/swapfile
|
||||||
mkswap /mnt/swap/swapfile
|
btrfs property set /mnt/swap/swapfile compression none
|
||||||
swapon /mnt/swap/swapfile
|
dd if=/dev/zero of=/mnt/swap/swapfile bs=1G count=$swap status=progress
|
||||||
echo "/swap/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
|
chmod 600 /mnt/swap/swapfile
|
||||||
|
mkswap /mnt/swap/swapfile
|
||||||
|
swapon /mnt/swap/swapfile
|
||||||
|
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"
|
||||||
|
Loading…
Reference in New Issue
Block a user