Ejemplo n.º 1
0
def runInstaller(options, install_config, working_directory):
    try:
        sys.path.insert(0, options.installer_path)
        from installer import Installer
    except:
        raise ImportError('Installer path incorrect!')

    # Run the installer
    installer = Installer(working_directory=working_directory, rpm_path=options.rpm_path,
                          log_path=options.log_path)
    installer.configure(install_config)
    installer.execute()
Ejemplo n.º 2
0
    def __init__(self, options):
        install_config=None
        self.media_mount_path = None
        photon_media = None
        ks_path = options.install_config_file
        # Path to RPMS repository: local media or remote URL
        # If --repo-path= provided - use it,
        # if not provided - use kernel repo= parameter,
        # if not provided - use /RPMS path from photon_media,
        # exit otherwise.
        repo_path = options.repo_path

        with open('/proc/cmdline', 'r') as f:
            kernel_params = shlex.split(f.read().replace('\n', ''))

        for arg in kernel_params:
            if arg.startswith("ks="):
                if not ks_path:
                    ks_path = arg[len("ks="):]
            elif arg.startswith("repo="):
                if not repo_path:
                    repo_path = arg[len("repo="):]
            elif arg.startswith("photon.media="):
                photon_media = arg[len("photon.media="):]

        if photon_media:
            self.mount_media(photon_media)

        if not repo_path:
            if self.media_mount_path:
                repo_path = self.media_mount_path + "/RPMS"
            else:
                print("Please specify RPM repo path.")
                return

        if ks_path:
            install_config=self._load_ks_config(ks_path)

        if options.ui_config_file:
            ui_config = (JsonWrapper(options.ui_config_file)).read()
        else:
            ui_config={}
        ui_config['options_file'] = options.options_file

        # Run installer
        installer = Installer(rpm_path=repo_path, log_path="/var/log")

        installer.configure(install_config, ui_config)
        installer.execute()
Ejemplo n.º 3
0
    def __init__(self, options):
        install_config = None
        self.cd_mount_path = None
        cd_search = None
        ks_path = options.install_config_file
        repo_path = options.repo_path

        with open('/proc/cmdline', 'r') as f:
            kernel_params = shlex.split(f.read().replace('\n', ''))

        for arg in kernel_params:
            if arg.startswith("ks="):
                if not ks_path:
                    ks_path = arg[len("ks="):]
            elif arg.startswith("repo="):
                if not repo_path:
                    repo_path = arg[len("repo="):]
            elif arg.startswith("photon.media="):
                cd_search = arg[len("photon.media="):]

        if not repo_path:
            print("Please specify RPM repo path.")
            return

        if cd_search:
            self.mount_cd(cd_search)

        if ks_path:
            install_config = self._load_ks_config(ks_path)

        if options.ui_config_file:
            ui_config = (JsonWrapper(options.ui_config_file)).read()
        else:
            ui_config = {}
        ui_config['options_file'] = options.options_file

        # Run installer
        installer = Installer(rpm_path=repo_path, log_path="/var/log")

        installer.configure(install_config, ui_config)
        installer.execute()
Ejemplo n.º 4
0
    def __init__(self, options):
        install_config=None
        self.media_mount_path = None
        photon_media = None
        ks_path = options.install_config_file
        # Path to RPMS repository: local media or remote URL
        # If --repo-path= provided - use it,
        # if not provided - use kernel repo= parameter,
        # if not provided - use /RPMS path from photon_media,
        # exit otherwise.
        repo_path = options.repo_path
        self.insecure_installation = None

        with open('/proc/cmdline', 'r') as f:
            kernel_params = shlex.split(f.read().replace('\n', ''))

        for arg in kernel_params:
            if arg.startswith("ks="):
                if not ks_path:
                    ks_path = arg[len("ks="):]
            elif arg.startswith("repo="):
                if not repo_path:
                    repo_path = arg[len("repo="):]
            elif arg.startswith("photon.media="):
                photon_media = arg[len("photon.media="):]
            elif arg.startswith("insecure_installation="):
                self.insecure_installation = bool(int(arg[len("insecure_installation="):]))

        if photon_media:
            self.mount_media(photon_media)

        if not repo_path:
            if self.media_mount_path:
                repo_path = self.media_mount_path + "/RPMS"
            else:
                print("Please specify RPM repo path.")
                return

        if ks_path:
            install_config = self._load_ks_config(ks_path)


        # insecure_installation flag added through commandline overrides that of ks_config
        if self.insecure_installation:
            if not install_config:
                install_config = {}
            install_config['insecure_installation'] = self.insecure_installation

        if not install_config:
            install_config = {}
        install_config['photon_release_version'] = options.photon_release_version

        if options.ui_config_file:
            ui_config = (JsonWrapper(options.ui_config_file)).read()
        else:
            ui_config={}
        ui_config['options_file'] = options.options_file

        #initializing eula file path
        ui_config['eula_file_path'] = options.eula_file_path

        #initializing license display text
        ui_config['license_display_title'] = options.license_display_title


        # Run installer
        installer = Installer(rpm_path=repo_path, log_path="/var/log")

        installer.configure(install_config, ui_config)
        installer.execute()
Ejemplo n.º 5
0
    parser.add_argument("-e",
                        "--eula-file",
                        dest="eula_file_path",
                        default=None)
    parser.add_argument("-t",
                        "--license-title",
                        dest="license_display_title",
                        default=None)

    options = parser.parse_args()

    if options.image_type == 'iso':
        from isoInstaller import IsoInstaller
        IsoInstaller(options)

    else:
        from installer import Installer
        import json
        install_config = None
        if options.install_config_file:
            with open(options.install_config_file) as f:
                install_config = json.load(f)
        else:
            raise Exception('install config file not provided')

        installer = Installer(working_directory=working_directory,
                              rpm_path=options.rpm_path,
                              log_path=options.log_path)
        installer.configure(install_config)
        installer.execute()