Пример #1
0
def disable(address):
    """disable a pxelinux configuration file by renaming the file"""
    file_name = os.path.join(cfg['paths']['tftpboot'], 'pxelinux.cfg', address)
    utils.file_move(file_name, file_name + '.disabled')
    if cfg['hooks_pxe']['disable']:
        for cmd in cfg['hooks_pxe']['disable']:
            utils.run(cmd)
Пример #2
0
def disable(address):
    """disable a pxelinux configuration file by renaming the file"""
    file_name = os.path.join(cfg['paths']['tftpboot'], 'pxelinux.cfg', address)
    utils.file_move(file_name, file_name + '.disabled')
    if cfg['hooks_pxe']['disable']:
        for cmd in cfg['hooks_pxe']['disable']:
            utils.run(cmd)
Пример #3
0
 def prepare(self, values):
     """ apply templates to all the .sb_template files and build the
     fix_perms.sh script from the permissions file"""
     values.update(self.cfg['pxe'])
     utils.rmtree(self.dst)
     utils.copy_tree(self.path, self.dst)
     for root, _, files in os.walk(self.dst):
         for file_name in files:
             if file_name.endswith('.sb_template'):
                 file_name = os.path.join(root, file_name)
                 utils.write_template(values, file_name)
                 utils.file_move(file_name, os.path.splitext(file_name)[0])
Пример #4
0
 def prepare(self, values):
     """ apply templates to all the .sb_template files and build the
     fix_perms.sh script from the permissions file"""
     values.update(self.cfg['pxe'])
     utils.rmtree(self.dst)
     utils.copy_tree(self.path, self.dst)
     for root, _, files in os.walk(self.dst):
         for file_name in files:
             if file_name.endswith('.sb_template'):
                 file_name = os.path.join(root, file_name)
                 utils.write_template(values, file_name)
                 utils.file_move(file_name, os.path.splitext(file_name)[0])
Пример #5
0
 def _add_firmware(self, name, dst):
     """download, extract and copy Debian non free firmware"""
     distribution, release, _ = name.split('-')
     path = '-'.join(('firmware', distribution, release))
     archive_dst = os.path.join(self.cfg['paths']['archives'], path)
     temp_firmware = os.path.join(self.temp, 'firmware')
     archive = os.path.join(archive_dst, 'firmware.tar.gz')
     url = self.cfg[distribution]['url_firmware'].replace('${release}',
         release)
     self._download(url, archive_dst)
     utils.untar(archive, temp_firmware)
     self._extract_debs(temp_firmware)
     src = os.path.join(temp_firmware, 'temp', 'lib/firmware')
     utils.file_move(src, dst)
     utils.rmtree(temp_firmware)
Пример #6
0
 def _add_firmware(self, name, dst):
     """download, extract and copy Debian non free firmware"""
     distribution, release, _ = name.split('-')
     path = '-'.join(('firmware', distribution, release))
     archive_dst = os.path.join(self.cfg['paths']['archives'], path)
     temp_firmware = os.path.join(self.temp, 'firmware')
     archive = os.path.join(archive_dst, 'firmware.tar.gz')
     url = self.cfg[distribution]['url_firmware'].replace(
         '${release}', release)
     self._download(url, archive_dst)
     utils.untar(archive, temp_firmware)
     self._extract_debs(temp_firmware)
     src = os.path.join(temp_firmware, 'temp', 'lib/firmware')
     utils.file_move(src, dst)
     utils.rmtree(temp_firmware)
Пример #7
0
 def _debian_firmware(self, target):
     """download and integrate the debian non free firmware"""
     distribution, release, _ = target.split('-')
     path = 'firmware-' + distribution + '-' + release
     dst = os.path.join(self.cfg['paths']['archives'], path)
     temp_initrd = os.path.join(self.temp, 'initrd')
     temp_firmware = os.path.join(self.temp, 'firmware')
     firmware = os.path.join(dst, 'firmware.tar.gz')
     initrd = os.path.join(self.cfg['paths']['tftpboot'], 'seedbank', target,
         'initrd.gz')
     url = self.cfg['urls']['debian_firmware'].replace('${release}', release)
     self._download(url, dst)
     utils.untar(firmware, temp_firmware)
     self._extract_debs(temp_firmware)
     utils.make_dirs(temp_initrd)
     utils.initrd_extract(temp_initrd, initrd)
     src = os.path.join(temp_firmware, 'temp', 'lib/firmware')
     dst = os.path.join(self.temp, 'initrd/lib/firmware')
     utils.file_move(src, dst)
     self._disable_usb(temp_initrd)
     utils.initrd_create(temp_initrd, initrd)