blob: 9766deacde99aa556e011dc96d3bb3672dd7afdb [file] [log] [blame] [raw]
#!/bin/sh
# Copyright (C) 2000-2007 SWsoft. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
VZNETCFG='@PKGCONFDIR@/vznet.conf'
[ -f "$VZNETCFG" ] && source "$VZNETCFG"
usage()
{
echo >&2 "vznetcfg init veth <dev>"
}
init_veth()
{
local dev="$1"
ip link set "$dev" up
}
# Call the external script if defined
if [ -n "$EXTERNAL_SCRIPT" -a -x "$EXTERNAL_SCRIPT" ]; then
export VEID
exec "$EXTERNAL_SCRIPT" $@
fi
if test $# -le 2; then
usage
exit 0
fi
CMD="$1"
case "$CMD$2" in
initveth)
if test $# -ne 3; then
usage
exit 1
fi
init_veth "$3"
;;
*)
echo "invalid action"
exit 1
;;
esac
exit 0