#!/usr/bin/env bash loadkeys us echo ---------------------------------------------------------------------------------------------- echo rwinkhart\'s Artix Install Script echo last updated May 08, 2024 \(rev. B\) echo ---------------------------------------------------------------------------------------------- echo You will be asked some questions before installation. echo -e "----------------------------------------------------------------------------------------------\n" read -n 1 -s -r -p 'Press any key to continue' # start simple questions echo -e '\nSpecial devices:\n1. ASUS Zephyrus G14 (2020)\nGeneric:\n2. Laptop\n3. Desktop\n4. Headless\n' read -n 1 -r -p "Formfactor: " formfactor echo -e "\n" fdisk -l echo read -rp "Disk: " disk read -rp "Swap (in GB): " swap read -n 1 -rp "Clean install? (y/N) " wipe echo read -rp "Username: " username read -rp "$username password: " userpassword read -rp "Hostname: " hostname # end simple questions # start timezone configuration zroot=/usr/share/zoneinfo show_tz_list() { echo local i z= list= local path="$zroot/$1" [ -d "$path" ] || return 1 for i in $(find $path/ -maxdepth 1); do case $i in *.tab|*/) continue;; esac if [ -d "$i" ]; then z="$z ${i##*/}/" else z="$z ${i##*/}" fi done ( cd $path && ls --color=never -Cd $z ) } while true; do show_tz_list echo read -rp "Timezone: " timezone case "$timezone" in none|abort) break;; "") continue;; "?") show_tz_list; continue;; esac while [ -d "$zroot/$timezone" ]; do show_tz_list "$timezone" echo read -rp "$timezone subset: " zone case "$zone" in "?") show_tz_list "$timezone"; continue;; esac timezone="$timezone/$zone" done if [ -f "$zroot/$timezone" ]; then timezone="$zroot/$timezone" break fi echo "'$timezone' is not a valid timezone on this system" done # end timezone configuration # start hardware detection pacman -Sy bc --noconfirm threadsminusone=$(echo "$(lscpu | grep 'CPU(s):' | awk 'FNR == 1 {print $2;}') - 1" | bc) gpu=$(lspci | grep 'VGA compatible controller:' | awk 'FNR == 1 {print $5;}') if ! ([ "$gpu" == 'NVIDIA' ] || [ "$gpu" == 'Intel' ]); then gpu=AMD fi ram=$(echo "$(< /proc/meminfo)" | grep 'MemTotal:' | awk '{print $2;}'); ram=$(echo "$ram / 1000000" | bc) interfaces=(/sys/class/net/*) res_detect=$(> /mnt/etc/fstab echo -e "\ntmpfs /tmp tmpfs rw,nodev,nosuid,size="$(echo ".75 * $ram / 1" | bc)"G 0 0" >> /mnt/etc/fstab # stop partitioning # setting hostname echo "$hostname" > /mnt/etc/hostname echo "hostname=\'"$hostname"\'" > /mnt/etc/conf.d/hostname # installing base packages base_devel='db diffutils gc guile libisl libmpc perl autoconf automake bash dash binutils bison esysusers etmpfiles fakeroot file findutils flex gawk gcc gettext grep groff gzip libtool m4 make pacman pacman-contrib patch pkgconf sed opendoas texinfo which bc udev ntp' basestrap /mnt base $base_devel openrc elogind-openrc linux linux-firmware git man-db iptables-nft # applying IPv6 privacy entensions for all interfaces echo -e 'net.ipv6.conf.all.use_tempaddr = 2\nnet.ipv6.conf.default.use_tempaddr = 2' > /mnt/etc/sysctl.d/40-ipv6.conf for int in "${interfaces[@]}"; do echo "net.ipv6.conf.${int:15}.use_tempaddr = 2" >> /mnt/etc/sysctl.d/40-ipv6.conf done # create array of variables to pass to part 2 var_export=($formfactor $threadsminusone $gpu $boot $disk0 $username $userpassword $timezone $swap $intel_vaapi_driver $res_x $res_y_half) # download and initiate part 2 curl https://raw.githubusercontent.com/rwinkhart/artix-install-script/main/chrootInstall.sh -o /mnt/chrootInstall.sh chmod +x /mnt/chrootInstall.sh artix-chroot /mnt /chrootInstall.sh "${var_export[@]}"