Contents of /mcore-src/trunk/mcore-tools/src/modules/network/network.control.class.in
Parent Directory | Revision Log
Revision 2755 -
(show annotations)
(download)
Tue Feb 2 14:11:44 2016 UTC (8 years, 3 months ago) by niro
File size: 2455 byte(s)
Tue Feb 2 14:11:44 2016 UTC (8 years, 3 months ago) by niro
File size: 2455 byte(s)
-split firstboot/hardware configuration from hwdetection class to its corresponding module
1 | # $Id$ |
2 | |
3 | push_firstboot 10_network_configuration |
4 | |
5 | push_config 10_network_hostname |
6 | |
7 | help_network_hostname() |
8 | { |
9 | local serial="${CLASS_ARGV[0]}" |
10 | control_client "${serial}" help network.hostname |
11 | |
12 | mecho "get network.hostname" |
13 | mecho " Displays the current hostname" |
14 | mecho |
15 | mecho "set network.hostname [hostname]" |
16 | mecho " Sets the hostname of the system" |
17 | mecho " mcore - the local hostname" |
18 | } |
19 | |
20 | set_network_hostname() |
21 | { |
22 | local serial="${CLASS_ARGV[0]}" |
23 | local value="${CLASS_ARGV[1]}" |
24 | |
25 | import_resource cfg_network "${serial}" hostname "${value}" |
26 | } |
27 | |
28 | control_network_hostname() |
29 | { |
30 | local serial="${CLASS_ARGV[0]}" |
31 | push_config_10_network_hostname "${serial}" |
32 | } |
33 | |
34 | push_config_10_network_hostname() |
35 | { |
36 | local serial="$1" |
37 | local value |
38 | |
39 | value=$(mysqldo "select hostname from cfg_network where serial='${serial}'") |
40 | if [[ -z ${value} ]] || [[ ${value} = NULL ]] |
41 | then |
42 | decho "retval NULL, not running 'control_client '${serial}' set network.hostname '${value}''" |
43 | else |
44 | control_client "${serial}" set network.hostname "${value}" |
45 | fi |
46 | } |
47 | |
48 | push_firstboot_10_network_configuration() |
49 | { |
50 | local serial="$1" |
51 | local netcard_driver |
52 | local networking |
53 | local hostname |
54 | local domain |
55 | |
56 | nsslsay_queue_init |
57 | nsslsay_queue_add "nocolors" |
58 | #nsslsay_queue_add "get hardware.detect driver netcard" |
59 | nsslsay_queue_add "get hardware.detect driver connected-iface" |
60 | netcard_driver=$(control_client "${serial}" run-queue) |
61 | if [[ -n ${netcard_driver} ]] |
62 | then |
63 | decho "netcard_driver='${netcard_driver}'" |
64 | import_resource cfg_network "${serial}" module "${netcard_driver}" |
65 | else |
66 | decho "no netcard_driver found" |
67 | fi |
68 | networking=$(mysqldo "select networking from cfg_network where serial=${serial};") |
69 | if [[ -z ${networking} ]] || [[ ${networking} = NULL ]] |
70 | then |
71 | # set network to dhcp |
72 | decho "networking='dhcp'" |
73 | import_resource cfg_network "${serial}" networking "dhcp" |
74 | fi |
75 | hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};") |
76 | if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]] |
77 | then |
78 | # set hostname to MCORE_DEFAULT_HOSTNAME |
79 | decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" |
80 | import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
81 | fi |
82 | domain=$(mysqldo "select domain from cfg_network where serial=${serial};") |
83 | if [[ -z ${domain} ]] || [[ ${domain} = NULL ]] |
84 | then |
85 | # set domain to MCORE_DEFAULT_DOMAIN |
86 | decho "hostname='${MCORE_DEFAULT_DOMAIN}'" |
87 | import_resource cfg_network "${serial}" domain "${MCORE_DEFAULT_DOMAIN}" |
88 | fi |
89 | } |