blob: ab91069f09ce0a2efa1f61c823d5410c7cb45061 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/bash
# auto_network(). taken from setup. edited
# configures network on host system according to installer
# settings if user wishes to do so
# $1 dhcp/fixed
# $2 http proxy (optional. defaults to '')
# $3 ftp proxy (optional. defaults to '')
# TODO: autonetwork must be a wrapper that checks $PROXY_HTTP, $PROXY_FTP and $S_DHCP and calls this function
target_configure_network()
{
[ "$1" != dhcp -a "$1" != fixed ] && die_error "target_configure_network \$1 must be 'dhcp' or 'fixed'"
PROXY_HTTP="$2"
PROXY_FTP="$3"
if [ "$1" = fixed ]; then
sed -i "s#eth0=\"eth0#$INTERFACE=\"$INTERFACE#g" ${var_TARGET_DIR}/etc/rc.conf
sed -i "s# 192.168.0.2 # $IPADDR #g" ${var_TARGET_DIR}/etc/rc.conf
sed -i "s# 255.255.255.0 # $SUBNET #g" ${var_TARGET_DIR}/etc/rc.conf
sed -i "s# 192.168.0.255\"# $BROADCAST\"#g" ${var_TARGET_DIR}/etc/rc.conf
sed -i "s#eth0)#$INTERFACE)#g" ${var_TARGET_DIR}/etc/rc.conf
if [ "$GW" != "" ]; then
sed -i "s#gw 192.168.0.1#gw $GW#g" ${var_TARGET_DIR}/etc/rc.conf
sed -i "s#!gateway#gateway#g" ${var_TARGET_DIR}/etc/rc.conf
fi
echo "nameserver $DNS" >> ${var_TARGET_DIR}/etc/resolv.conf
else
sed -i "s#eth0=\"eth0.*#$INTERFACE=\"dhcp\"#g" ${var_TARGET_DIR}/etc/rc.conf
fi
if [ "$PROXY_HTTP" != "" ]; then
echo "export http_proxy=$PROXY_HTTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh;
chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh
fi
if [ "$PROXY_FTP" != "" ]; then
echo "export ftp_proxy=$PROXY_FTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh;
chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh
fi
}
|