def install_packages_for_extra_modules(self, modules):
     """Install the packages required to handle these modules."""
     #cmd = self.chroot_precommand + self.aptinstall
     packages = []
     for module in modules:
         if module == 'dm-mod':
             append_unique('lvm2', packages)
             append_unique('dmsetup', packages)
         if module.startswith('raid'):
             append_unique('mdadm', packages)
     #cmd += packages
     if packages:
         msg = "Installing these extra packages: %s" % ', '.join(packages)
         self.log.info(msg)
         apt_command = install_packages_command(
             packages,
             self.defenv,
             loginfo=self.log.info,
             logerror=self.log.error,
             usertag='paella-kernel-extras')
         cmd = self.chroot_precommand + apt_command
         runlog(cmd)
     else:
         msg = 'No extra packages required for the kernel'
         self.log.info(msg)
Beispiel #2
0
 def install_grub_package(self, grub="grub"):
     # cmd = self.chroot_precommand + self.aptinstall + [grub]
     apt_command = install_packages_command(
         [grub], self.defenv, loginfo=self.log.info, logerror=self.log.error, usertag="paella-bootloader"
     )
     cmd = self.chroot_precommand + apt_command
     runlog(cmd)
Beispiel #3
0
 def install_packages(self, packages, unauthenticated=False):
     if packages:
         command = install_packages_command(
             packages, self.defenv, action="install", loginfo=self.log.info, trait=self.trait
         )
         self.chroot(command)
     else:
         self.log.info("No packages to install")
 def install_grub_package(self, grub='grub'):
     #cmd = self.chroot_precommand + self.aptinstall + [grub]
     apt_command = install_packages_command([grub],
                                            self.defenv,
                                            loginfo=self.log.info,
                                            logerror=self.log.error,
                                            usertag='paella-bootloader')
     cmd = self.chroot_precommand + apt_command
     runlog(cmd)
Beispiel #5
0
 def install_packages(self, packages, unauthenticated=False):
     if packages:
         command = install_packages_command(packages,
                                            self.defenv,
                                            action='install',
                                            loginfo=self.log.info,
                                            trait=self.trait)
         self.chroot(command)
     else:
         self.log.info('No packages to install')
 def install_kernel_package(self):
     self.log.info('called install_kernel_package')
     extra_modules = self.determine_extra_modules_from_diskconfig()
     if extra_modules:
         self.log.info(
             'Checking if extra packages are required before kernel install.'
         )
         self.install_packages_for_extra_modules(extra_modules)
     else:
         msg = "There doesn't seem to be a need for extra modules on this machine."
         self.log.info(msg)
     kernel = self.machine.get_kernel()
     if kernel == 'default':
         self.log.info("Using default kernel")
         kernel = self._determine_default_kernel()
         self.log.info("Default kernel for this machine is %s" % kernel)
     #cmd = self.chroot_precommand + self.aptinstall + [kernel]
     apt_command = install_packages_command([kernel],
                                            self.defenv,
                                            loginfo=self.log.info,
                                            logerror=self.log.error,
                                            usertag='paella-kernel')
     cmd = self.chroot_precommand + apt_command
     self.log.info('install cmd is: %s' % ' '.join(cmd))
     kimgconf = self.target / 'etc' / 'kernel-img.conf'
     kimgconf_old = path('%s.paella-orig' % kimgconf)
     kimgconflines = [
         'do_bootloader = No', 'do_initrd = Yes', 'warn_initrd = No'
     ]
     if kimgconf.exists():
         self.log.info('/etc/kernel-img.conf already exists')
         k = '/etc/kernel-img.conf'
         msg = 'renaming %s to %s.paella-orig' % (k, k)
         self.log.info(msg)
         if kimgconf_old.exists():
             msg = '%s already exists, aborting install.' % kimgconf_old
             self.log.error(msg)
             raise RuntimeError, msg
         os.rename(kimgconf, kimgconf_old)
     kimgconf.write_lines(kimgconflines)
     runlog(cmd)
     self.log.info('Kernel installation is complete.')
     if kimgconf_old.exists():
         self.log.info('Restoring /etc/kernel-img.conf')
         os.remove(kimgconf)
         os.rename(kimgconf_old, kimgconf)
 def install_kernel_package(self):
     self.log.info('called install_kernel_package')
     extra_modules = self.determine_extra_modules_from_diskconfig()
     if extra_modules:
         self.log.info('Checking if extra packages are required before kernel install.')
         self.install_packages_for_extra_modules(extra_modules)
     else:
         msg = "There doesn't seem to be a need for extra modules on this machine."
         self.log.info(msg)
     kernel = self.machine.get_kernel()
     if kernel == 'default':
         self.log.info("Using default kernel")
         kernel = self._determine_default_kernel()
         self.log.info("Default kernel for this machine is %s" % kernel)
     #cmd = self.chroot_precommand + self.aptinstall + [kernel]
     apt_command = install_packages_command([kernel], self.defenv,
                                            loginfo=self.log.info, logerror=self.log.error,
                                            usertag='paella-kernel')
     cmd = self.chroot_precommand + apt_command
     self.log.info('install cmd is: %s' % ' '.join(cmd))
     kimgconf = self.target / 'etc' / 'kernel-img.conf'
     kimgconf_old = path('%s.paella-orig' % kimgconf)
     kimgconflines = ['do_bootloader = No',
                      'do_initrd = Yes',
                      'warn_initrd = No'
                      ]
     if kimgconf.exists():
         self.log.info('/etc/kernel-img.conf already exists')
         k = '/etc/kernel-img.conf'
         msg ='renaming %s to %s.paella-orig' % (k, k)
         self.log.info(msg)
         if kimgconf_old.exists():
             msg = '%s already exists, aborting install.' % kimgconf_old
             self.log.error(msg)
             raise RuntimeError , msg
         os.rename(kimgconf, kimgconf_old)
     kimgconf.write_lines(kimgconflines)
     runlog(cmd)
     self.log.info('Kernel installation is complete.')
     if kimgconf_old.exists():
         self.log.info('Restoring /etc/kernel-img.conf')
         os.remove(kimgconf)
         os.rename(kimgconf_old, kimgconf)
