]> git.pld-linux.org Git - packages/vzctl.git/blob - pld-del_ip.sh
- x32 rebuild
[packages/vzctl.git] / pld-del_ip.sh
1 #!/bin/bash
2 #  Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
3 #
4 #  This program is free software; you can redistribute it and/or modify
5 #  it under the terms of the GNU General Public License as published by
6 #  the Free Software Foundation; either version 2 of the License, or
7 #  (at your option) any later version.
8 #
9 #  This program is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #  GNU General Public License for more details.
13 #
14 #  You should have received a copy of the GNU General Public License
15 #  along with this program; if not, write to the Free Software
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 #
18 #
19 # Deletes IP address(es) from a container running SuSE.
20
21 VENET_DEV=venet0
22 IFCFG_DIR=/etc/sysconfig/interfaces/
23 IFCFG="${IFCFG_DIR}/ifcfg-${VENET_DEV}"
24
25 function del_ip()
26 {
27         local ipm ids id
28
29         if [ "x${IPDELALL}" = "xyes" ]; then
30                 ifdown ${VENET_DEV} 2>/dev/null
31                 rm -f ${IFCFG} 2>/dev/null
32                 return
33         fi
34         for ipm in ${IP_ADDR}; do
35                 ip_conv $ipm
36                 ids=`grep -E "^IPADDR.*=${_IP}$" ${IFCFG} 2>/dev/null |
37                         sed 's/^IPADDR\(.*\)=.*/\1/'`
38                 for id in ${ids}; do
39                         sed -e "/^IPADDR${id}=/ d " < ${IFCFG} > ${IFCFG}.bak && mv -f ${IFCFG}.bak ${IFCFG}
40                         #ifconfig ${VENET_DEV}:${id} down 2>/dev/null
41                         ip addr del ${IP_ADDR} dev ${VENET_DEV} 2>/dev/null
42                 done
43         done
44 }
45
46 del_ip
47
48 exit 0
49 # end of script
This page took 0.091591 seconds and 3 git commands to generate.