|
@@ -32,11 +32,8 @@ ping -c 3 archlinux.org
|
|
timedatectl set-ntp true
|
|
timedatectl set-ntp true
|
|
timedatectl status
|
|
timedatectl status
|
|
|
|
|
|
-# detect disks (if only one exists we can use it)
|
|
|
|
-# @todo: make sure this ignores optical drives (???)
|
|
|
|
-export disk=$(lsblk -l | grep disk | awk '{print $1}')
|
|
|
|
-
|
|
|
|
# if more than one disk exists ask which to use:
|
|
# if more than one disk exists ask which to use:
|
|
|
|
+export disk=$(lsblk -l | grep disk | awk '{print $1}')
|
|
if [ $(echo "$disk" | wc -l) -gt 1 ]; then
|
|
if [ $(echo "$disk" | wc -l) -gt 1 ]; then
|
|
echo -e "multiple disks found:\n$disk"
|
|
echo -e "multiple disks found:\n$disk"
|
|
read -p "please enter the name of the disk you want to use: " disk
|
|
read -p "please enter the name of the disk you want to use: " disk
|
|
@@ -48,15 +45,14 @@ if [ $(echo "$disk" | wc -l) -gt 1 ]; then
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
-# either use sane default or intelligently size swap for hibernation
|
|
|
|
|
|
+# assume sane default for swap, or intelligently size for hibernation
|
|
export swap_size=2048
|
|
export swap_size=2048
|
|
if [ "$enable_hibernation" = "y" ]; then
|
|
if [ "$enable_hibernation" = "y" ]; then
|
|
- export ram_size=$(numfmt --from-unit=K --from=iec --to-unit=M --to=iec $(cat /proc/meminfo | grep MemTotal | awk '{print $2}'))
|
|
|
|
- if [ $ram_size -le $(numfmt --from-unit=1024 --from=iec 4G) ]; then
|
|
|
|
- export swap_size=$(printf %.0f $(echo "$ram_size * 1.5" | bc))
|
|
|
|
|
|
+ export ram_size=$(numfmt --to-unit=Mi --from-unit=K $(cat /proc/meminfo | grep MemTotal | awk '{print $2}'))
|
|
|
|
+ if [ $ram_size -le $(numfmt --to-unit=Mi --from=iec 4G) ]; then
|
|
|
|
+ export swap_size=$(echo $(($ram_size * 3 / 2)))
|
|
else
|
|
else
|
|
- export ram_sqrt=$(echo "sqrt($(numfmt --from-unit=M --to-unit=Gi $ram_size))" | bc)
|
|
|
|
- export swap_size=$(printf %.0f $(echo "$ram_size + $(numfmt --from-unit=Gi --to-unit=Mi $ram_sqrt)" | bc))
|
|
|
|
|
|
+ swap_size=$(printf %.0f $(echo "sqrt($ram_size) + $ram_size" | bc))
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
@@ -64,8 +60,8 @@ fi
|
|
parted "/dev/${disk}" -s 'mklabel gpt'
|
|
parted "/dev/${disk}" -s 'mklabel gpt'
|
|
parted "/dev/${disk}" -s 'mkpart primary fat32 1MiB 1024MiB'
|
|
parted "/dev/${disk}" -s 'mkpart primary fat32 1MiB 1024MiB'
|
|
parted "/dev/${disk}" -s 'set 1 esp on'
|
|
parted "/dev/${disk}" -s 'set 1 esp on'
|
|
-parted "/dev/${disk}" -s "mkpart primary linux-swap 1024MiB ${swap_size}MiB"
|
|
|
|
-parted "/dev/${disk}" -s "mkpart primary btrfs ${swap_size}MiB 100%"
|
|
|
|
|
|
+parted "/dev/${disk}" -s "mkpart primary linux-swap 1024MiB $((swap_size + 1024))MiB"
|
|
|
|
+parted "/dev/${disk}" -s "mkpart primary btrfs $((swap_size + 1024))MiB 100%"
|
|
|
|
|
|
# acquire partitions as an array
|
|
# acquire partitions as an array
|
|
export partitions=( $(lsblk -l -xNAME "/dev/${disk}" | grep part | awk '{print $1}') )
|
|
export partitions=( $(lsblk -l -xNAME "/dev/${disk}" | grep part | awk '{print $1}') )
|
|
@@ -85,7 +81,7 @@ mount "/dev/${partitions[0]}" /mnt/boot
|
|
pacstrap /mnt base base-devel
|
|
pacstrap /mnt base base-devel
|
|
genfstab -U -p /mnt >> /mnt/etc/fstab
|
|
genfstab -U -p /mnt >> /mnt/etc/fstab
|
|
|
|
|
|
-# this assumes that arch.sh and install/ exists and will copy them to continue
|
|
|
|
|
|
+# this assumes that arch.sh and install/ exist and will copy them to continue
|
|
# @note: would prefer to copy to `/tmp` but `/mnt/tmp` from iso is a separate tmpfs
|
|
# @note: would prefer to copy to `/tmp` but `/mnt/tmp` from iso is a separate tmpfs
|
|
mkdir -p /mnt/srv/arch-desktop
|
|
mkdir -p /mnt/srv/arch-desktop
|
|
cp -r install /mnt/srv/arch-desktop/
|
|
cp -r install /mnt/srv/arch-desktop/
|