Deleted Added
full compact
functions-networking.sh (209552) functions-networking.sh (211730)
1#!/bin/sh
2#-
3# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
1#!/bin/sh
2#-
3# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-networking.sh 209552 2010-06-27 16:46:11Z imp $
26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-networking.sh 211730 2010-08-24 06:11:46Z imp $
27
28# Functions which perform our networking setup
29
30# Function which creates a kde4 .desktop file for the PC-BSD net tray
31create_desktop_nettray()
32{
33 NIC="${1}"
34 echo "#!/usr/bin/env xdg-open

--- 28 unchanged lines hidden (view full) ---

63 if [ -e "${TMPDIR}/.niclist" ]
64 then
65 while read line
66 do
67 NIC="`echo $line | cut -d ':' -f 1`"
68 check_is_wifi ${NIC}
69 if [ "$?" != "0" ]
70 then
27
28# Functions which perform our networking setup
29
30# Function which creates a kde4 .desktop file for the PC-BSD net tray
31create_desktop_nettray()
32{
33 NIC="${1}"
34 echo "#!/usr/bin/env xdg-open

--- 28 unchanged lines hidden (view full) ---

63 if [ -e "${TMPDIR}/.niclist" ]
64 then
65 while read line
66 do
67 NIC="`echo $line | cut -d ':' -f 1`"
68 check_is_wifi ${NIC}
69 if [ "$?" != "0" ]
70 then
71 VAL="${NIC}" ; export VAL
72 return
71 VAL="${NIC}" ; export VAL
72 return
73 fi
74 done < ${TMPDIR}/.niclist
75 fi
76
77 VAL="" ; export VAL
78 return
79};
80

--- 155 unchanged lines hidden (view full) ---

236 ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
237 while read line
238 do
239 NIC="`echo $line | cut -d ':' -f 1`"
240 DESC="`echo $line | cut -d ':' -f 2`"
241
242 is_nic_active "${NIC}"
243 if [ "$?" = "0" ] ; then
73 fi
74 done < ${TMPDIR}/.niclist
75 fi
76
77 VAL="" ; export VAL
78 return
79};
80

--- 155 unchanged lines hidden (view full) ---

236 ${QUERYDIR}/detect-nics.sh > ${TMPDIR}/.niclist
237 while read line
238 do
239 NIC="`echo $line | cut -d ':' -f 1`"
240 DESC="`echo $line | cut -d ':' -f 2`"
241
242 is_nic_active "${NIC}"
243 if [ "$?" = "0" ] ; then
244 echo_log "Trying DHCP on $NIC $DESC"
245 dhclient ${NIC} >/dev/null 2>/dev/null
246 if [ "$?" = "0" ] ; then
247 # Got a valid DHCP IP, we can return now
248 WRKNIC="$NIC" ; export WRKNIC
249 return 0
250 fi
244 echo_log "Trying DHCP on $NIC $DESC"
245 dhclient ${NIC} >/dev/null 2>/dev/null
246 if [ "$?" = "0" ] ; then
247 # Got a valid DHCP IP, we can return now
248 WRKNIC="$NIC" ; export WRKNIC
249 return 0
250 fi
251 fi
252 done < ${TMPDIR}/.niclist
253
254};
255
256# Get the mac address of a target NIC
251 fi
252 done < ${TMPDIR}/.niclist
253
254};
255
256# Get the mac address of a target NIC
257get_nic_mac() {
258 FOUNDMAC="`ifconfig ${1} | grep 'ether' | tr -d '\t' | cut -d ' ' -f 2`"
259 export FOUNDMAC
257get_nic_mac()
258{
259 FOUNDMAC="`ifconfig ${1} | grep 'ether' | tr -d '\t' | cut -d ' ' -f 2`"
260 export FOUNDMAC
260}
261
262# Function which performs the manual setup of a target nic in the cfg
263enable_manual_nic()
264{
265 # Get the target nic
266 NIC="$1"
267

--- 89 unchanged lines hidden ---
261}
262
263# Function which performs the manual setup of a target nic in the cfg
264enable_manual_nic()
265{
266 # Get the target nic
267 NIC="$1"
268

--- 89 unchanged lines hidden ---