Beispiel #8
0
 def install_kernel_package(self):
     self.log.info("called install_kernel_package")
     extra_modules = self.determine_extra_modules_from_diskconfig()
     if extra_modules:
         self.log.info("Checking if extra packages are required before kernel install.")
         self.install_packages_for_extra_modules(extra_modules)
     else:
         msg = "There doesn't seem to be a need for extra modules on this machine."
         self.log.info(msg)
     kernel = self.machine.get_kernel()
     if kernel == "default":
         self.log.info("Using default kernel")
         kernel = self._determine_default_kernel()
         self.log.info("Default kernel for this machine is %s" % kernel)
     # cmd = self.chroot_precommand + self.aptinstall + [kernel]
     apt_command = install_packages_command(
         [kernel], self.defenv, loginfo=self.log.info, logerror=self.log.error, usertag="paella-kernel"
     )
     cmd = self.chroot_precommand + apt_command
     self.log.info("install cmd is: %s" % " ".join(cmd))
     kimgconf = self.target / "etc" / "kernel-img.conf"
     kimgconf_old = path("%s.paella-orig" % kimgconf)
     kimgconflines = ["do_bootloader = No", "do_initrd = Yes", "warn_initrd = No"]
     if kimgconf.exists():
         self.log.info("/etc/kernel-img.conf already exists")
         k = "/etc/kernel-img.conf"
         msg = "renaming %s to %s.paella-orig" % (k, k)
         self.log.info(msg)
         if kimgconf_old.exists():
             msg = "%s already exists, aborting install." % kimgconf_old
             self.log.error(msg)
             raise RuntimeError, msg
         os.rename(kimgconf, kimgconf_old)
     kimgconf.write_lines(kimgconflines)
     runlog(cmd)
     self.log.info("Kernel installation is complete.")
     if kimgconf_old.exists():
         self.log.info("Restoring /etc/kernel-img.conf")
         os.remove(kimgconf)
         os.rename(kimgconf_old, kimgconf)
Beispiel #9
0
 def install_packages_for_extra_modules(self, modules):
     """Install the packages required to handle these modules."""
     # cmd = self.chroot_precommand + self.aptinstall
     packages = []
     for module in modules:
         if module == "dm-mod":
             append_unique("lvm2", packages)
             append_unique("dmsetup", packages)
         if module.startswith("raid"):
             append_unique("mdadm", packages)
     # cmd += packages
     if packages:
         msg = "Installing these extra packages: %s" % ", ".join(packages)
         self.log.info(msg)
         apt_command = install_packages_command(
             packages, self.defenv, loginfo=self.log.info, logerror=self.log.error, usertag="paella-kernel-extras"
         )
         cmd = self.chroot_precommand + apt_command
         runlog(cmd)
     else:
         msg = "No extra packages required for the kernel"
         self.log.info(msg)
 def install_packages_for_extra_modules(self, modules):
     """Install the packages required to handle these modules."""
     #cmd = self.chroot_precommand + self.aptinstall
     packages = []
     for module in modules:
         if module == 'dm-mod':
             append_unique('lvm2', packages)
             append_unique('dmsetup', packages)
         if module.startswith('raid'):
             append_unique('mdadm', packages)
     #cmd += packages
     if packages:
         msg = "Installing these extra packages: %s" % ', '.join(packages)
         self.log.info(msg)
         apt_command = install_packages_command(packages, self.defenv,
                                                loginfo=self.log.info, logerror=self.log.error,
                                                usertag='paella-kernel-extras')
         cmd = self.chroot_precommand + apt_command
         runlog(cmd)
     else:
         msg = 'No extra packages required for the kernel'
         self.log.info(msg)