Class: Yast::SwitchScrFinishClient
- Inherits:
-
Client
- Object
- Client
- Yast::SwitchScrFinishClient
- Defined in:
- src/lib/installation/clients/switch_scr_finish.rb
Instance Method Summary collapse
- #CheckFreeSpaceNow ⇒ Object
- #main ⇒ Object
-
#TestTheNewSCR ⇒ Boolean
Check the new SCR, bnc #433057.
- #TestTheNewSCRHandler ⇒ Object
Instance Method Details
#CheckFreeSpaceNow ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'src/lib/installation/clients/switch_scr_finish.rb', line 152 def CheckFreeSpaceNow ret_exec = Convert.to_map( SCR.Execute(path(".target.bash_output"), "LANG=en_US.UTF-8 /bin/df -h") ) if Ops.get_integer(ret_exec, "exit", -1) == 0 Builtins.y2milestone( "Free space: \n%1", Builtins.mergestring( Builtins.splitstring(Ops.get_string(ret_exec, "stdout", ""), "\\n"), "\n" ) ) else Builtins.y2error("Cannot find out free space: %1", ret_exec) end nil end |
#main ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'src/lib/installation/clients/switch_scr_finish.rb', line 33 def main Yast.import "UI" textdomain "installation" Yast.import "Directory" Yast.import "Installation" @ret = nil @func = "" @param = {} # Check arguments if Ops.greater_than(Builtins.size(WFM.Args), 0) && Ops.is_string?(WFM.Args(0)) @func = Convert.to_string(WFM.Args(0)) if Ops.greater_than(Builtins.size(WFM.Args), 1) && Ops.is_map?(WFM.Args(1)) @param = Convert.to_map(WFM.Args(1)) end end Builtins.y2milestone("starting switch_scr_finish") Builtins.y2debug("func=%1", @func) Builtins.y2debug("param=%1", @param) case @func when "Info" return { "steps" => 1, # progress step title "title" => _("Moving to installed system..."), "when" => [:installation, :live_installation, :update, :autoinst] } when "Write" # -------------------------------------------------------------- # stop SCR # restart on destination Builtins.y2milestone("Stopping SCR") WFM.SCRClose(Installation.scr_handle) # -------------------------------------------------------------- Builtins.y2milestone("Re-starting SCR on %1", Installation.destdir) Installation.scr_handle = WFM.SCROpen( Ops.add(Ops.add("chroot=", Installation.destdir), ":scr"), false ) Builtins.y2milestone("new scr_handle: %1", Installation.scr_handle) # bugzilla #201058 # WFM::SCROpen returns negative integer in case of failure if Installation.scr_handle.nil? || Ops.less_than(Installation.scr_handle, 0) Builtins.y2error("Cannot switch to the system") return false end Installation.scr_destdir = "/" WFM.SCRSetDefault(Installation.scr_handle) # re-init tmpdir from new SCR ! Directory.ResetTmpDir # bnc #433057 # Even if SCR switch worked, run a set of some simple tests if TestTheNewSCRHandler() != true Builtins.y2error("Switched SCR do not work properly.") return false end else Builtins.y2error("unknown function: %1", @func) @ret = nil end Builtins.y2debug("ret=%1", @ret) Builtins.y2milestone("switch_scr_finish finished") deep_copy(@ret) end |
#TestTheNewSCR ⇒ Boolean
Check the new SCR, bnc #433057
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'src/lib/installation/clients/switch_scr_finish.rb', line 119 def TestTheNewSCR Builtins.y2milestone("Running some tests on the new SCR") ret_exec = Convert.to_map( SCR.Execute(path(".target.bash_output"), "TEST=OK; echo ${TEST}") ) if Ops.get_integer(ret_exec, "exit", -1) != 0 Builtins.y2milestone("SCR::Execute: %1", ret_exec) Builtins.y2error("SCR Error") return false end ret_dir = Convert.to_list(SCR.Read(path(".target.dir"), "/")) if ret_dir.nil? || ret_dir == [] Builtins.y2milestone("SCR::Read/dir: %1", ret_dir) Builtins.y2error("SCR Error") return false end scr_dir = SCR.Dir(path(".sysconfig")) if scr_dir.nil? || scr_dir == [] Builtins.y2milestone("SCR::Dir: %1", scr_dir) Builtins.y2error("SCR Error") return false end Builtins.y2milestone("SCR seems to be OK") true end |
#TestTheNewSCRHandler ⇒ Object
172 173 174 175 176 177 178 179 |
# File 'src/lib/installation/clients/switch_scr_finish.rb', line 172 def TestTheNewSCRHandler ret = TestTheNewSCR() # BNC #460477 CheckFreeSpaceNow() ret end |