Class: Installation::DriverUpdate
- Inherits:
-
Object
- Object
- Installation::DriverUpdate
- Includes:
- Yast::Logger
- Defined in:
- src/lib/installation/driver_update.rb
Overview
Represents a driver update.
This class will handle driver updates which are applied yet. The main purpose is to re-apply them after the installer's self-update has been performed.
At this point, two kinds of driver updates are considered:
- Driver Update Disks (DUD): a directory containing different subdirectories, one of them called inst-sys.
- Packages: are stored in a squashed filesystem which is mounted in /mounts directory.
Defined Under Namespace
Classes: CouldNotBeApplied, NotFound, PreScriptFailed
Constant Summary collapse
- APPLY_CMD =
Command to apply the DUD disk to inst-sys
"/sbin/adddir %<source>s /".freeze
Instance Attribute Summary collapse
-
#instsys_path ⇒ Pathname
readonly
Path to the instsys path of the driver update.
-
#kind ⇒ Symbol
readonly
Kind of driver update (:dud or :archive).
-
#path ⇒ Pathname
readonly
Path to the driver update.
Class Method Summary collapse
-
.find(update_dirs) ⇒ Array<DriverUpdate>
Find driver updates in a given set of directories.
Instance Method Summary collapse
-
#apply ⇒ Object
Add files/directories to the inst-sys.
-
#initialize(path) ⇒ DriverUpdate
constructor
Constructor.
Constructor Details
#initialize(path) ⇒ DriverUpdate
Constructor
77 78 79 80 81 82 83 84 85 |
# File 'src/lib/installation/driver_update.rb', line 77 def initialize(path) @path = path if !path.exist? log.error("Driver Update not found at #{path}") raise NotFound end @kind = path.file? ? :archive : :dud @instsys_path = send("#{@kind}_instsys_path") end |
Instance Attribute Details
#instsys_path ⇒ Pathname (readonly)
Returns Path to the instsys path of the driver update.
46 47 48 |
# File 'src/lib/installation/driver_update.rb', line 46 def instsys_path @instsys_path end |
#kind ⇒ Symbol (readonly)
Returns Kind of driver update (:dud or :archive).
42 43 44 |
# File 'src/lib/installation/driver_update.rb', line 42 def kind @kind end |
#path ⇒ Pathname (readonly)
Returns Path to the driver update.
39 40 41 |
# File 'src/lib/installation/driver_update.rb', line 39 def path @path end |
Class Method Details
.find(update_dirs) ⇒ Array<DriverUpdate>
Find driver updates in a given set of directories
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'src/lib/installation/driver_update.rb', line 53 def find(update_dirs) dirs = Array(update_dirs) log.info("Searching for Driver Updates at #{dirs.map(&:to_s)}") # DUD as directories duds_globs = dirs.map { |d| d.join("*", "dud.config") } duds = Pathname.glob(duds_globs).map(&:dirname) # DUD as files (squashfs filesystems) archives_globs = dirs.map { |d| d.join("dud_*") } archives = Pathname.glob(archives_globs) (duds + archives).uniq.map do |path| log.info("Found a Driver Update at #{path}") new(path) end end |
Instance Method Details
#apply ⇒ Object
Add files/directories to the inst-sys
95 96 97 98 99 100 101 102 |
# File 'src/lib/installation/driver_update.rb', line 95 def apply return false if instsys_path.nil? || !instsys_path.exist? cmd = format(APPLY_CMD, source: instsys_path) out = Yast::SCR.Execute(Yast::Path.new(".target.bash_output"), cmd) log.info("Applying update at #{path} (#{cmd}): #{out}") raise CouldNotBeApplied unless out["exit"].zero? end |