Browse Source

added variable kernel and dynamic grub version

Toastie 1 year ago
parent
commit
a5a2b6de65
1 changed files with 21 additions and 15 deletions
  1. 21 15
      bootstrap-bookworm.sh

+ 21 - 15
bootstrap-bookworm.sh

@@ -24,27 +24,34 @@
 # !! Note down the admin passwords and reboot
 # sudo /installer/bootstrap-bullseye.sh postinstall  # run postinstall in the new system
 
-# Variables
-mnt="/mnt/root"                  # mountpoint for the new root filesystem
+# Default variables
+mnt="/mnt/root"                     # mountpoint for the new root filesystem
 hostname="somehost.example.com"
-kernel="linux-image-cloud-amd64" # alternative: linux-image-amd64
-partition="mbr-single"           # mbr-single or efi-crypt
-disk="/dev/vda"                  # find with: lsblk --list
-disk0=$disk"p1"                  # efi partion, only relevant if partion="efi"
-disk1=$disk"1"                   # "p1" for nbd or nvme mounts
-netDev="eth0"                    # find with: ip link
-netAddress="203.0.113.66/24"     # "" blank for dhcp on e*
+kernelPkg="linux-image-cloud-amd64" # alternative: linux-image-amd64
+partition="mbr-single"              # mbr-single or efi-crypt
+disk="/dev/vda"                     # find with: lsblk --list
+disk0=$disk"p1"                     # efi partion, only relevant if partion="efi"
+disk1=$disk"1"                      # "p1" for nbd or nvme mounts
+netDev="eth0"                       # find with: ip link
+netAddress="203.0.113.66/24"        # "" blank for dhcp on e*
 netGateway="203.0.113.1"
 netBroadcast="203.0.113.255"
 netDNS1="192.0.2.10"
 netDNS2="198.51.100.10"
 netNTP="pool.ntp.org"
-pwdAdmin=""                      # "" blank for auto-generation
-pwdRoot=""                       # "" blank for auto-generation
-extraPackages="qemu-guest-agent"
+pwdAdmin=""                         # "" blank for auto-generation
+pwdRoot=""                          # "" blank for auto-generation
+extraPackages="qemu-guest-agent"    # additional packages to install
 
+# Overwrite default variables from config file
 [ -f ./config.sh ] && source config.sh
 
+# Select grub version based on partition table
+case "$partition" in
+   mbr-single)   grubPkg="grub-pc"   ;;
+   efi-crypt)    grubPkg="grub-efi"  ;;
+esac
+
 
 # Setup network in grml
 grmlnetwork(){
@@ -56,9 +63,8 @@ echo nameserver $netDNS1 >> /etc/resolv.conf
 echo nameserver $netDNS2 >> /etc/resolv.conf
 }
 
-install(){
-
 
+install(){
 # Wipe existing partition table
 dd if=/dev/zero of=$disk bs=512 count=34
 
@@ -177,7 +183,7 @@ apt-get update
 apt-get install --yes \
   apt-utils dialog msmtp-mta \
   systemd-sysv locales tzdata haveged \
-  linux-image-cloud-amd64 grub-pc \
+  $kernelPkg $grubPkg \
   iproute2 netbase \
   ssh sudo molly-guard  \
   less vim-tiny bash-completion pwgen lsof \