|
@@ -27,7 +27,7 @@
|
|
|
# Variables
|
|
|
mnt="/mnt/root" # mountpoint for the root filesystem during installation
|
|
|
hostname="somehost.example.com"
|
|
|
-partition="mbr-single"
|
|
|
+partition="mbr-single" # mbr-single or efi-crypt
|
|
|
disk="/dev/vda" # lsblk --list
|
|
|
disk1=$disk"1"
|
|
|
disk0=$disk"p1" # efi partion, only relevant if partion="efi"
|
|
@@ -55,23 +55,61 @@ echo nameserver $netDNS2 >> /etc/resolv.conf
|
|
|
|
|
|
install(){
|
|
|
|
|
|
+
|
|
|
+# Wipe existing partition table
|
|
|
+dd if=/dev/zero of=$disk bs=512 count=34
|
|
|
+
|
|
|
+# Parition disks -- pkg: parted
|
|
|
+# Prepare partition tables and partitions
|
|
|
+# -parted --script does not accept blanks in partition names
|
|
|
+
|
|
|
if [ "$partition" = "mbr-single" ]
|
|
|
then
|
|
|
#----------
|
|
|
- # Prepare disks
|
|
|
- # Parition disks -- pkg: parted
|
|
|
- parted $disk -s \
|
|
|
+ # Prepare disks with a single partition
|
|
|
+ parted $disk --script \
|
|
|
mklabel msdos \
|
|
|
mkpart primary ext4 512M 100% toggle 1 boot
|
|
|
fdisk -l $disk
|
|
|
|
|
|
# Format disks -- pkg: e2fsprogs dosfstools and to file system check
|
|
|
mkfs.ext4 $disk1 && e2fsck $disk1
|
|
|
+
|
|
|
+ # Prepare mount points and mount
|
|
|
+ mkdir -p $mnt
|
|
|
+ mount $disk1 $mnt
|
|
|
+fi
|
|
|
+
|
|
|
+if [ "$partition" = "efi-crypt" ]
|
|
|
+then
|
|
|
+ #----------
|
|
|
+ # Prepare disks with following layout
|
|
|
+ # - 301 MB partition for EFI --> p1
|
|
|
+ # - 50 GB root partition for the OS (includes /boot) --> p2
|
|
|
+ # - Remaining disk left to create a luks container --> p3
|
|
|
+ parted $disk --script \
|
|
|
+ mklabel gpt \
|
|
|
+ mkpart EFI_system_partition fat32 1MiB 301MiB \
|
|
|
+ set 1 esp on \
|
|
|
+ set 1 boot on \
|
|
|
+ align-check optimal 1 \
|
|
|
+ mkpart Linux_system_parition ext4 301MiB 50GiB \
|
|
|
+ align-check optimal 2 \
|
|
|
+ mkpart Data_partion 50GiB 100% \
|
|
|
+ align-check optimal 3 \
|
|
|
+ unit MiB \
|
|
|
+ print
|
|
|
+
|
|
|
+ # Format disks -- pkg: e2fsprogs dosfstools and to file system check
|
|
|
+ mkfs.fat -F 32 -n EFIBOOT $disk0 && fsck $disk0
|
|
|
+ mkfs.ext4 $disk1 && fsck $disk1
|
|
|
+
|
|
|
+ # Prepare mount points and mount
|
|
|
+ mkdir -p $mnt $mnt"/boot/efi"
|
|
|
+ mount $disk1 $mnt
|
|
|
+ mount $disk0 $mnt"/boot/efi"
|
|
|
fi
|
|
|
|
|
|
-# Prepare mount points and mount
|
|
|
-mkdir -p $mnt
|
|
|
-mount $disk1 $mnt
|
|
|
|
|
|
# Create swapfile
|
|
|
swapfile=$mnt/swapfile
|