ia64/xen-unstable

view tools/examples/xen-network-common.sh @ 10098:48c0f5489d44

Remove Emacs variables settings from tail of our Linux files.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 18 11:39:03 2006 +0100 (2006-05-18)
parents fbee8d9fbaba
children 45f504d6b548
line source
1 #
2 # Copyright (c) 2005 XenSource Ltd.
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of version 2.1 of the GNU Lesser General Public
6 # License as published by the Free Software Foundation.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 #
19 # On SuSE it is necessary to run a command before transfering addresses and
20 # routes from the physical interface to the virtual. This command creates a
21 # variable $HWD_CONFIG_0 that specifies the appropriate configuration for
22 # ifup.
24 # Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives.
26 # Other platforms just use ifup / ifdown directly.
28 ##
29 # preiftransfer
30 #
31 # @param $1 The current name for the physical device, which is also the name
32 # that the virtual device will take once the physical device has
33 # been renamed.
35 if [ -e /etc/SuSE-release ]
36 then
37 preiftransfer()
38 {
39 eval `/sbin/getcfg -d /etc/sysconfig/network/ -f ifcfg- -- $1`
40 }
41 ifup()
42 {
43 /sbin/ifup ${HWD_CONFIG_0} $1
44 }
45 elif ! which ifup >/dev/null 2>/dev/null
46 then
47 if [ -e /etc/conf.d/net ]
48 then
49 preiftransfer()
50 {
51 true
52 }
53 ifup()
54 {
55 /etc/init.d/net.$1 start
56 }
57 ifdown()
58 {
59 /etc/init.d/net.$1 stop
60 }
61 else
62 preiftransfer()
63 {
64 true
65 }
66 ifup()
67 {
68 false
69 }
70 ifdown()
71 {
72 false
73 }
74 fi
75 else
76 preiftransfer()
77 {
78 true
79 }
80 fi
83 first_file()
84 {
85 t="$1"
86 shift
87 for file in $@
88 do
89 if [ "$t" "$file" ]
90 then
91 echo "$file"
92 return
93 fi
94 done
95 }
97 find_dhcpd_conf_file()
98 {
99 first_file -f /etc/dhcp3/dhcpd.conf /etc/dhcpd.conf
100 }
103 find_dhcpd_init_file()
104 {
105 first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd}
106 }