First draft of the installation script
This commit is contained in:
62
install.sh
Executable file
62
install.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
device="CHANGEME" # Device that shoud be partitioned e.g. "/dev/sda"
|
||||
timezone="CHANGEME" # Your timezone according to /usr/share/zoneinfo/ e.g. "/usr/share/zoneinfo/EUROPE/Berlin"
|
||||
locale="CHANGEME" # Your locale according to /etc/locale.gen e.g. "en_US.UTF-8 UTF-8"
|
||||
hostname="CHANGEME" # Name for your machine e.g. "ArchLinux"
|
||||
username="CHANGEME" # Your username e.g. "foo"
|
||||
sudogrp="CHANGEME" # Name of the sudogrp
|
||||
|
||||
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
# partition 1: 1MiB -> 500MiB FAT32
|
||||
# partition 2: 500MiB -> 3GiB swap
|
||||
# partition 3: 3GiB -> .. ext4
|
||||
parted $device mklabel gpt mkpart primary fat32 1MiB 512 mkpart primary linux-swap 500MiB 3GiB mkpart primary ext4 3GiB 100% set 1 esp on -s
|
||||
|
||||
if [ -b "$device\p1" ]; then
|
||||
bootpart=$device\p1
|
||||
swappart=$device\p2
|
||||
rootpart=$device\p3
|
||||
else
|
||||
bootpart=$device\1
|
||||
swappart=$device\2
|
||||
rootpart=$device\3
|
||||
fi
|
||||
|
||||
mkfs.vfat $bootpart
|
||||
mkswap $swappart
|
||||
swapon $swappart
|
||||
|
||||
# LUKS
|
||||
cryptsetup -y luksFormat --type luks2 $rootpart
|
||||
cryptsetup open $rootpart cryptroot
|
||||
|
||||
cryptroot=/dev/mapper/cryptroot
|
||||
|
||||
mkfs.ext4 $cryptroot
|
||||
|
||||
mount $cryptroot /mnt
|
||||
mkdir /mnt/boot
|
||||
mount $bootpart /mnt/boot
|
||||
|
||||
pacstrap /mnt base base-devel linux linux-firmware
|
||||
|
||||
genfstab -U /mnt >> /mnt/etc/fstab
|
||||
|
||||
|
||||
cp $CWD/etc/systemd/system/march.service /mnt/etc/systemd/system/march.service
|
||||
cp $CWD/root/march-chroot.sh /mnt/root/arch-chroot.sh
|
||||
cp $CWD/root/march-reboot.sh /mnt/root/arch-reboot.sh
|
||||
chmod +x /mnt/root/arch-chroot.sh
|
||||
chmod +x /mnt/root/arch-reboot.sh
|
||||
|
||||
arch-chroot /mnt /root/march-chroot.sh -t $timezone -l $locale -h $hostname -u $username -s $sudogrp
|
||||
sed -i "s/arch-reboot.sh/\0 -u $username -s $sudogrp/" /mnt/etc/systemd/system/march.service
|
||||
|
||||
umount $bootpart
|
||||
swapoff $swappart
|
||||
umount $cryptroot
|
||||
cryptsetup close $cryptroot
|
||||
|
||||
shutdown -r now
|
||||
Reference in New Issue
Block a user