a672bd24 |
#! /usr/bin/python3 |
f4d17450 |
#
# Copyright (C) 2015 vmware inc.
#
# Author: Mahmoud Bassiouny <mbassiouny@vmware.com>
|
0f3948ba |
from argparse import ArgumentParser |
f4d17450 |
import curses |
4d53ba03 |
from installercontainer import InstallerContainer |
a672bd24 |
from iso_config import IsoConfig |
f4d17450 |
class IsoInstaller(object): |
5d05cfcc |
def __init__(self, stdscreen, options_file): |
f4d17450 |
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))
|
130228a5 |
self.maxy, self.maxx = self.screen.getmaxyx() |
5f854778 |
self.screen.addstr(self.maxy - 1, 0, ' Arrow keys make selections; <Enter> activates.') |
f4d17450 |
curses.curs_set(0) |
a672bd24 |
config = IsoConfig()
rpm_path, install_config = config.Configure(options_file, self.maxy, self.maxx) |
f4d17450 |
|
a672bd24 |
self.screen.clear()
installer = InstallerContainer(
install_config,
self.maxy, self.maxx,
True,
rpm_path=rpm_path,
log_path="/var/log") |
f4d17450 |
|
a672bd24 |
installer.install(None) |
f4d17450 |
if __name__ == '__main__': |
5d05cfcc |
usage = "Usage: %prog [options]" |
0f3948ba |
parser = ArgumentParser(usage) |
130228a5 |
parser.add_argument("-j", "--json-file", dest="options_file", default="input.json") |
0f3948ba |
options = parser.parse_args() |
5d05cfcc |
curses.wrapper(IsoInstaller, options.options_file) |