Optimizing code.

This commit is contained in:
Tommaso Chiti 2021-10-31 09:23:46 +01:00
parent 466799172f
commit 3c13d73ba5

View file

@ -118,7 +118,7 @@ print "Formatting the EFI Partition as FAT32."
mkfs.fat -F 32 $ESP &>/dev/null mkfs.fat -F 32 $ESP &>/dev/null
# Creating a LUKS Container for the root partition. # Creating a LUKS Container for the root partition.
print "Creating LUKS Container for the root partition" print "Creating LUKS Container for the root partition."
cryptsetup luksFormat $Cryptroot cryptsetup luksFormat $Cryptroot
print "Opening the newly created LUKS Container." print "Opening the newly created LUKS Container."
cryptsetup open $Cryptroot cryptroot cryptsetup open $Cryptroot cryptroot
@ -131,10 +131,10 @@ mount $BTRFS /mnt
# Creating BTRFS subvolumes. # Creating BTRFS subvolumes.
print "Creating BTRFS subvolumes." print "Creating BTRFS subvolumes."
btrfs su cr /mnt/@ &>/dev/null for volume in @ @home @snapshots @var_log
btrfs su cr /mnt/@home &>/dev/null do
btrfs su cr /mnt/@snapshots &>/dev/null btrfs su cr /mnt/$volume &>/dev/null
btrfs su cr /mnt/@var_log &>/dev/null done
# Mounting the newly created subvolumes. # Mounting the newly created subvolumes.
umount /mnt umount /mnt
@ -241,27 +241,21 @@ print "Setting root password."
arch-chroot /mnt /bin/passwd arch-chroot /mnt /bin/passwd
[ -n "$username" ] && echo "Setting user password for ${username}." && arch-chroot /mnt /bin/passwd "$username" [ -n "$username" ] && echo "Setting user password for ${username}." && arch-chroot /mnt /bin/passwd "$username"
# Enabling Reflector timer.
print "Enabling Reflector."
systemctl enable reflector.timer --root=/mnt &>/dev/null
# Enabling Snapper automatic snapshots.
print "Enabling Snapper and automatic snapshots entries."
systemctl enable snapper-timeline.timer --root=/mnt &>/dev/null
systemctl enable snapper-cleanup.timer --root=/mnt &>/dev/null
systemctl enable grub-btrfs.path --root=/mnt &>/dev/null
# Enabling systemd-oomd.
print "Enabling systemd-oomd."
systemctl enable systemd-oomd --root=/mnt &>/dev/null
# ZRAM configuration. # ZRAM configuration.
print "Configuring ZRAM."
cat > /mnt/etc/systemd/zram-generator.conf <<EOF cat > /mnt/etc/systemd/zram-generator.conf <<EOF
[zram0] [zram0]
zram-fraction = 1 zram-fraction = 1
max-zram-size = 8192 max-zram-size = 8192
EOF EOF
# Enabling various services.
print "Enabling Reflector, Snapper, automatic snapshots and systemd-oomd"
for service in reflector.timer snapper-timeline.timer snapper-cleanup.timer grub-btrfs.path systemd-oomd
do
systemctl enable $service --root=/mnt &>/dev/null
done
# Finishing up. # Finishing up.
print "Done, you may now wish to reboot (further changes can be done by chrooting into /mnt)." print "Done, you may now wish to reboot (further changes can be done by chrooting into /mnt)."
exit exit