Allow specifying custom partition script

This commit is contained in:
Manuel Thalmann 2023-07-12 22:54:50 +02:00
parent 5ff7726d23
commit fa32e7eb3f
2 changed files with 39 additions and 34 deletions

View file

@ -0,0 +1,32 @@
#!/bin/bash
{
echo "g";
echo "n";
echo "";
echo "";
echo "+1G";
echo "y";
echo "t";
echo "1";
echo "n";
echo "";
echo "";
echo "+${SWAP_SIZE}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";

View file

@ -3,9 +3,12 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
source "../../Common/Scripts/choose-disk.sh"; source "../../Common/Scripts/choose-disk.sh";
ARCH_DISK="${ARCH_DISK}"; ARCH_DISK="${ARCH_DISK}";
PARTITION_SCRIPT="${PARTITION_SCRIPT:-"./default-partition.sh"}";
memory="$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }')"; memory="$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }')";
swapSize="$(echo "$memory" | awk '{ print int(($1 / 1024 / 1024 4) + 0.5)}')"; swapSize="$(echo "$memory" | awk '{ print int(($1 / 1024 / 1024 4) + 0.5)}')";
export SWAP_SIZE="$swapSize";
if [ ! -z "$ARCH_DISK" ] && [ ! -e "$ARCH_DISK" ] if [ ! -z "$ARCH_DISK" ] && [ ! -e "$ARCH_DISK" ]
then then
ARCH_DISK="/dev/${ARCH_DISK}" ARCH_DISK="/dev/${ARCH_DISK}"
@ -16,37 +19,7 @@ then
chooseDisk ARCH_DISK "Which disk do you wish to format for installing Arch?"; chooseDisk ARCH_DISK "Which disk do you wish to format for installing Arch?";
fi; fi;
{ . "$PARTITION_SCRIPT";
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 while true
do do
@ -54,9 +27,9 @@ do
[ "${#disks[@]}" -ge 4 ] && break; [ "${#disks[@]}" -ge 4 ] && break;
done; done;
bootDisk="${disks[1]}"; bootDisk="${BOOT_DISK:-"${disks[1]}"}";
swapDisk="${disks[2]}"; swapDisk="${SWAP_DISK:-"${disks[2]}"}";
linuxDisk="${disks[3]}"; linuxDisk="${LINUX_DISK:-"${disks[3]}"}";
mkfs.fat -F 32 "$bootDisk"; mkfs.fat -F 32 "$bootDisk";
mkswap "$swapDisk"; mkswap "$swapDisk";