[TASK] Improve install script
This commit is contained in:
parent
626c3a57be
commit
fbb483acbc
@ -7,55 +7,65 @@ loadkeys de
|
|||||||
lsbkl
|
lsbkl
|
||||||
|
|
||||||
|
|
||||||
# GPT-Partitionstabelle erstellen
|
# Partitioning
|
||||||
|
read -p "Create partitions table? DELETES ALL DATA! (j/N): " answer
|
||||||
|
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
|
||||||
|
# GPT-partition table creation
|
||||||
parted /dev/sda -- mklabel gpt
|
parted /dev/sda -- mklabel gpt
|
||||||
|
|
||||||
# EFI-Partition (512 MB)
|
# EFI-partition (512 MB)
|
||||||
parted /dev/sda -- mkpart esp fat32 1MB 512MB
|
parted /dev/sda -- mkpart esp fat32 1MB 512MB
|
||||||
parted /dev/sda -- set 1 esp on
|
parted /dev/sda -- set 1 esp on
|
||||||
|
|
||||||
# Swap-Partition (8 GB)
|
# Swap-partition (8 GB)
|
||||||
parted /dev/sda -- mkpart swap linux-swap 512MB 8626MB
|
parted /dev/sda -- 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 /dev/sda -- mkpart root ext4 8636MB 40000MB
|
||||||
|
|
||||||
# Home-Partition (Rest)
|
# Home-partition (Rest)
|
||||||
parted /dev/sda -- mkpart home ext4 40000MB 100%
|
parted /dev/sda -- mkpart home ext4 40000MB 100%
|
||||||
|
fi
|
||||||
|
|
||||||
# Ergebnis pruefen
|
# Check results
|
||||||
parted /dev/sda -- print
|
parted /dev/sda -- print
|
||||||
|
|
||||||
|
|
||||||
# EFI-Partition formatieren
|
# Format EFI-partition
|
||||||
mkfs.fat -F 32 -n boot /dev/sda1
|
mkfs.fat -F 32 -n boot /dev/sda1
|
||||||
|
|
||||||
# Swap-Partition formatieren
|
# Format swap-partition
|
||||||
mkswap -L swap /dev/sda2
|
mkswap -L swap /dev/sda2
|
||||||
|
|
||||||
# Root-Partition formatieren
|
# Format root-partition
|
||||||
mkfs.ext4 -L nixos /dev/sda3
|
mkfs.ext4 -L nixos /dev/sda3
|
||||||
|
|
||||||
# Home-Partition formatieren
|
read -p "Home-Partition formatieren? LOESCHT BENUTZERDATEN! (j/N): " answer
|
||||||
|
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
|
||||||
|
# Format home-partition
|
||||||
mkfs.ext4 -L home /dev/sda4
|
mkfs.ext4 -L home /dev/sda4
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Root mounten
|
# Mount partitions
|
||||||
mount /dev/disk/by-label/nixos /mnt
|
mount /dev/disk/by-label/nixos /mnt
|
||||||
|
|
||||||
# Boot-Verzeichnis erstellen und mounten
|
|
||||||
mkdir /mnt/boot
|
mkdir /mnt/boot
|
||||||
mount -o umask=077 /dev/disk/by-label/boot /mnt/boot
|
mount -o umask=077 /dev/disk/by-label/boot /mnt/boot
|
||||||
|
|
||||||
# Home-Verzeichnis erstellen und mounten
|
|
||||||
mkdir -p /mnt/home
|
mkdir -p /mnt/home
|
||||||
mount /dev/disk/by-label/home /mnt/home
|
mount /dev/disk/by-label/home /mnt/home
|
||||||
|
|
||||||
# Swap aktivieren
|
# Activate swap
|
||||||
swapon /dev/disk/by-label/swap
|
swapon /dev/disk/by-label/swap
|
||||||
|
|
||||||
|
|
||||||
nixos-generate-config --root /mnt
|
nixos-generate-config --root /mnt
|
||||||
|
|
||||||
|
|
||||||
|
# If root password wasn't set because the installation needed to be restarted.
|
||||||
|
read -p "Root-Passwort mit nixos-enter setzen? (j/N): " answer
|
||||||
|
if [ "$answer" = "j" ] || [ "$answer" = "J" ]; then
|
||||||
nixos-enter --root '/mnt'
|
nixos-enter --root '/mnt'
|
||||||
passwd
|
passwd
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user