def run_pre_scripts(ks): """Run %pre scripts. :param ks: a path to a kickstart file or None """ if ks is not None: kickstart.preScriptPass(ks)
def parse_kickstart(options, addon_paths, pass_to_boss=False): """Parse the input kickstart. If we were given a kickstart file, parse (but do not execute) that now. Otherwise, load in defaults from kickstart files shipped with the installation media. Pick up any changes from interactive-defaults.ks that would otherwise be covered by the dracut KS parser. :param options: command line/boot options :param dict addon_paths: addon paths dictionary :returns: kickstart parsed to a data model """ ksdata = None if options.ksfile and not options.liveinst: if not os.path.exists(options.ksfile): stdout_log.error("Kickstart file %s is missing.", options.ksfile) util.ipmi_report(constants.IPMI_ABORTED) sys.exit(1) flags.automatedInstall = True flags.eject = False ks_files = [options.ksfile] elif os.path.exists("/run/install/ks.cfg") and not options.liveinst: # this is to handle such cases where a user has pre-loaded a # ks.cfg onto an OEMDRV labeled device flags.automatedInstall = True flags.eject = False ks_files = ["/run/install/ks.cfg"] else: ks_files = [ "/tmp/updates/interactive-defaults.ks", "/usr/share/anaconda/interactive-defaults.ks" ] for ks in ks_files: if not os.path.exists(ks): continue kickstart.preScriptPass(ks) log.info("Parsing kickstart: " + ks) ksdata = kickstart.parseKickstart(ks, options.ksstrict) if pass_to_boss: distribute_kickstart_with_boss(ks) # Only load the first defaults file we find. break if not ksdata: ksdata = kickstart.AnacondaKSHandler(addon_paths["ks"]) return ksdata
def parse_kickstart(options, addon_paths, pass_to_boss=False): """Parse the input kickstart. If we were given a kickstart file, parse (but do not execute) that now. Otherwise, load in defaults from kickstart files shipped with the installation media. Pick up any changes from interactive-defaults.ks that would otherwise be covered by the dracut KS parser. :param options: command line/boot options :param dict addon_paths: addon paths dictionary :returns: kickstart parsed to a data model """ ksdata = None if options.ksfile and not options.liveinst: if not os.path.exists(options.ksfile): stdout_log.error("Kickstart file %s is missing.", options.ksfile) util.ipmi_report(constants.IPMI_ABORTED) sys.exit(1) flags.automatedInstall = True flags.eject = False ks_files = [options.ksfile] elif os.path.exists("/run/install/ks.cfg") and not options.liveinst: # this is to handle such cases where a user has pre-loaded a # ks.cfg onto an OEMDRV labeled device flags.automatedInstall = True flags.eject = False ks_files = ["/run/install/ks.cfg"] else: ks_files = ["/tmp/updates/interactive-defaults.ks", "/usr/share/anaconda/interactive-defaults.ks"] for ks in ks_files: if not os.path.exists(ks): continue kickstart.preScriptPass(ks) log.info("Parsing kickstart: %s", ks) ksdata = kickstart.parseKickstart(ks, options.ksstrict, pass_to_boss) # Only load the first defaults file we find. break if not ksdata: ksdata = kickstart.AnacondaKSHandler(addon_paths["ks"]) return ksdata
# this is to handle such cases where a user has pre-loaded a # ks.cfg onto an OEMDRV labeled device flags.automatedInstall = True flags.eject = False ksFiles = ["/run/install/ks.cfg"] else: ksFiles = [ "/tmp/updates/interactive-defaults.ks", "/usr/share/anaconda/interactive-defaults.ks" ] for ks in ksFiles: if not os.path.exists(ks): continue kickstart.preScriptPass(ks) log.info("Parsing kickstart: " + ks) ksdata = kickstart.parseKickstart(ks) # Only load the first defaults file we find. break if not ksdata: ksdata = kickstart.AnacondaKSHandler(addon_paths["ks"]) # Pick up any changes from interactive-defaults.ks that would # otherwise be covered by the dracut KS parser. if ksdata.bootloader.extlinux: flags.extlinux = True if ksdata.rescue.rescue: flags.rescue_mode = True
ksFiles = [opts.ksfile] elif os.path.exists("/run/install/ks.cfg") and not opts.liveinst: # this is to handle such cases where a user has pre-loaded a # ks.cfg onto an OEMDRV labeled device flags.automatedInstall = True flags.eject = False ksFiles = ["/run/install/ks.cfg"] else: ksFiles = ["/tmp/updates/interactive-defaults.ks", "/usr/share/anaconda/interactive-defaults.ks"] for ks in ksFiles: if not os.path.exists(ks): continue kickstart.preScriptPass(ks) log.info("Parsing kickstart: " + ks) ksdata = kickstart.parseKickstart(ks) # Only load the first defaults file we find. break if not ksdata: ksdata = kickstart.AnacondaKSHandler(addon_paths["ks"]) # Pick up any changes from interactive-defaults.ks that would # otherwise be covered by the dracut KS parser. if ksdata.bootloader.extlinux: flags.extlinux = True if ksdata.rescue.rescue: flags.rescue_mode = True