Skip to content

Commit

Permalink
Merge branch 'SLE-15-SP1' into merge_SLE-15-SP1
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Jul 8, 2020
2 parents cceb533 + b03c5ca commit c6cc9e8
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 77 deletions.
7 changes: 7 additions & 0 deletions package/autoyast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jul 8 23:41:41 UTC 2020 - Knut Anderssen <kanderssen@suse.com>

- Move pre-scripts to the autoinit client running them just after
the profile has been processed (bsc#1110413)
- 4.2.40

-------------------------------------------------------------------
Tue Jul 7 13:20:24 UTC 2020 - Knut Anderssen <kanderssen@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/autoyast2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%endif

Name: autoyast2
Version: 4.2.39
Version: 4.2.40
Release: 0
Summary: YaST2 - Automated Installation
License: GPL-2.0-only
Expand Down
46 changes: 4 additions & 42 deletions src/clients/inst_autosetup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,10 @@ def main
Yast.import "AutoinstFunctions"
Yast.import "Wizard"

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

@help_text = _(
"<P>Please wait while the system is prepared for autoinstallation.</P>"
)
@progress_stages = [
_("Execute pre-install user scripts"),
_("Configure General Settings "),
_("Set up language"),
_("Configure security settings"),
Expand All @@ -84,7 +81,6 @@ def main
]

@progress_descriptions = [
_("Executing pre-install user scripts..."),
_("Configuring general settings..."),
_("Setting up language..."),
_("Configuring security settings"),
Expand All @@ -109,44 +105,6 @@ def main

return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)

Progress.NextStage

# Pre-Scripts
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
AutoinstScripts.Write("pre-scripts", false)

# Reread Profile in case it was modified in pre-script
# User has to create the new profile in a pre-defined
# location for easy processing in pre-script.

return :abort if readModified == :abort

return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)

#
# Partitioning and Storage
# //////////////////////////////////////////////////////////////////////

@modified = true
begin
askDialog
# Pre-Scripts
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
AutoinstScripts.Write("pre-scripts", false)
@ret2 = readModified
return :abort if @ret2 == :abort

@modified = false if @ret2 == :not_found
if Ops.greater_or_equal(
SCR.Read(path(".target.size"), "/var/lib/YaST2/restart_yast"),
0
)
return :restart_yast
end
end while @modified == true

# reimport scripts, for the case <ask> has changed them
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
#
# Set workflow variables
#
Expand Down Expand Up @@ -298,6 +256,10 @@ def main
autosetup_security
return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)

#
# Partitioning and Storage
#//////////////////////////////////////////////////////////////////////

Progress.NextStage

# Pre-scripts can modify the AutoYaST profile. Even more, a pre-script could change
Expand Down
49 changes: 48 additions & 1 deletion src/lib/autoinstall/clients/inst_autoinit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Yast.import "AutoinstConfig"
Yast.import "AutoinstFunctions"
Yast.import "AutoinstGeneral"
Yast.import "AutoinstScripts"
Yast.import "Call"
Yast.import "Console"
Yast.import "InstURL"
Expand All @@ -24,6 +25,7 @@
module Y2Autoinstallation
module Clients
class InstAutoinit
include Yast
include Y2Autoinstallation::AutosetupHelpers
include Yast::Logger
include Yast::UIShortcuts
Expand All @@ -36,6 +38,8 @@ def self.run

def initialize
textdomain "autoinst"

Yast.include self, "autoinstall/ask.rb"
end

def run
Expand All @@ -48,7 +52,8 @@ def run
_("Probe hardware"),
_("Retrieve & Read Control File"),
_("Parse control file"),
_("Initial Configuration")
_("Initial Configuration"),
_("Execute pre-install user scripts")
]

Yast::Progress.New(
Expand All @@ -74,6 +79,15 @@ def run
ret = processProfile
return ret if ret != :ok

# Run pre-scripts as soon as possible as we could modify the profile by
# them or by the ask dialog (bsc#1114013)
Yast::Progress.NextStage
Yast::Progress.Title(_("Executing pre-install user scripts..."))
log.info("Executing pre-scripts")

ret = autoinit_scripts
return ret if ret != :ok

Yast::Progress.Finish

# when installing from the online installation medium we need to
Expand Down Expand Up @@ -132,6 +146,39 @@ def run

private

# Import and write the profile pre-scripts running then the ask dialog when
# an ask-list is declared redoing the import and write of the pre-scripts as
# many times as needed.
def autoinit_scripts
# Pre-Scripts
Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {})
Yast::AutoinstScripts.Write("pre-scripts", false)

# Reread Profile in case it was modified in pre-script
# User has to create the new profile in a pre-defined
# location for easy processing in pre-script.

return :abort if readModified == :abort

return :abort if Yast::UI.PollInput == :abort && Yast::Popup.ConfirmAbort(:painless)

loop do
askDialog
# Pre-Scripts
Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {})
Yast::AutoinstScripts.Write("pre-scripts", false)
ret = readModified
return :abort if ret == :abort

return :restart_yast if File.exist?("/var/lib/YaST2/restart_yast")
break if ret == :not_found
end

# reimport scripts, for the case <ask> has changed them
Yast::AutoinstScripts.Import(Yast::Profile.current["scripts"] || {})
:ok
end

# Checking profile for unsupported sections.
def check_unsupported_profile_sections
unsupported_sections = Yast::Y2ModuleConfig.unsupported_profile_sections
Expand Down
33 changes: 0 additions & 33 deletions src/lib/autoinstall/clients/inst_autosetup_upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,37 +58,6 @@ def main

# configure general settings

return :abort if UI.PollInput == :abort && Popup.ConfirmAbort(:painless)

Progress.NextStage

# Pre-Scripts
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
AutoinstScripts.Write("pre-scripts", false)

# Reread Profile in case it was modified in pre-script
# User has to create the new profile in a pre-defined
# location for easy processing in pre-script.

return :abort if readModified == :abort

#
# Partitioning and Storage
# //////////////////////////////////////////////////////////////////////

loop do
askDialog
# Pre-Scripts
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
AutoinstScripts.Write("pre-scripts", false)
ret2 = readModified
return :abort if ret2 == :abort

break if ret2 == :not_found
end

# reimport scripts, for the case <ask> has changed them
AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {}))
#
# Set workflow variables
#
Expand Down Expand Up @@ -294,7 +263,6 @@ def help_text
def progress_stages
[
_("Configure General Settings "),
_("Execute pre-install user scripts"),
_("Set up language"),
_("Registration"),
_("Configure Software selections"),
Expand All @@ -306,7 +274,6 @@ def progress_stages
def progress_descriptions
[
_("Configuring general settings..."),
_("Executing pre-install user scripts..."),
_("Setting up language..."),
_("Registering the system..."),
_("Configuring Software selections..."),
Expand Down

0 comments on commit c6cc9e8

Please sign in to comment.