Class: Yast::LanClass
- Inherits:
-
Module
- Object
- Module
- Yast::LanClass
- Defined in:
- ../../src/modules/Lan.rb
Instance Method Summary (collapse)
-
- (Object) Add
Add a new device.
-
- (Object) AnyDHCPDevice
Check if any device is configured with DHCP.
-
- (Object) Autoinstall
Create a configuration for autoyast.
-
- (Array) AutoPackages
mode.
-
- (Object) Delete
Delete the given device.
-
- (Object) Edit(name)
Edit the given device.
-
- (Object) Export
Export data.
-
- (Object) HaveXenBridge
Xen bridging confuses us (#178848).
- - (Object) IfcfgsToSkipVirtualizedProposal
-
- (Object) Import(settings)
Import data.
-
- (Object) isAnyInterfaceDown
function for use from autoinstallation (Fate #301032).
- - (Object) main
-
- (Object) Modified
Return a modification status.
-
- (Array) Packages
Of packages needed when writing the config.
- - (Object) PrepareForAutoinst
-
- (Object) Propose
Propose a configuration.
-
- (Object) ProposeHostname
Propose the hostname See also DNS::Read.
-
- (Object) ProposeInterfaces
Propose interface configuration.
-
- (Object) ProposeNMInterfaces
Create minimal ifcfgs for the case when NetworkManager is used: NM does not need them but yast2-firewall and SuSEfirewall2 do Avoid existing ifcfg from network installation.
-
- (Object) ProposeRoutesAndResolver
Propose configuration for routing and resolver.
- - (Object) ProposeVirtualized
-
- (Object) Read(cache)
Read all network settings from the SCR.
- - (Object) readIPv6
-
- (Object) ReadWithCache
(a specialization used when a parameterless function is needed).
- - (Object) ReadWithCacheNoGUI
- - (Object) SetIPv6(status)
-
- (Object) Summary(mode)
Create a textual summary and a list of unconfigured devices “proposal”: for proposal, add links for direct config.
-
- (rich text, links) SummaryGeneral
Create a textual summary for the general network settings proposal (NetworkManager + ipv6).
-
- (Object) UseNetworkManager
Uses product info and is subject to installed packages.
-
- (Object) Write
Update the SCR according to network settings.
- - (Object) writeIPv6
-
- (Object) WriteOnly
Only write configuration without starting any init scripts and SuSEconfig.
Instance Method Details
- (Object) Add
Add a new device
981 982 983 984 985 |
# File '../../src/modules/Lan.rb', line 981 def Add return false if LanItems.Select("") != true NetworkInterfaces.Add true end |
- (Object) AnyDHCPDevice
Check if any device is configured with DHCP.
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 |
# File '../../src/modules/Lan.rb', line 1448 def AnyDHCPDevice # return true if there is at least one device with dhcp4, dhcp6, dhcp or dhcp+autoip Ops.greater_than( Builtins.size( Builtins.union( Builtins.union( NetworkInterfaces.Locate("BOOTPROTO", "dhcp4"), NetworkInterfaces.Locate("BOOTPROTO", "dhcp6") ), Builtins.union( NetworkInterfaces.Locate("BOOTPROTO", "dhcp"), NetworkInterfaces.Locate("BOOTPROTO", "dhcp+autoip") ) ) ), 0 ) end |
- (Object) Autoinstall
Create a configuration for autoyast
1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 |
# File '../../src/modules/Lan.rb', line 1343 def Autoinstall Builtins.y2milestone("Hardware=%1", LanItems.Hardware) tosel = nil # Some HW found -> use it for proposal if Ops.greater_than(Builtins.size(LanItems.Hardware), 0) && Ops.greater_than( Builtins.size( Ops.get_list(LanItems.autoinstall_settings, "interfaces", []) ), 0 ) Builtins.foreach( Ops.get_list(LanItems.autoinstall_settings, "interfaces", []) ) do |interface| devs = NetworkInterfaces.List("") Builtins.y2milestone("devs: %1", devs) tosel = nil Add() tosel = LanItems.FindMatchingDevice(interface) Builtins.y2milestone("tosel=%1", tosel) # Read module data from autoyast aymodule = LanItems.GetModuleForInterface( Ops.get(interface, "device", ""), Ops.get_list(LanItems.autoinstall_settings, "modules", []) ) if tosel != nil Ops.set( tosel, "module", Ops.get_string(aymodule, "module", "") != "" ? Ops.get_string(aymodule, "module", "") : Ops.get_string(tosel, "module", "") ) Ops.set( tosel, "options", Ops.get_string(aymodule, "options", "") != "" ? Ops.get_string(aymodule, "options", "") : Ops.get_string(tosel, "options", "") ) LanItems.SelectHWMap(tosel) else Builtins.y2milestone( "No hardware, no install.inf -> no autoinstallation possible." ) next false end # The uppercasing is also done in lan_auto::FromAY # but the output goes to "devices" whereas here # we use "interfaces". FIXME. newk = nil interface = Builtins.mapmap(interface) do |k, v| newk = Builtins.toupper(k) { newk => v } end defaults = Builtins.union( LanItems.SysconfigDefaults, LanItems.GetDefaultsForHW ) # Set interface variables LanItems.SetDeviceVars(interface, defaults) Builtins.y2debug( "ipaddr,bootproto=%1,%2", LanItems.ipaddr, LanItems.bootproto ) if LanItems.bootproto == "static" && LanItems.ipaddr != "" && LanItems.ipaddr != nil Builtins.y2milestone("static configuration") if LanItems.netmask == nil || LanItems.netmask == "" LanItems.netmask = "255.255.255.0" end end LanItems.Commit end else Builtins.y2milestone( "no interface configuration, taking it from install.inf" ) ProposeInterfaces() end # #153426 - using ProposeInterfaces instead of Propose omitted these # if they are nonempty, Import has already taken care of them. if Ops.get_list(LanItems.autoinstall_settings, ["routing", "routes"], []) == [] Builtins.y2milestone("gateway from install.inf") # Routing::ReadFromGateway (InstallInf["gateway"]:""); end if Ops.get_list(LanItems.autoinstall_settings, ["dns", "nameservers"], []) == [] Builtins.y2milestone("nameserver from install.inf") # DNS::ReadNameserver (InstallInf["nameserver"]:""); end if Ops.get_string(LanItems.autoinstall_settings, ["dns", "hostname"], "") == "" ProposeHostname() end true end |
- (Array) AutoPackages
mode
1555 1556 1557 |
# File '../../src/modules/Lan.rb', line 1555 def AutoPackages { "install" => Packages(), "remove" => [] } end |
- (Object) Delete
Delete the given device
1000 1001 1002 1003 |
# File '../../src/modules/Lan.rb', line 1000 def Delete LanItems.DeleteItem true end |
- (Object) Edit(name)
Edit the given device
990 991 992 993 994 995 996 |
# File '../../src/modules/Lan.rb', line 990 def Edit(name) LanItems.operation = nil return false if LanItems.Select(name) != true NetworkInterfaces.Edit(name) LanItems.operation = :edit true end |
- (Object) Export
Export data
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 |
# File '../../src/modules/Lan.rb', line 831 def Export devices = NetworkInterfaces.Export("") udev_rules = LanUdevAuto.Export(devices) ay = { "dns" => DNS.Export, # FIXME: MOD "modules" : Modules, "s390-devices" => Ops.get_map( udev_rules, "s390-devices", {} ), "net-udev" => Ops.get_map(udev_rules, "net-udev", {}), "config" => NetworkConfig.Export, "devices" => devices, "ipv6" => @ipv6, "routing" => Routing.Export, "managed" => NetworkService.IsManaged, "start_immediately" => Ops.get_boolean( LanItems.autoinstall_settings, "start_immediately", false ), #start_immediately, "keep_install_network" => Ops.get_boolean( LanItems.autoinstall_settings, "keep_install_network", false ) } Builtins.y2milestone("Exported map: %1", ay) deep_copy(ay) end |
- (Object) HaveXenBridge
Xen bridging confuses us (#178848)
1561 1562 1563 1564 1565 1566 |
# File '../../src/modules/Lan.rb', line 1561 def HaveXenBridge #adapted test for xen bridged network (bnc#553794) have_br = FileUtils.Exists("/dev/.sysconfig/network/xenbridges") Builtins.y2milestone("Have Xen bridge: %1", have_br) have_br end |
- (Object) IfcfgsToSkipVirtualizedProposal
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
# File '../../src/modules/Lan.rb', line 1062 def IfcfgsToSkipVirtualizedProposal skipped = [] Builtins.foreach(LanItems.Items) do |current, config| ifcfg = Ops.get_string(LanItems.Items, [current, "ifcfg"], "") if NetworkInterfaces.GetType(ifcfg) == "br" NetworkInterfaces.Edit(ifcfg) Builtins.y2milestone( "Bridge %1 with ports (%2) found", ifcfg, Ops.get_string(NetworkInterfaces.Current, "BRIDGE_PORTS", "") ) skipped = Builtins.add(skipped, ifcfg) Builtins.foreach( Builtins.splitstring( Ops.get_string(NetworkInterfaces.Current, "BRIDGE_PORTS", ""), " " ) ) { |port| skipped = Builtins.add(skipped, port) } end if NetworkInterfaces.GetType(ifcfg) == "bond" NetworkInterfaces.Edit(ifcfg) Builtins.foreach(LanItems.GetBondSlaves(ifcfg)) do |slave| Builtins.y2milestone( "For interface %1 found slave %2", ifcfg, slave ) skipped = Builtins.add(skipped, slave) end end # Skip also usb device as it is not good for bridge proposal (bnc#710098) if NetworkInterfaces.GetType(ifcfg) == "usb" NetworkInterfaces.Edit(ifcfg) Builtins.y2milestone( "Usb device %1 skipped from bridge proposal", ifcfg ) skipped = Builtins.add(skipped, ifcfg) end if NetworkInterfaces.GetValue(ifcfg, "STARTMODE") == "nfsroot" Builtins.y2milestone( "Skipped %1 interface from bridge slaves because of nfsroot.", ifcfg ) skipped = Builtins.add(skipped, ifcfg) end end Builtins.y2milestone("Skipped interfaces : %1", skipped) deep_copy(skipped) end |
- (Object) Import(settings)
Import data
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
# File '../../src/modules/Lan.rb', line 793 def Import(settings) settings = deep_copy(settings) NetworkInterfaces.Import("netcard", Ops.get_map(settings, "devices", {})) Builtins.foreach(NetworkInterfaces.List("netcard")) do |device| LanItems.AddNew Ops.set(LanItems.Items, LanItems.current, { "ifcfg" => device }) end Ops.set( LanItems.autoinstall_settings, "start_immediately", Ops.get_boolean(settings, "start_immediately", false) ) Ops.set( LanItems.autoinstall_settings, "strict_IP_check_timeout", Ops.get_integer(settings, "strict_IP_check_timeout", -1) ) Ops.set( LanItems.autoinstall_settings, "keep_install_network", Ops.get_boolean(settings, "keep_install_network", false) ) NetworkConfig.Import(Ops.get_map(settings, "config", {})) DNS.Import(Builtins.eval(Ops.get_map(settings, "dns", {}))) Routing.Import(Builtins.eval(Ops.get_map(settings, "routing", {}))) NetworkService.SetManaged(Ops.get_boolean(settings, "managed", false)) if Builtins.haskey(settings, "ipv6") @ipv6 = Ops.get_boolean(settings, "ipv6", true) end LanItems.modified = true true end |
- (Object) isAnyInterfaceDown
function for use from autoinstallation (Fate #301032)
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File '../../src/modules/Lan.rb', line 124 def isAnyInterfaceDown down = false link_status = {} net_devices = Builtins.splitstring( Ops.get_string( Convert.convert( SCR.Execute( path(".target.bash_output"), "ls /sys/class/net/ | grep -v lo | tr '\n' ','" ), :from => "any", :to => "map <string, any>" ), "stdout", "" ), "," ) net_devices = Builtins.filter(net_devices) do |item| Ops.greater_than(Builtins.size(item), 0) end Builtins.foreach(net_devices) do |net_dev| row = Builtins.splitstring( Ops.get_string( Convert.convert( SCR.Execute( path(".target.bash_output"), Builtins.sformat( "ip address show dev %1 | grep 'inet\\|link' | sed 's/^ \\+//g'|cut -d' ' -f-2", net_dev ) ), :from => "any", :to => "map <string, any>" ), "stdout", "" ), "\n" ) tmp_mac = "" addr = false Builtins.foreach(row) do |column| tmp_col = Builtins.splitstring(column, " ") next if Ops.less_than(Builtins.size(tmp_col), 2) if Builtins.issubstring(Ops.get(tmp_col, 0, ""), "link/ether") tmp_mac = Ops.get(tmp_col, 1, "") end if Builtins.issubstring(Ops.get(tmp_col, 0, ""), "inet") && !Builtins.issubstring(Ops.get(tmp_col, 0, ""), "inet6") addr = true end end if Ops.greater_than(Builtins.size(tmp_mac), 0) Ops.set(link_status, tmp_mac, addr) end Builtins.y2debug("link_status %1", link_status) end Builtins.y2milestone("link_status %1", link_status) configurations = NetworkInterfaces.FilterDevices("") Builtins.foreach( Builtins.splitstring( Ops.get(NetworkInterfaces.CardRegex, "netcard", ""), "|" ) ) do |devtype| Builtins.foreach( Convert.convert( Map.Keys(Ops.get_map(configurations, devtype, {})), :from => "list", :to => "list <string>" ) ) do |devname| mac = Ops.get_string( Convert.convert( SCR.Execute( path(".target.bash_output"), Builtins.sformat( "cat /sys/class/net/%1/address|tr -d '\n'", devname ) ), :from => "any", :to => "map <string, any>" ), "stdout", "" ) Builtins.y2milestone("confname %1", mac) if !Builtins.haskey(link_status, mac) Builtins.y2error( "Mac address %1 not found in map %2!", mac, link_status ) elsif Ops.get_boolean(link_status, mac, false) == false Builtins.y2warning("Interface with mac %1 is down!", mac) down = true else Builtins.y2debug("Interface with mac %1 is up", mac) end end end down end |
- (Object) main
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File '../../src/modules/Lan.rb', line 36 def main Yast.import "UI" textdomain "network" Yast.import "Arch" Yast.import "DNS" Yast.import "NetHwDetection" Yast.import "Host" Yast.import "Hostname" Yast.import "IP" Yast.import "Map" Yast.import "Mode" Yast.import "NetworkConfig" Yast.import "NetworkInterfaces" Yast.import "NetworkService" Yast.import "Package" Yast.import "ProductFeatures" Yast.import "Routing" Yast.import "Progress" Yast.import "Service" Yast.import "String" Yast.import "Summary" Yast.import "SuSEFirewall4Network" Yast.import "FileUtils" Yast.import "PackageSystem" Yast.import "LanItems" Yast.import "ModuleLoading" Yast.import "Linuxrc" Yast.import "Stage" Yast.import "LanUdevAuto" Yast.import "Label" Yast.include self, "network/complex.rb" Yast.include self, "network/runtime.rb" #------------- # GLOBAL DATA # gui or cli mode @gui = true @write_only = false # Current module information # FIXME: MOD global map Module = $[]; # propose configuration for virtual networks (bridged) ? @virt_net_proposal = nil # autoinstallation: if true, write_only is disabled and the network settings # are applied at once, like during the normal installation. #128810, #168806 # boolean start_immediately = false; # boolean if we do automatic installation in second stage @automatic_configuration = false # ipv6 module @ipv6 = true # Hotplug type ("" if not hot pluggable) # Abort function # return boolean return true if abort @AbortFunction = nil # list of interface names which were recently assigned as a slave to a bond device @bond_autoconf_slaves = [] # Lan::Read (`cache) will do nothing if initialized already. @initialized = false end |
- (Object) Modified
Return a modification status
116 117 118 119 120 121 |
# File '../../src/modules/Lan.rb', line 116 def Modified ret = LanItems.GetModified || DNS.modified || Routing.Modified || NetworkConfig.Modified || NetworkService.Modified ret end |
- (Array) Packages
Returns of packages needed when writing the config
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 |
# File '../../src/modules/Lan.rb', line 1475 def Packages pkgs = [] required = { "types" => { #for wlan require iw instead of wireless-tools (bnc#539669) "wlan" => "iw", "vlan" => "vlan", "br" => "bridge-utils", "tun" => "tunctl", "tap" => "tunctl" }, "options" => { "STARTMODE" => { "ifplugd" => "ifplugd" }, "WIRELESS_AUTH_MODE" => { "psk" => "wpa_supplicant", "eap" => "wpa_supplicant" } } } Builtins.foreach( Convert.convert( Map.Keys(Ops.get_map(required, "types", {})), :from => "list", :to => "list <string>" ) ) do |type| package = Ops.get_string(required, ["types", type], "") if Ops.greater_than(Builtins.size(NetworkInterfaces.List(type)), 0) Builtins.y2milestone( "Network interface type %1 requires package %2", type, package ) if !PackageSystem.Installed(package) pkgs = Builtins.add(pkgs, package) end end end Builtins.foreach( Convert.convert( Map.Keys(Ops.get_map(required, "options", {})), :from => "list", :to => "list <string>" ) ) do |type| Builtins.foreach( Convert.convert( Map.Keys(Ops.get_map(required, ["options", type], {})), :from => "list", :to => "list <string>" ) ) do |option| package = Ops.get_string(required, ["options", type, option], "") if NetworkInterfaces.Locate(type, option) != [] Builtins.y2milestone( "Network interface with options %1, %2 requires package %3", type, option, package ) if !PackageSystem.Installed(package) pkgs = Builtins.add(pkgs, package) end end end end if NetworkService.IsManaged if !PackageSystem.Installed("NetworkManager") pkgs = Builtins.add(pkgs, "NetworkManager") end end deep_copy(pkgs) end |
- (Object) PrepareForAutoinst
1468 1469 1470 1471 1472 |
# File '../../src/modules/Lan.rb', line 1468 def PrepareForAutoinst # ReadInstallInf(); LanItems.ReadHw deep_copy(LanItems.Hardware) end |
- (Object) Propose
Propose a configuration
1335 1336 1337 1338 1339 |
# File '../../src/modules/Lan.rb', line 1335 def Propose NetworkInterfaces.CleanCacheRead LanItems.Read ProposeInterfaces() && ProposeRoutesAndResolver() end |
- (Object) ProposeHostname
Propose the hostname See also DNS::Read
1314 1315 1316 1317 1318 1319 1320 1321 |
# File '../../src/modules/Lan.rb', line 1314 def ProposeHostname if DNS.proposal_valid # the standalone hostname dialog did the job already return false end true end |
- (Object) ProposeInterfaces
Propose interface configuration
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 |
# File '../../src/modules/Lan.rb', line 1237 def ProposeInterfaces Builtins.y2milestone("Hardware=%1", LanItems.Hardware) Builtins.y2milestone("NetworkConfig::Config=%1", NetworkConfig.Config) Builtins.y2milestone("NetworkConfig::DHCP=%1", NetworkConfig.DHCP) # test if we have any virtualization installed if @virt_net_proposal Builtins.y2milestone( "Virtualization [xen|kvm|qemu] detected - will propose virtualization network" ) ProposeVirtualized() else if !LanItems.nm_proposal_valid NetworkService.SetManaged(UseNetworkManager()) LanItems.nm_proposal_valid = true end if NetworkService.IsManaged ProposeNMInterfaces() LanItems.modified = true # #144139 workaround Builtins.y2milestone("NM proposal") return true end end # Something is already configured -> do nothing configured = false Builtins.foreach(LanItems.Items) do |number, lanitem| LanItems.current = number if LanItems.IsCurrentConfigured Builtins.y2milestone("Something already configured: don't propose.") configured = true raise Break end end return false if configured Builtins.foreach(LanItems.Items) do |number, lanitem| if IsNotEmpty( Ops.get_string(Convert.to_map(lanitem), ["hwinfo", "dev_name"], "") ) LanItems.current = number link = Ops.get_boolean( LanItems.getCurrentItem, ["hwinfo", "link"], false ) if Ops.get_string(LanItems.getCurrentItem, ["hwinfo", "type"], "") == "wlan" Builtins.y2warning("Will not propose wlan interfaces") else if !link Builtins.y2warning( "item number %1 has link:false detected", number ) elsif !LanItems.IsCurrentConfigured && link Builtins.y2milestone( "Nothing already configured - start proposing" ) LanItems.ProposeItem raise Break end end end end Builtins.y2milestone("NetworkConfig::Config=%1", NetworkConfig.Config) Builtins.y2milestone("NetworkConfig::DHCP=%1", NetworkConfig.DHCP) true end |
- (Object) ProposeNMInterfaces
Create minimal ifcfgs for the case when NetworkManager is used: NM does not need them but yast2-firewall and SuSEfirewall2 do Avoid existing ifcfg from network installation
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
# File '../../src/modules/Lan.rb', line 1042 def ProposeNMInterfaces Builtins.y2milestone("Minimal ifcfgs for NM") Builtins.foreach(LanItems.Items) do |number, lanitem| if IsNotEmpty( Ops.get_string(Convert.to_map(lanitem), ["hwinfo", "dev_name"], "") ) LanItems.current = number if !LanItems.IsCurrentConfigured Builtins.y2milestone( "Nothing already configured start proposing %1 (NM)", LanItems.getCurrentItem ) LanItems.ProposeItem end end end nil end |
- (Object) ProposeRoutesAndResolver
Propose configuration for routing and resolver
1325 1326 1327 1328 1329 1330 1331 |
# File '../../src/modules/Lan.rb', line 1325 def ProposeRoutesAndResolver if LanItems.bootproto == "static" && LanItems.ipaddr != "" && LanItems.ipaddr != nil ProposeHostname() end true end |
- (Object) ProposeVirtualized
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 |
# File '../../src/modules/Lan.rb', line 1114 def ProposeVirtualized # in case of virtualization use special proposal # collect all interfaces that will be skipped from bridged proposal skipped = IfcfgsToSkipVirtualizedProposal() # first configure all connected unconfigured devices with dhcp (with default parameters) Builtins.foreach(LanItems.Items) do |number, lanitem| if IsNotEmpty( Ops.get_string(Convert.to_map(lanitem), ["hwinfo", "dev_name"], "") ) LanItems.current = number valid = Ops.get_boolean( LanItems.getCurrentItem, ["hwinfo", "link"], false ) == true if !valid Builtins.y2warning("item number %1 has link:false detected", number) else if Ops.get_string(LanItems.getCurrentItem, ["hwinfo", "type"], "") == "wlan" Builtins.y2warning("not proposing WLAN interface") valid = false end end if !LanItems.IsCurrentConfigured && valid && !Builtins.contains( skipped, Ops.get_string( LanItems.getCurrentItem, ["hwinfo", "dev_name"], "" ) ) Builtins.y2milestone("Not configured - start proposing") LanItems.ProposeItem end end end # then each configuration (except bridges) move to the bridge # and add old device name into bridge_ports Builtins.foreach(LanItems.Items) do |current, config| ifcfg = Ops.get_string(LanItems.Items, [current, "ifcfg"], "") if Builtins.contains(skipped, ifcfg) Builtins.y2milestone("Skipping interface %1", ifcfg) next elsif Ops.greater_than(Builtins.size(ifcfg), 0) NetworkInterfaces.Edit(ifcfg) old_config = deep_copy(NetworkInterfaces.Current) Builtins.y2debug("Old Config %1\n%2", ifcfg, old_config) new_ifcfg = Builtins.sformat( "br%1", NetworkInterfaces.GetFreeDevice("br") ) Builtins.y2milestone( "old configuration %1, bridge %2", ifcfg, new_ifcfg ) NetworkInterfaces.Name = new_ifcfg # from bridge interface remove all bonding-related stuff Builtins.foreach(NetworkInterfaces.Current) do |key, value| if Builtins.issubstring(key, "BONDING") Ops.set(NetworkInterfaces.Current, key, nil) end end Ops.set(NetworkInterfaces.Current, "BRIDGE", "yes") Ops.set(NetworkInterfaces.Current, "BRIDGE_PORTS", ifcfg) Ops.set(NetworkInterfaces.Current, "BRIDGE_STP", "off") Ops.set(NetworkInterfaces.Current, "BRIDGE_FORWARDDELAY", "0") # hardcode startmode (bnc#450670), it can't be ifplugd! Ops.set(NetworkInterfaces.Current, "STARTMODE", "auto") # remove description - will be replaced by new (real) one NetworkInterfaces.Current = Builtins.remove( NetworkInterfaces.Current, "NAME" ) # remove ETHTOOLS_OPTIONS as it is useful only for real hardware NetworkInterfaces.Current = Builtins.remove( NetworkInterfaces.Current, "ETHTOOLS_OPTIONS" ) if NetworkInterfaces.Commit NetworkInterfaces.Add NetworkInterfaces.Edit(ifcfg) Ops.set(old_config, "BOOTPROTO", "static") Ops.set(old_config, "IPADDR", "0.0.0.0/32") # remove all aliases (bnc#590167) Builtins.foreach( Ops.get_map(NetworkInterfaces.Current, "_aliases", {}) ) do |a, v| if v != nil NetworkInterfaces.DeleteAlias(NetworkInterfaces.Name, a) end end #take out PREFIXLEN from old configuration (BNC#735109) Ops.set(old_config, "PREFIXLEN", "") Ops.set(old_config, "_aliases", {}) Builtins.y2milestone( "Old Config with apllied changes %1\n%2", ifcfg, old_config ) NetworkInterfaces.Current = deep_copy(old_config) NetworkInterfaces.Commit Ops.set(LanItems.Items, [current, "ifcfg"], new_ifcfg) LanItems.modified = true LanItems.force_restart = true Builtins.y2internal("List %1", NetworkInterfaces.List("")) # re-read configuration to see new items in UI LanItems.Read end else Builtins.y2warning("empty ifcfg") end end nil end |
- (Object) Read(cache)
Read all network settings from the SCR
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File '../../src/modules/Lan.rb', line 282 def Read(cache) if cache == :cache && @initialized Builtins.y2milestone("Using cached data") return true end # Read dialog caption caption = _("Initializing Network Configuration") steps = 9 sl = 0 # 1000; /* TESTING Builtins.sleep(sl) if @gui Progress.New( caption, " ", steps, [ # Progress stage 1/9 _("Detect network devices"), # Progress stage 2/9 _("Read driver information"), # Progress stage 3/9 - multiple devices may be present, really plural _("Read device configuration"), # Progress stage 4/9 _("Read network configuration"), # Progress stage 5/9 _("Read firewall settings"), # Progress stage 6/9 _("Read hostname and DNS configuration"), # Progress stage 7/9 _("Read installation information"), # Progress stage 8/9 _("Read routing configuration"), # Progress stage 9/9 _("Detect current status") ], [], "" ) end return false if Abort() # check the environment # if(!Confirm::MustBeRoot()) return false; return false if Abort() # Progress step 1/9 ProgressNextStage(_("Detecting ndiswrapper...")) if @gui # modprobe ndiswrapper before hwinfo when needed (#343893) if !Mode.autoinst && PackageSystem.Installed("ndiswrapper") Builtins.y2milestone("ndiswrapper: installed") if Ops.greater_than( Builtins.size( Convert.convert( SCR.Read(path(".target.dir"), "/etc/ndiswrapper"), :from => "any", :to => "list <string>" ) ), 0 ) Builtins.y2milestone("ndiswrapper: configuration found") if Convert.to_integer( SCR.Execute(path(".target.bash"), "lsmod |grep -q ndiswrapper") ) != 0 && Popup.YesNo( _( "Detected a ndiswrapper configuration,\n" + "but the kernel module was not modprobed.\n" + "Do you want to modprobe ndiswrapper?\n" ) ) if ModuleLoading.Load("ndiswrapper", "", "", "", false, true) == :fail Popup.Error( _( "ndiswrapper kernel module has not been loaded.\nCheck configuration manually.\n" ) ) end end end end # ReadHardware(""); /* TESTING Builtins.sleep(sl) return false if Abort() # Progress step 2/9 ProgressNextStage(_("Detecting network devices...")) if @gui # Dont read hardware data in config mode NetHwDetection.Start if !Mode.config Builtins.sleep(sl) return false if Abort() # Progress step 3/9 - multiple devices may be present, really plural ProgressNextStage(_("Reading device configuration...")) if @gui LanItems.Read Builtins.sleep(sl) return false if Abort() # Progress step 4/9 ProgressNextStage(_("Reading network configuration...")) if @gui NetworkConfig.Read readIPv6 Builtins.sleep(sl) return false if Abort() # Progress step 5/9 ProgressNextStage(_("Reading firewall settings...")) if @gui orig = Progress.set(false) SuSEFirewall4Network.Read Progress.set(orig) if @gui Builtins.sleep(sl) return false if Abort() # Progress step 6/9 ProgressNextStage(_("Reading hostname and DNS configuration...")) if @gui DNS.Read Host.Read Builtins.sleep(sl) return false if Abort() # Progress step 7/9 ProgressNextStage(_("Reading installation information...")) if @gui # ReadInstallInf(); Builtins.sleep(sl) return false if Abort() # Progress step 8/9 ProgressNextStage(_("Reading routing configuration...")) if @gui Routing.Read Builtins.sleep(sl) return false if Abort() # Progress step 9/9 ProgressNextStage(_("Detecting current status...")) if @gui NetworkService.Read Builtins.sleep(sl) return false if Abort() # Final progress step ProgressNextStage(_("Finished")) if @gui Builtins.sleep(sl) return false if Abort() LanItems.modified = false @initialized = true Progress.Finish if @gui true end |
- (Object) readIPv6
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File '../../src/modules/Lan.rb', line 231 def readIPv6 @ipv6 = true methods = # "module" : $[ # "filelist" : ["ipv6", "50-ipv6.conf"], # "filepath" : "/etc/modprobe.d/", # "regexp" : "^[[:space:]]*(install ipv6 /bin/true)" # ] { "builtin" => { "filelist" => ["sysctl.conf"], "filepath" => "/etc/", "regexp" => "^[[:space:]]*(net.ipv6.conf.all.disable_ipv6)[[:space:]]*=[[:space:]]*1" } } Builtins.foreach(methods) do |which, method| filelist = Ops.get_list(method, "filelist", []) filepath = Ops.get_string(method, "filepath", "") regexp = Ops.get_string(method, "regexp", "") Builtins.foreach(filelist) do |file| filename = Builtins.sformat("%1/%2", filepath, file) if FileUtils.Exists(filename) Builtins.foreach( Builtins.splitstring( Convert.to_string(SCR.Read(path(".target.string"), filename)), "\n" ) ) do |row| if Ops.greater_than( Builtins.size( Builtins.regexptokenize(String.CutBlanks(row), regexp) ), 0 ) Builtins.y2milestone("IPv6 is disabled by '%1' method.", which) @ipv6 = false end end end end end nil end |
- (Object) ReadWithCache
(a specialization used when a parameterless function is needed)
443 444 445 |
# File '../../src/modules/Lan.rb', line 443 def ReadWithCache Read(:cache) end |
- (Object) ReadWithCacheNoGUI
447 448 449 450 |
# File '../../src/modules/Lan.rb', line 447 def ReadWithCacheNoGUI @gui = false ReadWithCache() end |
- (Object) SetIPv6(status)
452 453 454 455 456 457 458 459 460 |
# File '../../src/modules/Lan.rb', line 452 def SetIPv6(status) if @ipv6 != status @ipv6 = status Popup.Warning(_("To apply this change, a reboot is needed.")) LanItems.SetModified end nil end |
- (Object) Summary(mode)
Create a textual summary and a list of unconfigured devices "proposal": for proposal, add links for direct config
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 |
# File '../../src/modules/Lan.rb', line 868 def Summary(mode) split = mode == "split" sum = LanItems.BuildLanOverview # Testing improved summary if mode == "summary" Ops.set( sum, 0, Ops.add( Ops.add(Ops.get_string(sum, 0, ""), DNS.Summary), Routing.Summary ) ) end deep_copy(sum) end |
- (rich text, links) SummaryGeneral
Create a textual summary for the general network settings proposal (NetworkManager + ipv6)
891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
# File '../../src/modules/Lan.rb', line 891 def SummaryGeneral status_nm = nil status_v6 = nil status_virt_net = nil href_nm = nil href_v6 = nil href_virt_net = nil link_nm = nil link_v6 = nil link_virt_net = nil header_nm = _("Network Mode") if NetworkService.IsManaged href_nm = "lan--nm-disable" # network mode: the interfaces are controlled by the user status_nm = _("Interfaces controlled by NetworkManager") # disable NetworkManager applet link_nm = Hyperlink(href_nm, _("Disable NetworkManager")) else href_nm = "lan--nm-enable" # network mode status_nm = _("Traditional network setup with NetControl - ifup") # enable NetworkManager applet # for virtual network proposal (bridged) don't show hyperlink to enable networkmanager link_nm = @virt_net_proposal ? "..." : Hyperlink(href_nm, _("Enable NetworkManager")) end if @ipv6 href_v6 = "ipv6-disable" # ipv6 support is enabled status_v6 = _("Support for IPv6 protocol is enabled") # disable ipv6 support link_v6 = Hyperlink(href_v6, _("Disable IPv6")) else href_v6 = "ipv6-enable" # ipv6 support is disabled status_v6 = _("Support for IPv6 protocol is disabled") # enable ipv6 support link_v6 = Hyperlink(href_v6, _("Enable IPv6")) end # no exception needed for virtualbox* (bnc#648044) http://www.virtualbox.org/manual/ch06.html if PackageSystem.Installed("xen") && !Arch.is_xenU || PackageSystem.Installed("kvm") || PackageSystem.Installed("qemu") if @virt_net_proposal href_virt_net = "virtual-revert" status_virt_net = _( "Proposed bridged configuration for virtual machine network" ) link_virt_net = Hyperlink( href_virt_net, _("Use non-bridged configuration") ) else href_virt_net = "virtual-enable" status_virt_net = _("Proposed non-bridged network configuration") link_virt_net = Hyperlink( href_virt_net, _("Use bridged configuration") ) end end descr = Builtins.sformat( "<ul><li>%1: %2 (%3)</li></ul> \n\t\t\t <ul><li>%4 (%5)</li></ul>", header_nm, status_nm, link_nm, status_v6, link_v6 ) if link_virt_net != nil descr = Builtins.sformat( "%1\n\t\t\t\t\t\t<ul><li>%2 (%3)</li></ul>", descr, status_virt_net, link_virt_net ) end links = [href_nm, href_v6] links = Builtins.add(links, href_virt_net) if href_virt_net != nil [descr, links] end |
- (Object) UseNetworkManager
Uses product info and is subject to installed packages.
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 |
# File '../../src/modules/Lan.rb', line 1008 def UseNetworkManager nm_default = false nm_feature = ProductFeatures.GetStringFeature( "network", "network_manager" ) if nm_feature == "" # compatibility: use the boolean feature # (defaults to false) nm_default = ProductFeatures.GetBooleanFeature( "network", "network_manager_is_default" ) elsif nm_feature == "always" nm_default = true elsif nm_feature == "laptop" nm_default = Arch.is_laptop Builtins.y2milestone("Is a laptop: %1", nm_default) # nm_feature == "never" else nm_default = false end nm_installed = Package.Installed("NetworkManager") Builtins.y2milestone( "NetworkManager wanted: %1, installed: %2", nm_default, nm_installed ) nm_default && nm_installed end |
- (Object) Write
Update the SCR according to network settings
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
# File '../../src/modules/Lan.rb', line 510 def Write Builtins.y2milestone("Writing configuration") # Query modified flag in all components, not just LanItems - DNS, # Routing, NetworkConfig too in order not to discard changes made # outside LanItems (bnc#439235) if !Modified() Builtins.y2milestone("No changes to network setup -> nothing to write") return true end fw_is_installed = SuSEFirewall4Network.IsInstalled # Write dialog caption caption = _("Saving Network Configuration") sl = 0 # 1000; /* TESTING Builtins.sleep(sl) step_labels = [ # Progress stage 2 _("Write drivers information"), # Progress stage 3 - multiple devices may be present,really plural _("Write device configuration"), # Progress stage 4 _("Write network configuration"), # Progress stage 5 _("Write routing configuration"), # Progress stage 6 _("Write hostname and DNS configuration"), # Progress stage 7 _("Set up network services") ] # Progress stage 8 if fw_is_installed step_labels = Builtins.add(step_labels, _("Write firewall settings")) end # Progress stage 9 if !@write_only step_labels = Builtins.add(step_labels, _("Activate network services")) end # Progress stage 10 step_labels = Builtins.add(step_labels, _("Update configuration")) if !NetworkService.IsManaged && !@write_only #(boolean) SCR::Read(.init.scripts.exists, "smpppd") && # Progress stage 11 step_labels = Builtins.add(step_labels, _("Set up smpppd")) end Progress.New( caption, " ", Builtins.size(step_labels), step_labels, [], "" ) return false if Abort() # Progress step 2 ProgressNextStage(_("Writing /etc/modprobe.conf...")) Builtins.sleep(sl) return false if Abort() # Progress step 3 - multiple devices may be present, really plural ProgressNextStage(_("Writing device configuration...")) if !Mode.autoinst && LanUdevAuto.AllowUdevModify LanItems.WriteUdevRules # wait so that ifcfgs written in NetworkInterfaces are newer # (1-second-wise) than netcontrol status files, # and rcnetwork reload actually works (bnc#749365) SCR.Execute(path(".target.bash"), "udevadm settle") Builtins.sleep(1000) end # hack: no "netcard" filter as biosdevname names it diferently (bnc#712232) NetworkInterfaces.Write("") # WriteDevices(); Builtins.sleep(sl) return false if Abort() # Progress step 4 ProgressNextStage(_("Writing network configuration...")) NetworkConfig.Write Builtins.sleep(sl) return false if Abort() # Progress step 5 ProgressNextStage(_("Writing routing configuration...")) orig = Progress.set(false) Routing.Write Progress.set(orig) Builtins.sleep(sl) return false if Abort() # Progress step 6 ProgressNextStage(_("Writing hostname and DNS configuration...")) # write resolv.conf after change from dhcp to static (#327074) # reload/restart network before this to put correct resolv.conf from dhcp-backup orig = Progress.set(false) DNS.Write Host.EnsureHostnameResolvable Host.Write Progress.set(orig) Builtins.sleep(sl) return false if Abort() # Progress step 7 ProgressNextStage(_("Setting up network services...")) NetworkService.EnableDisable writeIPv6 Builtins.sleep(sl) #Show this only if SuSEfirewall is installed if fw_is_installed return false if Abort() # Progress step 8 ProgressNextStage(_("Writing firewall settings...")) orig = Progress.set(false) SuSEFirewall4Network.Write Progress.set(orig) Builtins.sleep(sl) end if !@write_only return false if Abort() # Progress step 9 ProgressNextStage(_("Activating network services...")) # during installation export sysconfig settings into NetworkManager (bnc#433084) if Mode.installation && NetworkService.IsManaged Builtins.y2internal( "Export sysconfig settings into NetworkManager %1", SCR.Execute( path(".target.bash_output"), "/usr/lib/NetworkManager/nm-opensuse-sysconfig-merge --connections" ) ) end Builtins.y2internal("virt_net_proposal %1", @virt_net_proposal) if Stage.cont && @virt_net_proposal == true && (Linuxrc.usessh || Linuxrc.vnc || Linuxrc.display_ip) UI.OpenDialog( Opt(:decorated), HBox( HSpacing(1), HCenter( HSquash( VBox( HCenter( HSquash( VBox( # This is the heading of the popup box Left(Heading(_("Confirm Network Restart"))), VSpacing(0.5), # This is in information message. Next come the # hardware class name (network cards). HVCenter( Label( _( "Because of the bridged network, YaST2 needs to restart the network to apply the settings." ) ) ), VSpacing(0.5) ) ) ), ButtonBox( HWeight( 1, PushButton( Id(:ok), Opt(:default, :okButton), Label.OKButton ) ), # PushButton label HWeight( 1, PushButton( Id(:cancel), Opt(:cancelButton), Label.CancelButton ) ) ), VSpacing(0.2) ) ) ), HSpacing(1) ) ) UI.SetFocus(Id(:ok)) # for autoinstallation popup has timeout 10 seconds (#192181) # timeout for every case (bnc#429562) ret = UI.TimeoutUserInput(10 * 1000) if ret == :ok Builtins.y2internal( "Restarting network because of bridged proposal" ) NetworkService.Restart end UI.CloseDialog # For ssh/vnc installation don't reload/restart network because possibility of IP change (bnc#347482) elsif Stage.cont && (Linuxrc.usessh || Linuxrc.vnc || Linuxrc.display_ip) Builtins.y2milestone( "For ssh or vnc installation don't reload/restart network during installation." ) elsif LanItems.force_restart NetworkService.Restart else NetworkService.ReloadOrRestart end Builtins.sleep(sl) end return false if Abort() # Progress step 10 ProgressNextStage(_("Updating configuration...")) RunSuSEconfig() if !@write_only Builtins.sleep(sl) if !NetworkService.IsManaged && #&& (boolean) SCR::Read(.init.scripts.exists, "smpppd") !@write_only return false if Abort() # Progress step 11 ProgressNextStage(_("Setting up smpppd(8)...")) # takes care of autoinst by itself SetupSMPPPD(false) Builtins.sleep(sl) end if NetworkService.IsManaged network = false timeout = 15 while Ops.greater_than(timeout, 0) if NetworkService.isNetworkRunning network = true break end Builtins.y2milestone("waiting for network ... %1", timeout) Builtins.sleep(1000) timeout = Ops.subtract(timeout, 1) end if !network if @automatic_configuration Builtins.y2error("No network running") else Popup.Error(_("No network running")) end end end # Final progress step ProgressNextStage(_("Finished")) Builtins.sleep(sl) Progress.Finish return false if Abort() true end |
- (Object) writeIPv6
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File '../../src/modules/Lan.rb', line 462 def writeIPv6 # SCR::Write(.target.string, "/etc/modprobe.d/ipv6", sformat("%1install ipv6 /bin/true", ipv6?"#":"")); # uncomment to write to old place (and comment code bellow) # SCR::Write(.target.string, "/etc/modprobe.d/50-ipv6.conf", sformat("%1install ipv6 /bin/true\n", ipv6?"#":"")); filename = "/etc/sysctl.conf" sysctl = Convert.to_string(SCR.Read(path(".target.string"), filename)) sysctl_row = Builtins.sformat( "%1net.ipv6.conf.all.disable_ipv6 = 1", @ipv6 ? "# " : "" ) found = false #size(regexptokenize(sysctl, "(net.ipv6.conf.all.disable_ipv6)"))>0; file = [] Builtins.foreach(Builtins.splitstring(sysctl, "\n")) do |row| if Ops.greater_than( Builtins.size( Builtins.regexptokenize(row, "(net.ipv6.conf.all.disable_ipv6)") ), 0 ) row = sysctl_row found = true end file = Builtins.add(file, row) end file = Builtins.add(file, sysctl_row) if !found SCR.Write( path(".target.string"), filename, Builtins.mergestring(file, "\n") ) SCR.Execute( path(".target.bash"), Builtins.sformat( "sysctl -w net.ipv6.conf.all.disable_ipv6=%1", !@ipv6 ? "1" : "0" ) ) SCR.Write( path(".sysconfig.windowmanager.KDE_USE_IPV6"), @ipv6 ? "yes" : "no" ) nil end |
- (Object) WriteOnly
Only write configuration without starting any init scripts and SuSEconfig
781 782 783 784 785 786 787 788 |
# File '../../src/modules/Lan.rb', line 781 def WriteOnly @write_only = !Ops.get_boolean( LanItems.autoinstall_settings, "start_immediately", false ) Write() end |