|
|
@ -249,6 +249,9 @@ class Install(MethodsInterface):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
# получить загрузочный раздел (если есть /boot, то
|
|
|
|
# получить загрузочный раздел (если есть /boot, то
|
|
|
|
# он является загрузочным иначе корень)
|
|
|
|
# он является загрузочным иначе корень)
|
|
|
|
|
|
|
|
chroot_cmd = getProgPath('/usr/bin/chroot')
|
|
|
|
|
|
|
|
chroot_dn = target.getDirectory()
|
|
|
|
|
|
|
|
|
|
|
|
for boot_path in ("/boot", "/"):
|
|
|
|
for boot_path in ("/boot", "/"):
|
|
|
|
boot_disk = self.clVars.Select("os_install_disk_dev",
|
|
|
|
boot_disk = self.clVars.Select("os_install_disk_dev",
|
|
|
|
where="os_install_disk_mount",
|
|
|
|
where="os_install_disk_mount",
|
|
|
@ -266,16 +269,25 @@ class Install(MethodsInterface):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
platform = []
|
|
|
|
platform = []
|
|
|
|
# прописать GRUB2 на все указанные диски
|
|
|
|
# прописать GRUB2 на все указанные диски
|
|
|
|
|
|
|
|
targetdir = target.convertToDirectory()
|
|
|
|
|
|
|
|
if not targetdir.hasSystemDirectories():
|
|
|
|
|
|
|
|
targetdir.mountSystemDirectories()
|
|
|
|
|
|
|
|
try:
|
|
|
|
for mbr_disk in self.clVars.Get('os_install_mbr'):
|
|
|
|
for mbr_disk in self.clVars.Get('os_install_mbr'):
|
|
|
|
grub_process = process(cmd_grub_install,
|
|
|
|
grub_process = process(
|
|
|
|
"--boot-directory=%s" % pathJoin(
|
|
|
|
chroot_cmd,
|
|
|
|
prefix_boot,
|
|
|
|
chroot_dn,
|
|
|
|
target.getBootDirectory()),
|
|
|
|
cmd_grub_install,
|
|
|
|
|
|
|
|
"--boot-directory=/%s" % path.relpath(target.getBootDirectory(),
|
|
|
|
|
|
|
|
chroot_dn),
|
|
|
|
mbr_disk, "--force", *platform,
|
|
|
|
mbr_disk, "--force", *platform,
|
|
|
|
stderr=STDOUT, envdict=os.environ)
|
|
|
|
stderr=STDOUT, envdict=os.environ)
|
|
|
|
if grub_process.failed():
|
|
|
|
if grub_process.failed():
|
|
|
|
raise DistributiveError(
|
|
|
|
raise DistributiveError(
|
|
|
|
_("Failed to install the bootloader"))
|
|
|
|
_("Failed to install the bootloader"))
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
|
|
|
if targetdir.system_mounted:
|
|
|
|
|
|
|
|
targetdir.umountSystemDirectories()
|
|
|
|
|
|
|
|
|
|
|
|
def update_efi_fstab(self):
|
|
|
|
def update_efi_fstab(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -384,14 +396,14 @@ class Install(MethodsInterface):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Установить grub с UEFI загрузчиком
|
|
|
|
Установить grub с UEFI загрузчиком
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
efifulldir = pathJoin(target.getDirectory(), efidir)
|
|
|
|
chroot_cmd = getProgPath('/usr/bin/chroot')
|
|
|
|
|
|
|
|
chroot_dn = target.getDirectory()
|
|
|
|
grub_params = [
|
|
|
|
grub_params = [
|
|
|
|
"--boot-directory=%s" % pathJoin(
|
|
|
|
"--boot-directory=/%s" % path.relpath(target.getBootDirectory(),
|
|
|
|
prefix_boot,
|
|
|
|
chroot_dn),
|
|
|
|
target.getBootDirectory()),
|
|
|
|
|
|
|
|
"--bootloader-id=%s" % efiname,
|
|
|
|
"--bootloader-id=%s" % efiname,
|
|
|
|
"--target=x86_64-efi",
|
|
|
|
"--target=x86_64-efi",
|
|
|
|
"--efi-directory=%s" % efifulldir,
|
|
|
|
"--efi-directory=%s" % efidir,
|
|
|
|
"--force"]
|
|
|
|
"--force"]
|
|
|
|
# проверяем наличие в nv-ram нужной нам записи для исключения повтора
|
|
|
|
# проверяем наличие в nv-ram нужной нам записи для исключения повтора
|
|
|
|
efi_boot_mgr = getProgPath('/usr/sbin/efibootmgr')
|
|
|
|
efi_boot_mgr = getProgPath('/usr/sbin/efibootmgr')
|
|
|
@ -414,11 +426,21 @@ class Install(MethodsInterface):
|
|
|
|
# в efivars
|
|
|
|
# в efivars
|
|
|
|
if self.clVars.Get('os_install_root_type') == 'usb-hdd':
|
|
|
|
if self.clVars.Get('os_install_root_type') == 'usb-hdd':
|
|
|
|
grub_params.append("--removable")
|
|
|
|
grub_params.append("--removable")
|
|
|
|
grub_process = process(cmd_grub_install,
|
|
|
|
targetdir = target.convertToDirectory()
|
|
|
|
|
|
|
|
if not targetdir.hasSystemDirectories():
|
|
|
|
|
|
|
|
targetdir.mountSystemDirectories()
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
grub_process = process(
|
|
|
|
|
|
|
|
chroot_cmd,
|
|
|
|
|
|
|
|
chroot_dn,
|
|
|
|
|
|
|
|
cmd_grub_install,
|
|
|
|
*grub_params, stderr=STDOUT,
|
|
|
|
*grub_params, stderr=STDOUT,
|
|
|
|
envdict=os.environ)
|
|
|
|
envdict=os.environ)
|
|
|
|
if grub_process.failed():
|
|
|
|
if grub_process.failed():
|
|
|
|
raise DistributiveError(_("Failed to install the bootloader"))
|
|
|
|
raise DistributiveError(_("Failed to install the bootloader"))
|
|
|
|
|
|
|
|
finally:
|
|
|
|
|
|
|
|
if targetdir.system_mounted:
|
|
|
|
|
|
|
|
targetdir.umountSystemDirectories()
|
|
|
|
# проверяем успешность создания загрузочной записи
|
|
|
|
# проверяем успешность создания загрузочной записи
|
|
|
|
# если среди загрузочных записей отсутствует запись
|
|
|
|
# если среди загрузочных записей отсутствует запись
|
|
|
|
# calculate и dmesg содержит сообщение об ошибке efivars -
|
|
|
|
# calculate и dmesg содержит сообщение об ошибке efivars -
|
|
|
|