summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-22 15:34:17 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-22 15:34:17 +0200
commitf721e9226c6da86b47b2188adedad82567ee0f03 (patch)
tree8b9943f03121cf6af27777c7794e702a0357bcc0
parentMerge branch 'topic/network-overlays-exteneded' (diff)
installer/usb: fix multi-install menu
-rw-r--r--roles/installer/debian/usb/tasks/main.yml31
-rw-r--r--roles/installer/debian/usb/templates/syslinux.cfg.j223
2 files changed, 40 insertions, 14 deletions
diff --git a/roles/installer/debian/usb/tasks/main.yml b/roles/installer/debian/usb/tasks/main.yml
index 7e603ed6..b9969677 100644
--- a/roles/installer/debian/usb/tasks/main.yml
+++ b/roles/installer/debian/usb/tasks/main.yml
@@ -12,15 +12,31 @@
msg: the path to the usb drive does not exist
- name: download installer
+ run_once: true
vars:
debian_installer_distro: "{{ install_distro }}"
debian_installer_codename: "{{ install_codename }}"
debian_installer_arch: "{{ install.arch | default('amd64') }}"
debian_installer_variant: netboot
- run_once: true
import_role:
role: installer/debian/fetch
+- name: find old initramfs images on usb drive
+ run_once: true
+ find:
+ path: "{{ usb_install_path }}"
+ pattern: "initrd.*.gz"
+ register: usb_install_old_intrd
+
+- name: remove old intramfs images from usb drive
+ run_once: true
+ loop: "{{ usb_install_old_intrd.files }}"
+ loop_control:
+ label: "{{ item.path }}"
+ file:
+ path: "{{ item.path }}"
+ state: absent
+
- block:
- name: create temporary workdir
tempfile:
@@ -53,13 +69,19 @@
src: "{{ debian_installer_target_dir }}/linux"
dest: "{{ usb_install_path }}/"
+- name: create BIOS boot directory
+ run_once: true
+ file:
+ path: "{{ usb_install_path }}/bios"
+ state: directory
+
- name: generate syslinux configuration for BIOS boot
run_once: true
vars:
- syslinux_base_path: ""
+ syslinux_base_path: "../"
template:
src: syslinux.cfg.j2
- dest: "{{ usb_install_path }}/syslinux.cfg"
+ dest: "{{ usb_install_path }}/bios/syslinux.cfg"
- name: create EFI boot directory
run_once: true
@@ -84,9 +106,10 @@
$ sudo apt install mbr syslinux
$ sudo install-mbr /dev/CHANGEME
- $ sudo syslinux -i /dev/CHANGEME1
+ $ sudo syslinux -i /dev/CHANGEME1 -d bios
$ sudo fdisk /dev/CHANGEME
[Here, make sure partition 1 is marked bootable.]
+ $ cp /usr/lib/syslinux/modules/bios/* {{ usb_install_path }}/bios/
for UEFI these steps need to be done
diff --git a/roles/installer/debian/usb/templates/syslinux.cfg.j2 b/roles/installer/debian/usb/templates/syslinux.cfg.j2
index c91f7287..ea4b866c 100644
--- a/roles/installer/debian/usb/templates/syslinux.cfg.j2
+++ b/roles/installer/debian/usb/templates/syslinux.cfg.j2
@@ -1,21 +1,24 @@
-SAY *****************************************
-SAY **
{% if (ansible_play_hosts_all | length) == 1 %}
DEFAULT {{ install_hostname }}
-SAY ** will be booting automated installer for {{ install_hostname }} in 10s ...
TIMEOUT 100
-{% else %}
-SAY ** Please select host to install:
+PROMPT 1
+SAY *****************************************
SAY **
-{% for host in ansible_play_hosts_all %}
-SAY ** -> {{ host }}
-{% endfor %}
-{% endif %}
+SAY ** Distro: {{ install_distro }}
+SAY ** Codename: {{ install_codename }}
SAY **
-PROMPT 1
+SAY ** will be booting automated installer for {{ install_hostname }} in 10s ...
+SAY **
+{% else %}
+DEFAULT menu.c32
+TIMEOUT 0
+PROMPT 0
+MENU TITLE {{ install_distro }} / {{ install_codename }}
+{% endif %}
{% for host in ansible_play_hosts_all %}
LABEL {{ host }}
+ MENU LABEL automatic installer for {{ host }}
KERNEL {{ syslinux_base_path }}linux
INITRD {{ syslinux_base_path }}initrd.{{ host }}.gz
APPEND install {{ (hostvars[host].install_cooked.kernel_cmdline | default([])) | join(' ') }}