def _configure_efi_bootloader(self, isodir): """Set up the configuration for an EFI bootloader""" fs_related.makedirs(isodir + "/EFI/boot") if not self.__copy_efi_files(isodir): shutil.rmtree(isodir + "/EFI") return for f in os.listdir(isodir + "/isolinux"): os.link("%s/isolinux/%s" %(isodir, f), "%s/EFI/boot/%s" %(isodir, f)) cfg = self.__get_basic_efi_config(name = self.name, timeout = self._timeout) cfg += self.__get_efi_image_stanzas(isodir, self.name) cfgf = open(isodir + "/EFI/boot/grub.conf", "w") cfgf.write(cfg) cfgf.close() # first gen mactel machines get the bootloader name wrong apparently if rpmmisc.getBaseArch() == "i386": os.link(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot.efi") os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot.conf") # for most things, we want them named boot$efiarch efiarch = {"i386": "ia32", "x86_64": "x64"} efiname = efiarch[rpmmisc.getBaseArch()] os.rename(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot%s.efi" %(efiname,)) os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot%s.conf" %(efiname,))
def _configure_efi_bootloader(self, isodir): """Set up the configuration for an EFI bootloader""" fs_related.makedirs(isodir + "/EFI/boot") if not self.__copy_efi_files(isodir): shutil.rmtree(isodir + "/EFI") return for f in os.listdir(isodir + "/isolinux"): os.link("%s/isolinux/%s" % (isodir, f), "%s/EFI/boot/%s" % (isodir, f)) cfg = self.__get_basic_efi_config(name=self.name, timeout=self._timeout) cfg += self.__get_efi_image_stanzas(isodir, self.name) cfgf = open(isodir + "/EFI/boot/grub.conf", "w") cfgf.write(cfg) cfgf.close() # first gen mactel machines get the bootloader name wrong apparently if rpmmisc.getBaseArch() == "i386": os.link(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot.efi") os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot.conf") # for most things, we want them named boot$efiarch efiarch = {"i386": "ia32", "x86_64": "x64"} efiname = efiarch[rpmmisc.getBaseArch()] os.rename(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot%s.efi" % (efiname, )) os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot%s.conf" % (efiname, ))
cfgf.write(cfg) cfgf.close() # first gen mactel machines get the bootloader name wrong apparently if rpmmisc.getBaseArch() == "i386": os.link(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot.efi") os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot.conf") # for most things, we want them named boot$efiarch efiarch = {"i386": "ia32", "x86_64": "x64"} efiname = efiarch[rpmmisc.getBaseArch()] os.rename(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot%s.efi" %(efiname,)) os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot%s.conf" %(efiname,)) def _configure_bootloader(self, isodir): self._configure_syslinux_bootloader(isodir) self._configure_efi_bootloader(isodir) arch = rpmmisc.getBaseArch() if arch in ("i386", "x86_64"): LiveCDImageCreator = x86LiveImageCreator elif arch.startswith("arm"): LiveCDImageCreator = LiveImageCreatorBase else: raise CreatorError("Architecture not supported!")
cfgf.write(cfg) cfgf.close() # first gen mactel machines get the bootloader name wrong apparently if rpmmisc.getBaseArch() == "i386": os.link(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot.efi") os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot.conf") # for most things, we want them named boot$efiarch efiarch = {"i386": "ia32", "x86_64": "x64"} efiname = efiarch[rpmmisc.getBaseArch()] os.rename(isodir + "/EFI/boot/grub.efi", isodir + "/EFI/boot/boot%s.efi" % (efiname, )) os.link(isodir + "/EFI/boot/grub.conf", isodir + "/EFI/boot/boot%s.conf" % (efiname, )) def _configure_bootloader(self, isodir): self._configure_syslinux_bootloader(isodir) self._configure_efi_bootloader(isodir) arch = rpmmisc.getBaseArch() if arch in ("i386", "x86_64"): LiveCDImageCreator = x86LiveImageCreator elif arch.startswith("arm"): LiveCDImageCreator = LiveImageCreatorBase else: raise CreatorError("Architecture not supported!")
def efiarch(self): if not self._efiarch: # for most things, we want them named boot$efiarch efiarch = {"i386": "IA32", "x86_64": "X64"} self._efiarch = efiarch[rpmmisc.getBaseArch()] return self._efiarch