[TASK] Allow different hdds for installation
This commit is contained in:
parent
88929f83e6
commit
cdb63d1114
@ -4,40 +4,51 @@ sudo -i
|
|||||||
|
|
||||||
loadkeys de
|
loadkeys de
|
||||||
|
|
||||||
lsbkl
|
lsblk
|
||||||
|
|
||||||
|
# Disk selection
|
||||||
|
DEFAULT_DISK="/dev/sda"
|
||||||
|
read -p "Disk to install to [${DEFAULT_DISK}]: " DISK
|
||||||
|
DISK="${DISK:-$DEFAULT_DISK}"
|
||||||
|
|
||||||
|
if [ ! -b "$DISK" ]; then
|
||||||
|
echo "Error: ${DISK} is not a valid block device."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using disk: ${DISK}"
|
||||||
|
|
||||||
# Partitioning
|
# Partitioning
|
||||||
read -p "Create partitions table? DELETES ALL DATA! (j/N): " answer
|
read -p "Create partitions table? DELETES ALL DATA! (j/N): " answer
|
||||||
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
|
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
|
||||||
# GPT-partition table
|
# GPT-partition table
|
||||||
parted /dev/sda -- mklabel gpt
|
parted "${DISK}" -- mklabel gpt
|
||||||
|
|
||||||
# EFI-partition (512 MB)
|
# EFI-partition (512 MB)
|
||||||
parted /dev/sda -- mkpart esp fat32 1MB 512MB
|
parted "${DISK}" -- mkpart esp fat32 1MB 512MB
|
||||||
parted /dev/sda -- set 1 esp on
|
parted "${DISK}" -- set 1 esp on
|
||||||
|
|
||||||
# Swap-partition (8 GB)
|
# Swap-partition (8 GB)
|
||||||
parted /dev/sda -- mkpart swap linux-swap 512MB 8626MB
|
parted "${DISK}" -- mkpart swap linux-swap 512MB 8626MB
|
||||||
|
|
||||||
# Root-partition (ca. 45 GB)
|
# Root-partition (ca. 45 GB)
|
||||||
parted /dev/sda -- mkpart root ext4 8636MB 40000MB
|
parted "${DISK}" -- mkpart root ext4 8636MB 40000MB
|
||||||
|
|
||||||
# Home-partition (Rest)
|
# Home-partition (Rest)
|
||||||
parted /dev/sda -- mkpart home ext4 40000MB 100%
|
parted "${DISK}" -- mkpart home ext4 40000MB 100%
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check results
|
# Check results
|
||||||
parted /dev/sda -- print
|
parted "${DISK}" -- print
|
||||||
|
|
||||||
mkfs.fat -F 32 -n boot /dev/sda1
|
mkfs.fat -F 32 -n boot ${DISK}1
|
||||||
mkswap -L swap /dev/sda2
|
mkswap -L swap ${DISK}2
|
||||||
mkfs.ext4 -L nixos /dev/sda3
|
mkfs.ext4 -L nixos ${DISK}3
|
||||||
|
|
||||||
read -p "Format Home-partition? Deletes all userdata! (j/N): " answer
|
read -p "Format Home-partition? Deletes all userdata! (j/N): " answer
|
||||||
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
|
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
|
||||||
# Format home-partition
|
# Format home-partition
|
||||||
mkfs.ext4 -L home /dev/sda4
|
mkfs.ext4 -L home ${DISK}4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user