~ubuntu-branches/ubuntu/lucid/vzctl/lucid

« back to all changes in this revision

Viewing changes to bin/vznetcfg.in

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2008-01-27 10:24:49 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080127102449-ivjpirh4dyshc0cl
Tags: 3.0.22-3
Correction for #459717. Thanks to eyck <eyck.debian@kuszelas.eu> for the
report.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
 
1
#!/bin/sh
2
2
#  Copyright (C) 2000-2007 SWsoft. All rights reserved.
3
3
#
4
4
#  This program is free software; you can redistribute it and/or modify
15
15
#  along with this program; if not, write to the Free Software
16
16
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
#
18
 
VZNETCFG=@PKGCONFDIR@/vznet.conf
19
 
 
20
 
[ -f ${VZNETCFG} ] && source ${VZNETCFG}
21
 
 
22
 
function usage()
23
 
{
24
 
        echo "vznetcfg init veth <dev>"
25
 
}
26
 
 
27
 
function init_veth()
28
 
{
29
 
        local dev=$1
30
 
 
31
 
        /sbin/ifconfig ${dev} up
32
 
}
 
18
VZNETCFG='@PKGCONFDIR@/vznet.conf'
 
19
 
 
20
[ -f "$VZNETCFG" ] && source "$VZNETCFG"
 
21
 
 
22
usage()
 
23
{
 
24
        echo >&2 "vznetcfg init veth <dev>"
 
25
}
 
26
 
 
27
init_veth()
 
28
{
 
29
        local dev="$1"
 
30
 
 
31
        ip link set "$dev" up
 
32
}
 
33
 
33
34
# Call the external script if defined
34
 
if [ -n "${EXTERNAL_SCRIPT}" -a -x "${EXTERNAL_SCRIPT}" ]; then
 
35
if [ -n "$EXTERNAL_SCRIPT" -a -x "$EXTERNAL_SCRIPT" ]; then
35
36
        export VEID
36
 
        exec ${EXTERNAL_SCRIPT} $@
 
37
        exec "$EXTERNAL_SCRIPT" $@
37
38
fi
38
39
 
39
40
if test $# -le 2; then
41
42
    exit 0
42
43
fi
43
44
 
44
 
CMD=$1
45
 
case "${CMD}$2" in
 
45
CMD="$1"
 
46
case "$CMD$2" in
46
47
        initveth)
47
48
                if test $# -ne 3; then
48
49
                        usage
49
50
                        exit 1
50
51
                fi
51
 
                init_veth $3
 
52
                init_veth "$3"
52
53
                ;;
53
54
        *)
54
55
                echo "invalid action"