2 #----------------------------------------------------
3 #shell used to assign/remove route needed by
4 #a container when container is started or stopped
6 #----------------------------------------------------
8 #vzgot.net VE_name assign|remove [base_dir]
9 # VE_name is the container dir name
10 # "assign" to set container needed route
11 # "remove" to reset container needed route
12 # base_dir is this application root directory
13 # used for devel only.
14 #----------------------------------------------------
18 #----------------------------------------------------
19 if ! [ -f $BASE/etc/vzgot/vzgot_config ] ; then
20 echo "Missing vzgot config file"
21 exit 1 #trouble trouble
23 . $BASE/etc/vzgot/vzgot_config
25 #specific container configuration override (if needed)
26 if [ -f $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config ] ; then
27 $BASE/$VZLIB/vzdir/$CONTNAME/vzgot_config
29 #----------------------------------------------------
31 if [ -f $VZLIB/vzdir/$CONTNAME/linux ] ; then
32 FLINUX=`cat $VZLIB/vzdir/$CONTNAME/linux`
35 #lets prepare all routing according type of linux
36 #RedHat beeing the default
40 NETINFO="$BASE/$VZLIB/vzdir/$CONTNAME/rootfs/etc/sysconfig/network-scripts"
41 for f in $NETINFO/ifcfg-*
43 EXT=`basename $f | cut -d'-' -f2`
45 "lo" ) #local interface, nothing to do
48 ADDR=`grep IPADDR $f | cut -d'=' -f2`
51 #pre-emptive route assignation
52 /sbin/route add $ADDR dev $BRIDGENAME
55 /sbin/route del $ADDR dev $BRIDGENAME
58 echo "ACTION request '$ACTION' is unexpected!"
67 NETINFO="$BASE/$VZLIB/vzdir/$CONTNAME/rootfs/etc/network"
68 for ADDR in `grep address $NETINFO/interfaces | cut -d' ' -f2`
72 #pre-emptive route assignation
73 /sbin/route add $ADDR dev $BRIDGENAME
76 /sbin/route del $ADDR dev $BRIDGENAME
79 echo "ACTION request '$ACTION' is unexpected!"
85 #----------------------------------------------------