def makedev(target, devices=['generic']): here = os.getcwd() os.chdir(join(target, 'dev')) for dev in devices: echo('making device %s with MAKEDEV' % dev) runlog('./MAKEDEV %s' % dev) os.chdir(here)
def extract_basebootstrap(self): echo('extracting premade base tarball') suite_path = self.defenv.get('installer', 'suite_storage') basefile = join(suite_path, '%s.tar' % self.installer.suite) runvalue = extract_tarball(self.target, basefile) if runvalue: raise InstallError, 'problems extracting %s to %s' % (basefile, self.target)
def extract_tarball(target, tarball): opts = '-xf' if tarball[-7:] == '.tar.gz' or tarball[-4:] == '.tgz': opts = '-xzf' elif tarball[-8:] == '.tar.bz2': opts = '-xjf' cmd = 'tar -C %s %s %s' % (target, opts, tarball) echo('extracting tarball with command %s' % cmd) return runlog(cmd)
def extract_tarball(target, tarball): opts = "-xf" if tarball[-7:] == ".tar.gz" or tarball[-4:] == ".tgz": opts = "-xzf" elif tarball[-8:] == ".tar.bz2": opts = "-xjf" cmd = "tar -C %s %s %s" % (target, opts, tarball) echo("extracting tarball with command %s" % cmd) return runlog(cmd)
def make_filesystem(device, fstype): if fstype == 'reiserfs': cmd = 'mkreiserfs -f -q %s' % device elif fstype == 'ext3': cmd = 'mkfs.ext3 -F -q %s' % device elif fstype == 'ext2': cmd = 'mkfs.ext2 -F -q %s' % device else: raise RuntimeError, 'unhandled fstype %s ' % fstype echo(cmd) return runlog(cmd)
def make_filesystem(device, fstype): if fstype == 'reiserfs': cmd = 'mkreiserfs -f -q %s' % device elif fstype == 'ext3': cmd = 'mkfs.ext3 -F -q %s' % device elif fstype == 'ext2': cmd = 'mkfs.ext2 -F -q %s' % device else: raise Error, 'unhandled fstype %s ' % fstype echo(cmd) runlog(cmd, keeprunning=True)
def make_filesystems(device, fsmounts, env): mddev = False if device == '/dev/md': mdnum = 0 mddev = True for row in fsmounts: if mddev: pdev = '/dev/md%d' % mdnum mdnum += 1 else: pdev = device + str(row.partition) if row.mnt_name in env.keys(): echo('%s held' % row.mnt_name) elif row.fstype == 'swap': runlog('echo making swap on %s' % pdev) runvalue = runlog('mkswap %s' % pdev) if runvalue: raise RuntimeError, 'problem making swap on %s' % pdev else: echo('making filesystem for %s' % row.mnt_name) make_filesystem(pdev, row.fstype)
def umount_target_proc(self): "this is a default process" echo('unmounting target /proc') mount_target_proc(self.target, umount=True)
def install_kernel(self): "this is a default process" kernel = self.machine.current.kernel echo('installing kernel %s' % kernel) install_kernel(kernel, self.target)
def mount_target_proc(self): "this is a default process" echo('mounting target /proc') mount_target_proc(self.target)