Class: OsCtld::DistConfig::Distributions::Slackware::Configurator
- Inherits:
-
Configurator
- Object
- Configurator
- OsCtld::DistConfig::Distributions::Slackware::Configurator
- Defined in:
- lib/osctld/dist_config/distributions/slackware.rb
Instance Attribute Summary
Attributes inherited from Configurator
#ctid, #distribution, #network_backend, #rootfs, #version
Instance Method Summary collapse
- #network(netifs) ⇒ Object
- #network_class ⇒ Object protected
- #set_hostname(new_hostname, old_hostname: nil) ⇒ Object
Methods inherited from Configurator
#add_netif, #dns_resolvers, #initialize, #instantiate_network_class, #log_type, #remove_netif, #rename_netif, #unset_etc_hosts, #update_etc_hosts
Methods included from Helpers::Common
#systemd_service_enabled?, #systemd_service_masked?, #writable?
Constructor Details
This class inherits a constructor from OsCtld::DistConfig::Configurator
Instance Method Details
#network(netifs) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/osctld/dist_config/distributions/slackware.rb', line 17 def network(netifs) tpl_base = 'dist_config/network/slackware' { start: 'add', stop: 'del' }.each do |operation, cmd| cmds = netifs.map do |netif| OsCtld::ErbTemplate.render( File.join(tpl_base, netif.type.to_s), { netif:, cmd: } ) end writable?(File.join(rootfs, 'etc/rc.d', "rc.venet.#{operation}")) do |path| File.write(path, cmds.join("\n")) end end end |
#network_class ⇒ Object (protected)
36 37 38 |
# File 'lib/osctld/dist_config/distributions/slackware.rb', line 36 def network_class nil end |
#set_hostname(new_hostname, old_hostname: nil) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/osctld/dist_config/distributions/slackware.rb', line 8 def set_hostname(new_hostname, old_hostname: nil) # /etc/hostname writable?(File.join(rootfs, 'etc', 'HOSTNAME')) do |path| regenerate_file(path, 0o644) do |f| f.puts(new_hostname.local) end end end |