Class: WifiWand::Platforms::Selection::Ubuntu
- Defined in:
- lib/wifi_wand/platforms/selection/ubuntu.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #create_model(options) ⇒ Object
- #current_os_is_this_os? ⇒ Boolean
-
#initialize ⇒ Ubuntu
constructor
A new instance of Ubuntu.
Constructor Details
#initialize ⇒ Ubuntu
Returns a new instance of Ubuntu.
9 |
# File 'lib/wifi_wand/platforms/selection/ubuntu.rb', line 9 def initialize = super(:ubuntu, 'Ubuntu Linux') |
Instance Method Details
#create_model(options) ⇒ Object
31 32 33 34 |
# File 'lib/wifi_wand/platforms/selection/ubuntu.rb', line 31 def create_model() require_relative '../ubuntu/model' WifiWand::Platforms::Ubuntu::Model.create_model() end |
#current_os_is_this_os? ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/wifi_wand/platforms/selection/ubuntu.rb', line 11 def current_os_is_this_os? # Check /etc/os-release for Ubuntu or Ubuntu-based systems if File.exist?('/etc/os-release') content = File.read('/etc/os-release') # Direct Ubuntu match (official Ubuntu and flavors) return true if content.match?(/^ID=ubuntu$/m) # Ubuntu derivative match (Linux Mint, Pop!_OS, elementary OS, etc.) # These systems have ID=something_else but ID_LIKE contains "ubuntu" return true if content.match?(/^ID_LIKE=.*ubuntu/m) end # Fallback: check /proc/version for Ubuntu signature return true if File.exist?('/proc/version') && File.read('/proc/version').include?('Ubuntu') # Not Ubuntu or Ubuntu-based false end |