Partition disks using a function
This commit is contained in:
parent
c3bcd60a10
commit
a14a29ed28
3 changed files with 43 additions and 35 deletions
|
@ -7,7 +7,12 @@ extraMounts()
|
|||
mount --mkdir -o force -t ntfs3 "${disks[-1]}" "$ARCH_MOUNT_ROOT/mnt/win";
|
||||
}
|
||||
|
||||
PARTITION_SCRIPT="$(pwd)/partition.sh" \
|
||||
function initializePartitions() {
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
. "./partition.sh";
|
||||
popd > /dev/null;
|
||||
}
|
||||
|
||||
SKIP_FORMAT_EFI=1 \
|
||||
ARCH_MOUNT_ROOT="/mnt" \
|
||||
ARCH_DISK=nvme0n1 \
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
#!/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 "$OS_DISK";
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||
|
||||
source "../Scripts/hooks.sh";
|
||||
source "../Scripts/is-truthy.sh";
|
||||
source "../Scripts/choose-disk.sh";
|
||||
OS_MOUNT_ROOT="${OS_ROOT:-"/mnt"}";
|
||||
|
@ -10,7 +11,6 @@ OS_LABEL="${OS_LABEL:-Linux}";
|
|||
SWAP_LABEL="${SWAP_LABEL:-Swap}";
|
||||
BOOT_MOUNTPOINT="${BOOT_MOUNTPOINT:-"/boot"}";
|
||||
SKIP_FORMAT_EFI="${SKIP_FORMAT_EFI}";
|
||||
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) * 0.75) + 0.5)}')";
|
||||
|
||||
|
@ -24,9 +24,44 @@ then
|
|||
chooseDisk OS_DISK "Which disk do you wish to format for installing the OS?";
|
||||
fi;
|
||||
|
||||
function partitionDisk() {
|
||||
{
|
||||
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 "$OS_DISK";
|
||||
}
|
||||
|
||||
OS_DISK="${OS_DISK}" \
|
||||
SWAP_SIZE="$swapSize" \
|
||||
. "$PARTITION_SCRIPT";
|
||||
runHook initializePartitions \
|
||||
partitionDisk;
|
||||
|
||||
while true
|
||||
do
|
||||
|
|
Loading…
Reference in a new issue