OpenBSD > Linux, do not fake uname
This commit is contained in:
parent
30030fc949
commit
2958e7a60e
@ -2,7 +2,8 @@
|
|||||||
class Autodetect
|
class Autodetect
|
||||||
def self.uname
|
def self.uname
|
||||||
os = nil : String?
|
os = nil : String?
|
||||||
Do.run("uname") do |p|
|
# do not fake it
|
||||||
|
Process.run("uname") do |p|
|
||||||
p.output.each_line do |line|
|
p.output.each_line do |line|
|
||||||
os = line
|
os = line
|
||||||
end
|
end
|
||||||
|
11
src/cli.cr
11
src/cli.cr
@ -109,7 +109,13 @@ possible_wireless_configuration_cmds = {
|
|||||||
Context.os = Autodetect.uname
|
Context.os = Autodetect.uname
|
||||||
|
|
||||||
case Context.os
|
case Context.os
|
||||||
|
when "OpenBSD"
|
||||||
|
NetworkCommands.cmd_network_configuration = NetworkCommands::OpenBSDIfconfigCommand
|
||||||
|
NetworkCommands.cmd_wireless_configuration = NetworkCommands::OpenBSDIfconfigCommand
|
||||||
|
NetworkCommands.cmd_dhcp_client = NetworkCommands::OpenBSDDHClientCommand
|
||||||
|
NetworkCommands.cmd_sysctl = NetworkCommands::OpenBSDSysctlCommand
|
||||||
when "Linux"
|
when "Linux"
|
||||||
|
puts "I'm on linux, look at me!"
|
||||||
key = Context.prefered_network_configuration_program
|
key = Context.prefered_network_configuration_program
|
||||||
key = possible_network_configuration_cmds.keys.find { |key| Autodetect.which(key) } if key.nil?
|
key = possible_network_configuration_cmds.keys.find { |key| Autodetect.which(key) } if key.nil?
|
||||||
# should crash if there is no network command installed
|
# should crash if there is no network command installed
|
||||||
@ -125,11 +131,6 @@ when "Linux"
|
|||||||
# should not crash if there is no dhcp client on the system
|
# should not crash if there is no dhcp client on the system
|
||||||
NetworkCommands.cmd_dhcp_client = possible_dhcp_clients[key] unless key.nil?
|
NetworkCommands.cmd_dhcp_client = possible_dhcp_clients[key] unless key.nil?
|
||||||
NetworkCommands.cmd_sysctl = NetworkCommands::SysctlCommand
|
NetworkCommands.cmd_sysctl = NetworkCommands::SysctlCommand
|
||||||
when "OpenBSD"
|
|
||||||
NetworkCommands.cmd_network_configuration = NetworkCommands::OpenBSDIfconfigCommand
|
|
||||||
NetworkCommands.cmd_wireless_configuration = NetworkCommands::OpenBSDIfconfigCommand
|
|
||||||
NetworkCommands.cmd_dhcp_client = NetworkCommands::OpenBSDDHClientCommand
|
|
||||||
NetworkCommands.cmd_sysctl = NetworkCommands::OpenBSDSysctlCommand
|
|
||||||
end
|
end
|
||||||
|
|
||||||
files = Array(String).new
|
files = Array(String).new
|
||||||
|
Loading…
Reference in New Issue
Block a user