Contents of /trunk/installer/include/prepare_networking.sh
Parent Directory | Revision Log
Revision 1477 -
(show annotations)
(download)
(as text)
Wed Aug 3 14:07:36 2011 UTC (13 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1940 byte(s)
Wed Aug 3 14:07:36 2011 UTC (13 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1940 byte(s)
-added missing base-files dep, which conains the passwd/group files now
1 | #!/bin/bash |
2 | # $Id$ |
3 | |
4 | : ${INSTALL_ROOT="/mnt/magellan"} |
5 | |
6 | add_network_config() |
7 | { |
8 | local nic="$1" |
9 | shift |
10 | |
11 | echo "$@" >> ${INSTALL_ROOT}/etc/conf.d/net."${nic}" |
12 | } |
13 | |
14 | # create empty file |
15 | :> ${INSTALL_ROOT}/etc/conf.d/net.${NETWORK_NIC} |
16 | |
17 | case ${NETWORK_METHOD} in |
18 | static) |
19 | add_network_config ${NETWORK_NIC} 'ONBOOT="yes"' |
20 | add_network_config ${NETWORK_NIC} 'NETWORKING="static"' |
21 | add_network_config ${NETWORK_NIC} "IP=\"${NETWORK_IP}\"" |
22 | add_network_config ${NETWORK_NIC} "NETMASK=\"${NETWORK_NETMASK}\"" |
23 | add_network_config ${NETWORK_NIC} "BROADCAST=\"${NETWORK_BROADCAST}\"" |
24 | add_network_config ${NETWORK_NIC} "GATEWAY=\"${NETWORK_GATEWAY}\"" |
25 | add_network_config ${NETWORK_NIC} "NAMESERVER=\"${NETWORK_NAMESERVER}\"" |
26 | ;; |
27 | dhcp) |
28 | add_network_config ${NETWORK_NIC} 'ONBOOT="yes"' |
29 | add_network_config ${NETWORK_NIC} 'NETWORKING="dhcp"' |
30 | # add this only if no default networking was found which is provided by newer initscripts |
31 | if [[ ! -f ${INSTALL_ROOT}/conf.d/network ]] |
32 | then |
33 | add_network_config ${NETWORK_NIC} 'DHCP_PROG="/sbin/dhcpcd"' |
34 | add_network_config ${NETWORK_NIC} 'DHCP_START="-t 10"' |
35 | add_network_config ${NETWORK_NIC} 'DHCP_STOP="-k"' |
36 | fi |
37 | ;; |
38 | none) |
39 | add_network_config ${NETWORK_NIC} 'ONBOOT="no"' |
40 | ;; |
41 | esac |
42 | |
43 | echo "${NETWORK_HOSTNAME}" > ${INSTALL_ROOT}/etc/hostname |
44 | # setup head file with the right domainname for resolv.conf |
45 | echo "domain ${NETWORK_DOMAIN}" > ${INSTALL_ROOT}/etc/resolv.conf.head |
46 | |
47 | if [[ ${NETWORK_METHOD} = static ]] |
48 | then |
49 | # the 'a' in the sed line appends a line after the regex (127.0.0.1.*localhost) (really needed?) |
50 | sed -i "/127.0.0.1.*localhost/ a \${NETWORK_IP}\t${NETWORK_HOSTNAME}.${NETWORK_DOMAIN}\t${NETWORK_HOSTNAME}" ${INSTALL_ROOT}/etc/hosts |
51 | else |
52 | # the 'a' in the sed line appends a line after the regex (127.0.0.1.*localhost) (really needed?) |
53 | sed -i "/127.0.0.1.*localhost/ a \127.0.0.1\t${NETWORK_HOSTNAME}.${NETWORK_DOMAIN}\t${NETWORK_HOSTNAME}" ${INSTALL_ROOT}/etc/hosts |
54 | fi |
Properties
Name | Value |
---|---|
svn:executable | * |