From 6353585eeee9c5c595d6985c1831a2995f42529e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Alejandro=20Anderssen=20Gonz=C3=A1lez?= Date: Fri, 3 Jul 2020 16:17:02 +0100 Subject: [PATCH] Run pre-scripts just after the profile has been processed --- src/clients/inst_autosetup.rb | 22 --------------- src/lib/autoinstall/clients/inst_autoinit.rb | 28 +++++++++++++++++++- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/clients/inst_autosetup.rb b/src/clients/inst_autosetup.rb index 5c0ede569..ad512ed2a 100644 --- a/src/clients/inst_autosetup.rb +++ b/src/clients/inst_autosetup.rb @@ -63,13 +63,10 @@ def main Yast.import "AutoinstFunctions" Yast.import "Wizard" - Yast.include self, "autoinstall/ask.rb" - @help_text = _( "

Please wait while the system is prepared for autoinstallation.

" ) @progress_stages = [ - _("Execute pre-install user scripts"), _("Configure General Settings "), _("Set up language"), _("Configure security settings"), @@ -84,7 +81,6 @@ def main ] @progress_descriptions = [ - _("Executing pre-install user scripts..."), _("Configuring general settings..."), _("Setting up language..."), _("Configuring security settings"), @@ -127,24 +123,6 @@ def main # 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 has changed them AutoinstScripts.Import(Ops.get_map(Profile.current, "scripts", {})) # diff --git a/src/lib/autoinstall/clients/inst_autoinit.rb b/src/lib/autoinstall/clients/inst_autoinit.rb index 14fd3315f..17f2da987 100644 --- a/src/lib/autoinstall/clients/inst_autoinit.rb +++ b/src/lib/autoinstall/clients/inst_autoinit.rb @@ -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" @@ -24,6 +25,7 @@ module Y2Autoinstallation module Clients class InstAutoinit + include Yast include Y2Autoinstallation::AutosetupHelpers include Yast::Logger include Yast::UIShortcuts @@ -36,6 +38,8 @@ def self.run def initialize textdomain "autoinst" + + Yast.include self, "autoinstall/ask.rb" end def run @@ -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( @@ -74,6 +79,12 @@ def run ret = processProfile return ret if ret != :ok + Yast::Progress.NextStep + Yast::Progress.Title(_("Executing pre-install user scripts...")) + log.info("Executing pre-scripts") + + autoinit_scripts + Yast::Progress.Finish # when installing from the online installation medium we need to @@ -132,6 +143,21 @@ def run private + def autoinit_scripts + @modified = true + 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 + end + # Checking profile for unsupported sections. def check_unsupported_profile_sections unsupported_sections = Yast::Y2ModuleConfig.unsupported_profile_sections