Class: OsCtld::DistConfig::Distributions::Void
- Defined in:
- lib/osctld/dist_config/distributions/void.rb
Defined Under Namespace
Classes: Configurator
Instance Attribute Summary
Attributes inherited from Base
#configurator, #ct, #ctrc, #distribution, #version
Instance Method Summary collapse
- #apply_hostname ⇒ Object
- #passwd(opts) ⇒ Object
-
#stop(opts) ⇒ Object
See man runit-init.
Methods inherited from Base
#add_netif, #bin_path, #configurator_class, distribution, #dns_resolvers, #initialize, #log_type, #network, #post_mount, #pre_start, #remove_netif, #rename_netif, #set_hostname, #start, #unset_etc_hosts, #update_etc_hosts, #volatile_is_systemd?, #with_rootfs
Methods included from Utils::SwitchUser
Constructor Details
This class inherits a constructor from OsCtld::DistConfig::Distributions::Base
Instance Method Details
#apply_hostname ⇒ Object
73 74 75 76 77 |
# File 'lib/osctld/dist_config/distributions/void.rb', line 73 def apply_hostname ct_syscmd(ct, ['hostname', ct.hostname.local]) rescue SystemCommandFailed => e log(:warn, ct, "Unable to apply hostname: #{e.}") end |
#passwd(opts) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/osctld/dist_config/distributions/void.rb', line 79 def passwd(opts) # Without the -c switch, the password is not set (bug?) ret = ct_syscmd( ct, %w[chpasswd -c SHA512], stdin: "#{opts[:user]}:#{opts[:password]}\n", run: true, valid_rcs: :all ) return true if ret.success? log(:warn, ct, "Unable to set password: #{ret.output}") end |
#stop(opts) ⇒ Object
See man runit-init
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/osctld/dist_config/distributions/void.rb', line 61 def stop(opts) # Configure runit for halt begin ContainerControl::Commands::StopRunit.run!(ct, message: opts[:message]) rescue ContainerControl::Error => e log(:warn, ct, "Unable to gracefully shutdown runit: #{e.}") end # Run standard stop process super(opts.merge(message: nil)) end |