예제 #1
0
def bootstrapGen(step, config):
    """
    Bootstrap the system on a drive
    """
    return concat(["\n#bootstrapping system"],
                  swb.installSoftware(
                      sw.software(config["BOOTSTRAP"],
                                  packages=config["BOOTSTRAP_PACKAGES"])))
예제 #2
0
def packageGen(step, config):
    if step.model.file != None:
        return concat(["\n# Installing software"],
                      swb.installSoftware(
                          swg.BuildSoftwareFromFile(step.model.file,
                                                    step.model.install)))
    return concat(["\n# Installing software"],
                  swb.installSoftware(
                      sw.software(step.model.install, step.model.packages)))
예제 #3
0
def BuildSoftwareFromFile(filename, installer=config.INSTALLCOMMAND):
    """
    Build a software object from a file containing packages
    @file = a file containing packages (every line is a package)
    @installer = the base install command to install software
    """
    sw = software(installer=installer)
    with open(filename) as f:
        lines = f.read().splitlines()
    sw.packages = lines
    return sw
예제 #4
0
 def setup(self, config):
     commands = [
         "timedatectl set-ntp true",
         "hwclock --systohc",
         "sed -i 's:^#.*{}:{}:' /etc/locale.gen".format(
             self.locale, self.locale),
         "locale-gen",
         "echo 'LANG={}' > /etc/locale.conf".format(self.locale),
         "echo KEYMAP='{}' > /etc/vconsole.conf".format(self.keymap),
         "echo '{}' > /etc/hostname".format(self.hostname),
         "echo -e '127.0.0.1   localhost\n::1      localhost\n127.0.1.1    {}.localdomain  {}' > /etc/hosts"
         .format(self.hostname, self.hostname),
         "echo 'root:{}' | chpasswd".format(self.password_root),
         "echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers",
     ]
     # installing kernel
     commands = concat(
         commands,
         swb.installSoftware(
             sw.software(config["INSTALLCOMMAND"],
                         packages=config["KERNEL"])))
     return commands
예제 #5
0
 def installGit(self):
     """
     Install git if it doesn't exist yes
     """
     software = sw.software(packages=[config.GITPACKAGE])
     return builder.installSoftware(software)