archinstall/install.sh
2023-11-10 14:11:49 +01:00

35 lines
804 B
Bash
Executable File

#!/bin/bash -ex
cd "$(dirname "$0")"
. ./config
. ./src/lib.sh
(
case "$swapfile" in
[0-9]*)
size="$swapfile"
;;
auto)
ram="$(free -m | awk '$1 == "Mem:" {print $2}')"
size="$(python -c "from math import ceil,log; print(2**ceil((log($ram)/log(2))))")"
;;
*)
exit
;;
esac
dd if=/dev/zero of=/mnt/swapfile bs=1M count="$size" status=progress
chmod 600 /mnt/swapfile
mkswap /mnt/swapfile
swapon /mnt/swapfile
)
cp -f rootfs/etc/pacman.conf /etc/pacman.conf
pacman -Sy
pacstrap -K /mnt/ --needed "${pkg[@]}"
cp -rfT rootfs/ /mnt/
genfstab -U /mnt/ >> /mnt/etc/fstab
cat config src/lib.sh src/install.sh | arch-chroot /mnt/ bash -ex
echo -e "${BOLD}${GREEN}DONE${NORMAL}"