diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-07-03 02:01:24 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-07-03 02:01:24 +0200 |
commit | 786d31170abb926496e2a8964157e474c2b32b2d (patch) | |
tree | 7aa6c6577e6bd582221909dc85c2bc364ff49ae4 /roles/installer/debian/preseed/templates/partman_early-command.sh.j2 | |
parent | fix bar-variable warning (diff) | |
parent | use new preseed config in some hosts (diff) |
Merge branch 'topic/preseed-configurable-disk-layout'
Diffstat (limited to 'roles/installer/debian/preseed/templates/partman_early-command.sh.j2')
-rw-r--r-- | roles/installer/debian/preseed/templates/partman_early-command.sh.j2 | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 new file mode 100644 index 00000000..9c720e92 --- /dev/null +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -0,0 +1,33 @@ +#!/bin/sh + +umount -l /media || true + + +{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} +disks="{% for disk in hostvars[install_hostname].install_cooked.disks.raid.members %}$(readlink -f {{ disk }}) {% endfor %}" + +raid_members_boot="" +raid_members_lvm="" +for disk in $disks; do + [ -n "$raid_members_boot" ] && raid_members_boot="$raid_members_boot#" + [ -n "$raid_members_lvm" ] && raid_members_lvm="$raid_members_lvm#" + if echo "$disk" | grep -Eq "/dev/(s|v)d[a-z]"; then + raid_members_boot="$raid_members_boot$disk"1 + raid_members_lvm="$raid_members_lvm$disk"2 + else + raid_members_boot="$raid_members_boot$disk"p1 + raid_members_lvm="$raid_members_lvm$disk"p2 + fi +done +raid_config="{{ hostvars[install_hostname].install_cooked.disks.raid.level }} {{ hostvars[install_hostname].install_cooked.disks.raid.members | length }} 0" + +debconf-set partman-auto-raid/recipe "$raid_config ext4 /boot $raid_members_boot . $raid_config lvm - $raid_members_lvm ." +{% else %} +disks="$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})" +{% endif %} +debconf-set partman-auto/disk "$disks" +debconf-set grub-installer/bootdev "$disks" + +## https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks +. /usr/share/debconf/confmodule +db_fset grub-installer/bootdev seen true |