mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
extlinux is now running on jessie
This commit is contained in:
parent
f6e4903a8e
commit
6b6b636f3b
4 changed files with 77 additions and 5 deletions
1
bootstrapvz/common/assets/extlinux/boot.txt
Normal file
1
bootstrapvz/common/assets/extlinux/boot.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Wait 5 seconds or press ENTER to
|
17
bootstrapvz/common/assets/extlinux/extlinux.conf
Normal file
17
bootstrapvz/common/assets/extlinux/extlinux.conf
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
default l0
|
||||||
|
prompt 1
|
||||||
|
timeout 50
|
||||||
|
|
||||||
|
|
||||||
|
label l0
|
||||||
|
menu label Debian GNU/Linux, kernel {kernel_version}
|
||||||
|
linux /boot/vmlinuz-{kernel_version}
|
||||||
|
append initrd=/boot/initrd.img-{kernel_version} root=UUID={UUID} ro quiet console=ttyS0
|
||||||
|
|
||||||
|
label l0r
|
||||||
|
menu label Debian GNU/Linux, kernel {kernel_version} (recovery mode)
|
||||||
|
linux /boot/vmlinuz-{kernel_version}
|
||||||
|
append initrd=/boot/initrd.img-{kernel_version} root=UUID={UUID} ro console=ttyS0 single
|
||||||
|
text help
|
||||||
|
This option boots the system into recovery mode (single-user)
|
||||||
|
endtext
|
|
@ -134,19 +134,23 @@ locale_group = [locale.LocaleBootstrapPackage,
|
||||||
|
|
||||||
|
|
||||||
def get_bootloader_group(manifest):
|
def get_bootloader_group(manifest):
|
||||||
|
from bootstrapvz.common.tools import get_codename
|
||||||
group = []
|
group = []
|
||||||
if manifest.system['bootloader'] == 'grub':
|
if manifest.system['bootloader'] == 'grub':
|
||||||
group.extend([grub.AddGrubPackage,
|
group.extend([grub.AddGrubPackage,
|
||||||
grub.ConfigureGrub])
|
grub.ConfigureGrub])
|
||||||
from bootstrapvz.common.tools import get_codename
|
|
||||||
if get_codename(manifest.system['release']) in ['squeeze', 'wheezy']:
|
if get_codename(manifest.system['release']) in ['squeeze', 'wheezy']:
|
||||||
group.append(grub.InstallGrub_1_99)
|
group.append(grub.InstallGrub_1_99)
|
||||||
else:
|
else:
|
||||||
group.append(grub.InstallGrub_2)
|
group.append(grub.InstallGrub_2)
|
||||||
if manifest.system['bootloader'] == 'extlinux':
|
if manifest.system['bootloader'] == 'extlinux':
|
||||||
group.extend([extlinux.AddExtlinuxPackage,
|
group.append(extlinux.AddExtlinuxPackage)
|
||||||
extlinux.ConfigureExtlinux,
|
if get_codename(manifest.system['release']) in ['squeeze', 'wheezy']:
|
||||||
extlinux.InstallExtlinux])
|
group.extend([extlinux.ConfigureExtlinux,
|
||||||
|
extlinux.InstallExtlinux])
|
||||||
|
else:
|
||||||
|
group.extend([extlinux.ConfigureExtlinuxJessie,
|
||||||
|
extlinux.InstallExtlinuxJessie])
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@ from .. import phases
|
||||||
from ..tools import log_check_call
|
from ..tools import log_check_call
|
||||||
import apt
|
import apt
|
||||||
import filesystem
|
import filesystem
|
||||||
|
import kernel
|
||||||
from bootstrapvz.base.fs import partitionmaps
|
from bootstrapvz.base.fs import partitionmaps
|
||||||
import os.path
|
import os
|
||||||
|
|
||||||
|
|
||||||
class AddExtlinuxPackage(Task):
|
class AddExtlinuxPackage(Task):
|
||||||
|
@ -56,3 +57,52 @@ class InstallExtlinux(Task):
|
||||||
'--install', '/boot/extlinux'])
|
'--install', '/boot/extlinux'])
|
||||||
log_check_call(['chroot', info.root,
|
log_check_call(['chroot', info.root,
|
||||||
'extlinux-update'])
|
'extlinux-update'])
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigureExtlinuxJessie(Task):
|
||||||
|
description = 'Configuring extlinux'
|
||||||
|
phase = phases.system_modification
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def run(cls, info):
|
||||||
|
extlinux_path = os.path.join(info.root, 'boot/extlinux')
|
||||||
|
os.mkdir(extlinux_path)
|
||||||
|
|
||||||
|
from . import assets
|
||||||
|
extlinux_assets_path = os.path.join(assets, 'extlinux')
|
||||||
|
extlinux_tpl_path = os.path.join(extlinux_assets_path, 'extlinux.conf')
|
||||||
|
with open(extlinux_tpl_path) as extlinux_tpl:
|
||||||
|
extlinux_config = extlinux_tpl.read()
|
||||||
|
|
||||||
|
root_uuid = info.volume.partition_map.root.get_uuid()
|
||||||
|
extlinux_config = extlinux_config.format(kernel_version=info.kernel_version, UUID=root_uuid)
|
||||||
|
extlinux_config_path = os.path.join(extlinux_path, 'extlinux.conf')
|
||||||
|
with open(extlinux_config_path, 'w') as extlinux_conf_handle:
|
||||||
|
extlinux_conf_handle.write(extlinux_config)
|
||||||
|
from shutil import copy
|
||||||
|
# Copy the boot message
|
||||||
|
boot_txt_path = os.path.join(extlinux_assets_path, 'boot.txt')
|
||||||
|
copy(boot_txt_path, os.path.join(extlinux_path, 'boot.txt'))
|
||||||
|
|
||||||
|
|
||||||
|
class InstallExtlinuxJessie(Task):
|
||||||
|
description = 'Installing extlinux'
|
||||||
|
phase = phases.system_modification
|
||||||
|
predecessors = [filesystem.FStab, ConfigureExtlinuxJessie]
|
||||||
|
# Make sure the kernel image is updated after we have installed the bootloader
|
||||||
|
successors = [kernel.UpdateInitramfs]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def run(cls, info):
|
||||||
|
if isinstance(info.volume.partition_map, partitionmaps.gpt.GPTPartitionMap):
|
||||||
|
# Yeah, somebody saw it fit to uppercase that folder in jessie. Why? BECAUSE
|
||||||
|
bootloader = '/usr/lib/EXTLINUX/gptmbr.bin'
|
||||||
|
else:
|
||||||
|
bootloader = '/usr/lib/EXTLINUX/mbr.bin'
|
||||||
|
log_check_call(['chroot', info.root,
|
||||||
|
'dd', 'bs=440', 'count=1',
|
||||||
|
'if=' + bootloader,
|
||||||
|
'of=' + info.volume.device_path])
|
||||||
|
log_check_call(['chroot', info.root,
|
||||||
|
'extlinux',
|
||||||
|
'--install', '/boot/extlinux'])
|
||||||
|
|
Loading…
Add table
Reference in a new issue