summaryrefslogtreecommitdiffstats
path: root/PCBSD/pc-sysinstall/backend-query/.svn/text-base/enable-net.sh.svn-base
blob: ca3115d0e2a9872bd5831fc890e08a7f67e8b7ed (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/sh
# Script which enables networking with specified options
###########################################################################

. ${PROGDIR}/backend/functions.sh
. ${PROGDIR}/conf/pc-sysinstall.conf
. ${BACKEND}/functions-networking.sh
. ${BACKEND}/functions-parse.sh


NIC="$1"
IP="$2"
NETMASK="$3"
DNS="$4"
GATEWAY="$5"
MIRRORFETCH="$6"

if [ -z "${NIC}" ]
then
  echo "ERROR: Usage enable-net <nic> <ip> <netmask> <dns> <gateway>"
  exit 150
fi

if [ "$NIC" = "AUTO-DHCP" ]
then
  enable_auto_dhcp
else
  echo "Enabling NIC: $NIC"
  ifconfig ${NIC} ${IP} ${NETMASK}

  echo "nameserver ${DNS}" >/etc/resolv.conf

  route add default ${GATE}
fi

case ${MIRRORFETCH} in
   ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;;
   *) ;;
esac
OpenPOWER on IntegriCloud