diff --git a/scripts/Arch/OS/default-partition.sh b/scripts/Arch/OS/default-partition.sh new file mode 100644 index 00000000..720efbaa --- /dev/null +++ b/scripts/Arch/OS/default-partition.sh @@ -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"; diff --git a/scripts/Arch/OS/partition.sh b/scripts/Arch/OS/partition.sh index 8a9dd7a0..2f0b8b4d 100755 --- a/scripts/Arch/OS/partition.sh +++ b/scripts/Arch/OS/partition.sh @@ -3,9 +3,12 @@ pushd "${BASH_SOURCE%/*}" > /dev/null; source "../../Common/Scripts/choose-disk.sh"; ARCH_DISK="${ARCH_DISK}"; +PARTITION_SCRIPT="${PARTITION_SCRIPT:-"./default-partition.sh"}"; memory="$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }')"; swapSize="$(echo "$memory" | awk '{ print int(($1 / 1024 / 1024 4) + 0.5)}')"; +export SWAP_SIZE="$swapSize"; + if [ ! -z "$ARCH_DISK" ] && [ ! -e "$ARCH_DISK" ] then ARCH_DISK="/dev/${ARCH_DISK}" @@ -16,37 +19,7 @@ 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"; +. "$PARTITION_SCRIPT"; while true do @@ -54,9 +27,9 @@ do [ "${#disks[@]}" -ge 4 ] && break; done; -bootDisk="${disks[1]}"; -swapDisk="${disks[2]}"; -linuxDisk="${disks[3]}"; +bootDisk="${BOOT_DISK:-"${disks[1]}"}"; +swapDisk="${SWAP_DISK:-"${disks[2]}"}"; +linuxDisk="${LINUX_DISK:-"${disks[3]}"}"; mkfs.fat -F 32 "$bootDisk"; mkswap "$swapDisk";