diff --git a/scripts/patch_existing_vm_iso_mount.py b/scripts/patch_existing_vm_iso_mount.py index de0a185..e1f5701 100644 --- a/scripts/patch_existing_vm_iso_mount.py +++ b/scripts/patch_existing_vm_iso_mount.py @@ -192,20 +192,80 @@ boot_card = r'''

Порядок загрузки

- boot order + drag boot
-
- + + +
+
+ +
ISO / CD-ROMУстановщик или rescue-образ
+
+
+ +
ДискОсновной qcow2/raw диск VM
+
+
+ +
Сеть / PXEЗагрузка по сети
+
+
-

Чтобы загрузиться с ISO, выбери “Сначала ISO/CD-ROM, потом диск”. Если VM запущена, новый порядок сработает после перезапуска.

+

Перетащи нужный источник выше. Для загрузки с ISO поставь ISO / CD-ROM первым. Изменение сработает после перезапуска VM.

+
''' @@ -213,7 +273,6 @@ if template_path.exists(): tpl = template_path.read_text() original = tpl - # Normalize legacy separate cards into one two-column settings grid. legacy_boot = r'''
@@ -271,7 +330,13 @@ if template_path.exists(): ''' + iso_card + boot_card + r'''
''' - if 'vm-boot-iso-grid' not in tpl: + if 'vm-boot-iso-grid' in tpl: + start = tpl.find('
') + end = tpl.find('\n\n
', start + 1) + if start != -1 and end != -1: + tpl = tpl[:start] + settings_grid.strip('\n') + tpl[end:] + changed.append('boot order grid replaced with draggable version') + else: if legacy_boot in tpl or legacy_iso in tpl: tpl = tpl.replace(legacy_boot, '') tpl = tpl.replace(legacy_iso, '') @@ -279,13 +344,13 @@ if template_path.exists(): if marker not in tpl: raise SystemExit('vm detail grid marker not found') tpl = tpl.replace(marker, settings_grid + marker, 1) - changed.append('ISO and boot order cards moved into two-column grid') + changed.append('ISO and boot order cards moved into draggable two-column grid') elif 'action="/vm/{{ vm.name }}/iso/mount"' not in tpl: marker = '\n\n
' if marker not in tpl: raise SystemExit('vm detail grid marker not found') tpl = tpl.replace(marker, settings_grid + marker, 1) - changed.append('ISO and boot order two-column grid added') + changed.append('ISO and boot order draggable two-column grid added') if tpl != original: template_path.write_text(tpl)