Module: Yast::NetworkRuntimeInclude

Defined in:
../../src/include/network/runtime.rb

Instance Method Summary (collapse)

Instance Method Details

Link detection

Returns:

  • true if link found

See Also:

  • #ethtool(8)


60
61
62
63
64
65
66
67
68
69
70
71
# File '../../src/include/network/runtime.rb', line 60

def HasLink
  ifname = "eth0"

  command = Builtins.sformat(
    "ethtool %1 | grep -q 'Link detected: no'",
    ifname
  )
  if Convert.to_integer(SCR.Execute(path(".target.bash"), command)) == 1
    return false
  end
  true
end

- (Object) HaveDialupLikeInterfaces

Are there interfaces controlled by smpppd and qinternet? They are the ones with USERCONTROL=yes (#44303)

Returns:

  • true/false



76
77
78
79
80
81
82
83
84
85
# File '../../src/include/network/runtime.rb', line 76

def HaveDialupLikeInterfaces
  devs = NetworkInterfaces.Locate("USERCONTROL", "yes")
  Builtins.y2milestone("user controlled interfaces: %1", devs)
  return true if devs != []

  devs = ISDN.Locate("USERCONTROL", "yes")
  Builtins.y2milestone("user controlled ISDN interfaces: %1", devs)

  devs != []
end

- (Object) initialize_network_runtime(include_target)



31
32
33
34
35
36
37
38
39
40
41
42
43
# File '../../src/include/network/runtime.rb', line 31

def initialize_network_runtime(include_target)

  Yast.import "Arch"
  Yast.import "Desktop"
  Yast.import "ISDN"
  Yast.import "Mode"
  Yast.import "NetworkInterfaces"
  Yast.import "Package"
  Yast.import "Service"
  Yast.import "PackageSystem"

  textdomain "network"
end

- (Object) RunSuSEconfig

Run SuSEconfig

Returns:

  • true if success



47
48
49
50
51
52
53
54
55
# File '../../src/include/network/runtime.rb', line 47

def RunSuSEconfig
  Builtins.y2milestone("Updating sendmail and/or postfix configuration.")
  SCR.Execute(
    path(".target.bash"),
    "/usr/lib/sendmail.d/update 2>/dev/null"
  )
  SCR.Execute(path(".target.bash"), "/usr/sbin/config.postfix 2>/dev/null")
  true
end

- (Object) SetupSMPPPD(install_force)

Setup smpppd(8)

Returns:

  • true if success



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File '../../src/include/network/runtime.rb', line 89

def SetupSMPPPD(install_force)
  ret = true
  # Stop and disable
  if !HaveDialupLikeInterfaces()
    ret = Service.Disable("smpppd") && ret
    ret = Service.Stop("smpppd") && ret
  else
    # (#299033) - if not forced, user can continue also without packages
    ret = PackageSystem.CheckAndInstallPackagesInteractive(["smpppd"])

    ret = Service.Enable("smpppd") && ret

    # Installation?
    if Mode.normal
      if Service.Status("smpppd") == 0
        ret = Service.Reload("smpppd") && ret
      else
        ret = Service.Start("smpppd") && ret
      end
    end
  end

  ret
end