mirror of
https://github.com/tommytran732/Arch-Setup-Script
synced 2024-11-14 06:01:33 -05:00
Swapfile
This commit is contained in:
parent
7effed6701
commit
ee00b01d01
51
easy-arch.sh
51
easy-arch.sh
@ -80,7 +80,7 @@ mount $ESP /mnt/boot
|
|||||||
|
|
||||||
# Pacstrap (setting up a base sytem onto the new root).
|
# Pacstrap (setting up a base sytem onto the new root).
|
||||||
echo "Installing the base sytem."
|
echo "Installing the base sytem."
|
||||||
pacstrap /mnt base linux linux-firmware btrfs-progs neovim networkmanager
|
pacstrap /mnt base linux linux-firmware btrfs-progs grub grub-btrfs efibootmgr snapper neovim networkmanager
|
||||||
|
|
||||||
# Fstab generation.
|
# Fstab generation.
|
||||||
echo "Generating a new fstab."
|
echo "Generating a new fstab."
|
||||||
@ -104,3 +104,52 @@ echo "Please insert the locale you use in this format (xx_XX.UTF-8): "
|
|||||||
read locale
|
read locale
|
||||||
echo $locale > /mnt/etc/locale.gen
|
echo $locale > /mnt/etc/locale.gen
|
||||||
echo "LANG=\"$locale\"" > /mnt/etc/locale.conf
|
echo "LANG=\"$locale\"" > /mnt/etc/locale.conf
|
||||||
|
|
||||||
|
# Setting up keyboard layout.
|
||||||
|
echo "Please insert the keyboard layout you use: "
|
||||||
|
read kblayout
|
||||||
|
echo "KEYMAP=\"$kblayout\"" > /mnt/etc/vconsole.conf
|
||||||
|
|
||||||
|
# Configuring /etc/mkinitcpio.conf
|
||||||
|
echo "Configuring /etc/mkinitcpio for ZSTD compression, BTRFS and LUKS hook."
|
||||||
|
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,modconf block filesystems keyboard,keyboard keymap modconf block encrypt filesystems,g' /mnt/etc/mkinitcpio.conf
|
||||||
|
|
||||||
|
# Enabling LUKS in GRUB.
|
||||||
|
UUID=$(blkid $Cryptroot | cut -f2 -d'"')
|
||||||
|
sed -i 's/#\(GRUB_ENABLE_CRYPTODISK=y\)/\1/' /mnt/etc/default/grub
|
||||||
|
sed -i "s,quiet,quiet cryptdevice=UUID=$UUID:cryptroot root=$BTRFS" /mnt/etc/default/grub
|
||||||
|
|
||||||
|
# Creating a swapfile.
|
||||||
|
echo "How much big should the swap file be? Type the size, just a number (eg: 1 = 1GB..) "
|
||||||
|
read swap
|
||||||
|
truncate -s 0 /mnt/swap/swapfile
|
||||||
|
chattr +C /mnt/swap/swapfile
|
||||||
|
btrfs property set /mnt/swap/swapfile compression none
|
||||||
|
dd if=/dev/zero of=/mnt/swap/swapfile bs=1G count=$swap status=progress
|
||||||
|
chmod 600 /mnt/swap/swapfile
|
||||||
|
mkswap /mnt/swap/swapfile
|
||||||
|
swapon /mnt/swap/swapfile
|
||||||
|
echo "/swap/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
|
||||||
|
|
||||||
|
|
||||||
|
arch-chroot /mnt /bin/bash -xe <<"EOF"
|
||||||
|
# Setting up clock.
|
||||||
|
hwclock --systohc
|
||||||
|
|
||||||
|
# Generating locales.
|
||||||
|
locale-gen
|
||||||
|
|
||||||
|
# Generating a new initramfs.
|
||||||
|
mkinitcpio -p
|
||||||
|
|
||||||
|
# Installing Grub.
|
||||||
|
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
|
||||||
|
|
||||||
|
# Creating grub config file.
|
||||||
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
|
||||||
|
# Create user
|
||||||
|
useradd -m user
|
||||||
|
EOF
|
Loading…
Reference in New Issue
Block a user