2023-04-01 00:41:07 +00:00
|
|
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|
|
|
|
2023-04-01 15:08:17 +00:00
|
|
|
source "../../Common/Scripts/choose-disk.sh";
|
2023-04-01 11:40:52 +00:00
|
|
|
ARCH_DISK="${ARCH_DISK}";
|
2023-04-01 00:41:07 +00:00
|
|
|
memory="$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }')";
|
2023-04-01 10:28:53 +00:00
|
|
|
swapSize="$(echo "$memory" | awk '{ print int(($1 / 1024 / 1024 4) + 0.5)}')";
|
2023-04-01 00:41:07 +00:00
|
|
|
|
2023-04-07 16:25:21 +00:00
|
|
|
if [ ! -z "$ARCH_DISK" ] && [ ! -e "$ARCH_DISK" ]
|
|
|
|
then
|
|
|
|
ARCH_DISK="/dev/${ARCH_DISK}"
|
|
|
|
fi;
|
|
|
|
|
|
|
|
if [ -z "$ARCH_DISK" ] || [ ! -e "$ARCH_DISK" ]
|
2023-04-01 11:40:52 +00:00
|
|
|
then
|
|
|
|
chooseDisk ARCH_DISK "Which disk do you wish to format for installing Arch?";
|
|
|
|
fi;
|
|
|
|
|
2023-04-01 00:41:07 +00:00
|
|
|
{
|
|
|
|
echo "g";
|
|
|
|
|
|
|
|
echo "n";
|
|
|
|
echo "";
|
|
|
|
echo "";
|
|
|
|
echo "+1G";
|
|
|
|
echo "y";
|
|
|
|
echo "t";
|
|
|
|
echo "1";
|
|
|
|
|
|
|
|
echo "n";
|
|
|
|
echo "";
|
|
|
|
echo "";
|
|
|
|
echo "+${swapSize}G";
|
|
|
|
echo "y";
|
|
|
|
echo "t";
|
2023-04-01 01:15:21 +00:00
|
|
|
echo "";
|
2023-04-01 00:41:07 +00:00
|
|
|
echo "19";
|
|
|
|
|
|
|
|
echo "n";
|
|
|
|
echo "";
|
|
|
|
echo "";
|
|
|
|
echo "";
|
|
|
|
echo "y";
|
|
|
|
echo "t";
|
2023-04-01 01:15:21 +00:00
|
|
|
echo "";
|
2023-04-01 00:41:07 +00:00
|
|
|
echo "23";
|
|
|
|
|
|
|
|
echo "w";
|
2023-04-01 10:38:15 +00:00
|
|
|
} | fdisk "$ARCH_DISK";
|
2023-04-01 00:41:07 +00:00
|
|
|
|
2023-04-01 10:38:15 +00:00
|
|
|
disks=($(bash -c "echo $ARCH_DISK*"));
|
2023-04-01 01:32:04 +00:00
|
|
|
bootDisk="${disks[1]}";
|
|
|
|
swapDisk="${disks[2]}";
|
|
|
|
linuxDisk="${disks[3]}";
|
2023-04-01 01:30:58 +00:00
|
|
|
|
|
|
|
mkfs.fat -F 32 "$bootDisk";
|
|
|
|
mkswap "$swapDisk";
|
|
|
|
mkfs.ext4 "$linuxDisk";
|
|
|
|
|
2023-04-01 01:19:02 +00:00
|
|
|
mount "$linuxDisk" /mnt;
|
|
|
|
mount --mkdir "$bootDisk" /mnt/boot;
|
|
|
|
swapon "$swapDisk";
|
2023-04-01 01:15:32 +00:00
|
|
|
|
2023-04-01 00:41:07 +00:00
|
|
|
popd > /dev/null;
|