69 lines
1.2 KiB
Bash
Executable file
69 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|
|
|
source "../../Common/Scripts/choose-disk.sh";
|
|
ARCH_DISK="${ARCH_DISK}";
|
|
memory="$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }')";
|
|
swapSize="$(echo "$memory" | awk '{ print int(($1 / 1024 / 1024 4) + 0.5)}')";
|
|
|
|
if [ ! -z "$ARCH_DISK" ] && [ ! -e "$ARCH_DISK" ]
|
|
then
|
|
ARCH_DISK="/dev/${ARCH_DISK}"
|
|
fi;
|
|
|
|
if [ -z "$ARCH_DISK" ] || [ ! -e "$ARCH_DISK" ]
|
|
then
|
|
chooseDisk ARCH_DISK "Which disk do you wish to format for installing Arch?";
|
|
fi;
|
|
|
|
{
|
|
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";
|
|
echo "";
|
|
echo "19";
|
|
|
|
echo "n";
|
|
echo "";
|
|
echo "";
|
|
echo "";
|
|
echo "y";
|
|
echo "t";
|
|
echo "";
|
|
echo "23";
|
|
|
|
echo "w";
|
|
} | fdisk "$ARCH_DISK";
|
|
|
|
while true
|
|
do
|
|
disks=($(bash -c "echo $ARCH_DISK*"));
|
|
[ "${#disks[@]}" -ge 4 ] && break;
|
|
done;
|
|
|
|
bootDisk="${disks[1]}";
|
|
swapDisk="${disks[2]}";
|
|
linuxDisk="${disks[3]}";
|
|
|
|
mkfs.fat -F 32 "$bootDisk";
|
|
mkswap "$swapDisk";
|
|
mkfs.ext4 -F "$linuxDisk";
|
|
|
|
mount "$linuxDisk" /mnt;
|
|
mount --mkdir "$bootDisk" /mnt/boot;
|
|
swapon "$swapDisk";
|
|
|
|
popd > /dev/null;
|