Skip to content

Commit

Permalink
Import initial configuration from the profile when modified by pre-sc…
Browse files Browse the repository at this point in the history
…ripts
  • Loading branch information
teclator committed Sep 18, 2020
1 parent ec2e34b commit 09ae66d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/clients/inst_autoinit.rb
Expand Up @@ -147,8 +147,7 @@ def main
# an ask-list is declared redoing the import and write of the pre-scripts as
# many times as needed.
def autoinit_scripts
# Pre-Scripts
AutoinstScripts.Import(Profile.current["scripts"] || {})
# pre-scripts should be already imported
AutoinstScripts.Write("pre-scripts", false)

# Reread Profile in case it was modified in pre-script
Expand All @@ -162,7 +161,7 @@ def autoinit_scripts
loop do
askDialog
# Pre-Scripts
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
AutoinstScripts.Import(Profile.current["scripts"] || {})
AutoinstScripts.Write("pre-scripts", false)
ret = readModified
return :abort if ret == :abort
Expand All @@ -171,8 +170,7 @@ def autoinit_scripts
break if ret == :not_found
end

# reimport scripts, for the case <ask> has changed them
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
import_initial_config if modified_profile?
:ok
end

Expand Down Expand Up @@ -259,8 +257,7 @@ def processProfile
Progress.NextStage
Progress.Title(_("Initial Configuration"))
Builtins.y2milestone("Initial Configuration")
Report.Import(Profile.current.fetch("report",{}))
AutoinstGeneral.Import(Profile.current.fetch("general",{}))
import_initial_config

#
# Copy the control file for easy access by user to a pre-defined
Expand All @@ -276,6 +273,15 @@ def processProfile
)
:ok
end

# Imports the initial profile configuration (report, general and
# pre-scripts sections)
def import_initial_config
# reimport scripts, for the case <ask> has changed them
Yast::AutoinstScripts.Import(Yast::Profile.current.fetch("scripts", {}))
Yast::Report.Import(Yast::Profile.current.fetch("report", {}))
Yast::AutoinstGeneral.Import(Yast::Profile.current.fetch("general", {}))
end
end
end

Expand Down

0 comments on commit 09ae66d

Please sign in to comment.