Create generic script for partitioning disks
This commit is contained in:
parent
e4ff7b784a
commit
0476f5d9f2
3 changed files with 14 additions and 13 deletions
|
@ -22,7 +22,8 @@ tempDir="$tempRoot/$relativeDir";
|
||||||
|
|
||||||
loadkeys "$ARCH_KEYMAP";
|
loadkeys "$ARCH_KEYMAP";
|
||||||
timedatectl set-timezone "$ARCH_TIMEZONE";
|
timedatectl set-timezone "$ARCH_TIMEZONE";
|
||||||
. "./partition.sh";
|
OS_DISK="${ARCH_DISK}" \
|
||||||
|
. "../../Common/OS/partition.sh";
|
||||||
|
|
||||||
pacman-key --init;
|
pacman-key --init;
|
||||||
pacman-key --populate;
|
pacman-key --populate;
|
||||||
|
|
|
@ -29,4 +29,4 @@
|
||||||
echo "23";
|
echo "23";
|
||||||
|
|
||||||
echo "w";
|
echo "w";
|
||||||
} | fdisk "$ARCH_DISK";
|
} | fdisk "$OS_DISK";
|
22
scripts/Arch/OS/partition.sh → scripts/Common/OS/partition.sh
Executable file → Normal file
22
scripts/Arch/OS/partition.sh → scripts/Common/OS/partition.sh
Executable file → Normal file
|
@ -1,31 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||||
|
|
||||||
source "../../Common/Scripts/is-truthy.sh";
|
source "../Scripts/is-truthy.sh";
|
||||||
source "../../Common/Scripts/choose-disk.sh";
|
source "../Scripts/choose-disk.sh";
|
||||||
ARCH_DISK="${ARCH_DISK}";
|
OS_DISK="${OS_DISK}";
|
||||||
SKIP_FORMAT_EFI="${SKIP_FORMAT_EFI}";
|
SKIP_FORMAT_EFI="${SKIP_FORMAT_EFI}";
|
||||||
PARTITION_SCRIPT="${PARTITION_SCRIPT:-"./default-partition.sh"}";
|
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) * 0.75) + 0.5)}')";
|
swapSize="$(echo "$memory" | awk '{ print int((($1 / 1024 / 1024) * 0.75) + 0.5)}')";
|
||||||
|
|
||||||
export SWAP_SIZE="$swapSize";
|
if [ ! -z "$OS_DISK" ] && [ ! -e "$OS_DISK" ]
|
||||||
|
|
||||||
if [ ! -z "$ARCH_DISK" ] && [ ! -e "$ARCH_DISK" ]
|
|
||||||
then
|
then
|
||||||
ARCH_DISK="/dev/${ARCH_DISK}"
|
OS_DISK="/dev/${OS_DISK}"
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
if [ -z "$ARCH_DISK" ] || [ ! -e "$ARCH_DISK" ]
|
if [ -z "$OS_DISK" ] || [ ! -e "$OS_DISK" ]
|
||||||
then
|
then
|
||||||
chooseDisk ARCH_DISK "Which disk do you wish to format for installing Arch?";
|
chooseDisk OS_DISK "Which disk do you wish to format for installing the OS?";
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
. "$PARTITION_SCRIPT";
|
OS_DISK="${OS_DISK}" \
|
||||||
|
SWAP_SIZE="$swapSize" \
|
||||||
|
. "$PARTITION_SCRIPT";
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
disks=($(bash -c "echo $ARCH_DISK*"));
|
disks=($(bash -c "echo $OS_DISK*"));
|
||||||
[ "${#disks[@]}" -ge 4 ] && break;
|
[ "${#disks[@]}" -ge 4 ] && break;
|
||||||
done;
|
done;
|
||||||
|
|
Loading…
Reference in a new issue