Ejemplo n.º 1
0
    def __init__(self, stdscreen, options_file):
        self.screen = stdscreen

        # Init the colors
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
        curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_WHITE)
        curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_GREEN)
        curses.init_pair(4, curses.COLOR_RED, curses.COLOR_WHITE)

        self.screen.bkgd(' ', curses.color_pair(1))

        self.maxy, self.maxx = self.screen.getmaxyx()
        self.screen.addstr(self.maxy - 1, 0,
                           '  Arrow keys make selections; <Enter> activates.')
        curses.curs_set(0)
        config = IsoConfig()
        rpm_path, install_config = config.Configure(options_file, self.maxy,
                                                    self.maxx)

        self.screen.clear()
        installer = InstallerContainer(install_config,
                                       self.maxy,
                                       self.maxx,
                                       True,
                                       rpm_path=rpm_path,
                                       log_path="/var/log")

        installer.install(None)
Ejemplo n.º 2
0
    def __init__(self, stdscreen, options_file):
        self.screen = stdscreen

        # Init the colors
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
        curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_WHITE)
        curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_GREEN)
        curses.init_pair(4, curses.COLOR_RED, curses.COLOR_WHITE)

        self.screen.bkgd(' ', curses.color_pair(1))

        self.maxy, self.maxx = self.screen.getmaxyx()
        self.screen.addstr(self.maxy - 1, 0, '  Arrow keys make selections; <Enter> activates.')
        curses.curs_set(0)
        config = IsoConfig()
        rpm_path, install_config = config.Configure(options_file, self.maxy, self.maxx)

        self.screen.clear()
        installer = InstallerContainer(
            install_config,
            self.maxy, self.maxx,
            True,
            rpm_path=rpm_path,
            log_path="/var/log")

        installer.install(None)
Ejemplo n.º 3
0
    def ks_install(self, options_file, rpm_path, ks_config):
        install_config = ks_config
        install_config['iso_system'] = False
        if self.is_vmware_virtualization(
        ) and 'install_linux_esx' not in install_config:
            install_config['install_linux_esx'] = True

        json_wrapper_option_list = JsonWrapper(
            "build_install_options_all.json")
        option_list_json = json_wrapper_option_list.read()
        options_sorted = option_list_json.items()

        base_path = os.path.dirname("build_install_options_all.json")
        package_list = []

        package_list = PackageSelector.get_packages_to_install(
            options_sorted, install_config['type'], base_path)
        if 'additional_packages' in install_config:
            package_list.extend(install_config['additional_packages'])
        install_config['packages'] = package_list

        if 'partitions' in install_config:
            partitions = install_config['partitions']
        else:
            partitions = modules.commons.default_partitions

        install_config['disk'] = modules.commons.partition_disk(
            install_config['disk'], partitions)

        if "hostname" in install_config:
            evalhostname = os.popen(
                'printf ' + install_config["hostname"].strip(" ")).readlines()
            install_config['hostname'] = evalhostname[0]
        if "hostname" not in install_config or install_config['hostname'] == "":
            random_id = '%12x' % random.randrange(16**12)
            install_config['hostname'] = "photon-" + random_id.strip()

        # crypt the password if needed
        if install_config['password']['crypted']:
            install_config['password'] = install_config['password']['text']
        else:
            install_config['password'] = crypt.crypt(
                install_config['password']['text'], "$6$" + "".join([
                    random.choice(string.ascii_letters + string.digits)
                    for _ in range(16)
                ]))

        installer = InstallerContainer(install_config,
                                       self.maxy,
                                       self.maxx,
                                       True,
                                       rpm_path=rpm_path,
                                       log_path="/var/log")

        installer.install(None)
Ejemplo n.º 4
0
    def __init__(self, stdscreen, options_file):
        self.screen = stdscreen

        # Init the colors
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
        curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_WHITE)
        curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_GREEN)
        curses.init_pair(4, curses.COLOR_RED, curses.COLOR_WHITE)

        self.screen.bkgd(' ', curses.color_pair(1))

        self.maxy, self.maxx = self.screen.getmaxyx()
        self.screen.addstr(self.maxy - 1, 0, '  Arrow keys make selections; <Enter> activates.')
        curses.curs_set(0)

        self.cd_path = None

        kernel_params = subprocess.check_output(['cat', '/proc/cmdline'])

        # check the kickstart param
        ks_config = None
        m = re.match(r".*ks=(\S+)\s*.*\s*", kernel_params)
        if m != None:
            ks_config = self.get_config(m.group(1))

        # check for the repo param
        m = re.match(r".*repo=(\S+)\s*.*\s*", kernel_params)
        if m != None:
            rpm_path = m.group(1)
        else:
            # the rpms should be in the cd
            self.mount_RPMS_cd()
            rpm_path = os.path.join(self.cd_path, "RPMS")

        if not ks_config:
            self.ui_install(options_file, rpm_path)
        else:
            install_config = ks_config
            install_config['iso_system'] = False
            if self.is_vmware_virtualization() and 'install_linux_esx' not in install_config:
                install_config['install_linux_esx'] = True
            installer = InstallerContainer(
                install_config,
                self.maxy, self.maxx,
                True,
                rpm_path=rpm_path,
                log_path="/var/log",
                ks_config=ks_config)

            installer.install(None)