diff --git a/chrootInstall.sh b/chrootInstall.sh index bf19e87..ea6c191 100755 --- a/chrootInstall.sh +++ b/chrootInstall.sh @@ -13,6 +13,7 @@ username="$(< /tempfiles/username)" userpassword="$(< /tempfiles/userpassword)" rootpassword="$(< /tempfiles/rootpassword)" timezone="$(< /tempfiles/timezone)" +swap="$(< /tempfiles/swap)" # configuring locale and clock Settings echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen @@ -188,6 +189,11 @@ touch /home/"$username"/.ssh/authorized_keys chown -R "$username" /home/"$username"/.ssh # misc configuration +if [ "$swap" -gt 0 ]; then + echo 'vm.swappiness=10' > /etc/sysctl.d/99-swappiness.conf +else + echo 'vm.swappiness=0' > /etc/sysctl.d/99-swappiness.conf +fi echo -e ""$username" soft memlock 64\n"$username" hard memlock 2097152\n"$username" hard nofile 524288\n# End of file" > /etc/security/limits.conf # increase memlock and add support for esync mkdir -p /home/"$username"/.gnupg echo 'pinentry-program /usr/bin/pinentry-tty' > /home/"$username"/.gnupg/gpg-agent.conf # forces gpg prompts to use terminal input diff --git a/install.sh b/install.sh index 9bf768b..4f5a7da 100755 --- a/install.sh +++ b/install.sh @@ -147,14 +147,11 @@ else fi # create and mount swap file -if [ "$swap" != 0 ]; then +if [ "$swap" -gt 0 ]; then dd if=/dev/zero of=/mnt/swapfile bs=1G count="$swap" status=progress chmod 600 /mnt/swapfile mkswap /mnt/swapfile swapon /mnt/swapfile - echo 'vm.swappiness=10' > /mnt/etc/sysctl.d/99-swappiness.conf -else - echo 'vm.swappiness=0' > /mnt/etc/sysctl.d/99-swappiness.conf fi fstabgen -U /mnt >> /mnt/etc/fstab @@ -183,6 +180,7 @@ echo "$username" > /mnt/tempfiles/username echo "$userpassword" > /mnt/tempfiles/userpassword echo "$rootpassword" > /mnt/tempfiles/rootpassword echo "$timezone" > /mnt/tempfiles/timezone +echo "$swap" > /mnt/tempfiles/swap # download and initiate part 2 curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/chrootInstall.sh -o /mnt/chrootInstall.sh