Contents of /trunk/installer/include/prepare_networking.sh
Parent Directory | Revision Log
Revision 773 -
(show annotations)
(download)
(as text)
Wed Sep 24 10:54:00 2008 UTC (16 years ago) by niro
File MIME type: application/x-sh
File size: 1528 byte(s)
Wed Sep 24 10:54:00 2008 UTC (16 years ago) by niro
File MIME type: application/x-sh
File size: 1528 byte(s)
-moved helper-scripts into include/ directory
1 | #!/bin/bash |
2 | |
3 | : ${INSTALL_ROOT="/mnt/magellan"} |
4 | |
5 | add_network_config() |
6 | { |
7 | local nic="$1" |
8 | shift |
9 | |
10 | echo "$@" >> ${INSTALL_ROOT}/etc/conf.d/net."${nic}" |
11 | } |
12 | |
13 | # create empty file |
14 | :> ${INSTALL_ROOT}/etc/conf.d/net.${NETWORK_NIC} |
15 | |
16 | case ${NETWORK_METHOD} in |
17 | static) |
18 | add_network_config ${NETWORK_NIC} 'ONBOOT="yes"' |
19 | add_network_config ${NETWORK_NIC} 'NETWORKING="static"' |
20 | add_network_config ${NETWORK_NIC} "IP=\"${NETWORK_IP}\"" |
21 | add_network_config ${NETWORK_NIC} "NETMASK=\"${NETWORK_NETMASK}\"" |
22 | add_network_config ${NETWORK_NIC} "BROADCAST=\"${NETWORK_BROADCAST}\"" |
23 | add_network_config ${NETWORK_NIC} "GATEWAY=\"${NETWORK_GATEWAY}\"" |
24 | add_network_config ${NETWORK_NIC} "NAMESERVER=\"${NETWORK_NAMESERVER}\"" |
25 | ;; |
26 | dhcp) |
27 | add_network_config ${NETWORK_NIC} 'ONBOOT="yes"' |
28 | add_network_config ${NETWORK_NIC} 'NETWORKING="dhcp"' |
29 | add_network_config ${NETWORK_NIC} 'DHCP_PROG="/sbin/dhcpcd"' |
30 | add_network_config ${NETWORK_NIC} 'DHCP_START="-t 10"' |
31 | add_network_config ${NETWORK_NIC} 'DHCP_STOP="-k"' |
32 | ;; |
33 | none) |
34 | add_network_config ${NETWORK_NIC} 'ONBOOT="no"' |
35 | ;; |
36 | esac |
37 | |
38 | echo "${NETWORK_HOSTNAME}" > ${INSTALL_ROOT}/etc/hostname |
39 | |
40 | if [[ ${NETWORK_METHOD} = static ]] |
41 | then |
42 | # the 'a' in the sed line appends a line after the regex (127.0.0.1.*localhost) |
43 | sed -i "/127.0.0.1.*localhost/ a \${NETWORK_IP}\t${NETWORK_HOSTNAME}.${NETWORK_DOMAIN}\t${NETWORK_HOSTNAME}" ${INSTALL_ROOT}/etc/hosts |
44 | else |
45 | sed -i "s:^\(127.0.0.1.*localhost\):\1\t${NETWORK_HOSTNAME}.${NETWORK_DOMAIN}\t${NETWORK_HOSTNAME}" ${INSTALL_ROOT}/etc/hosts |
46 | fi |
Properties
Name | Value |
---|---|
svn:executable | * |