wok-current diff vzctl/stuff/slitaz-del_ip.sh @ rev 8972
Up iproute2 (2.6.37)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Mar 02 10:32:40 2011 +0100 (2011-03-02) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/vzctl/stuff/slitaz-del_ip.sh Wed Mar 02 10:32:40 2011 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +#!/bin/bash 1.5 +# Deletes IP address from a container running SliTaz distro. 1.6 +# 1.7 +# This program is free software; you can redistribute it and/or modify 1.8 +# it under the terms of the GNU General Public License as published by 1.9 +# the Free Software Foundation; either version 2 of the License, or 1.10 +# (at your option) any later version. 1.11 +# 1.12 +# This program is distributed in the hope that it will be useful, 1.13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of 1.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.15 +# GNU General Public License for more details. 1.16 +# 1.17 +# You should have received a copy of the GNU General Public License 1.18 +# along with this program; if not, write to the Free Software 1.19 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1.20 +# 1.21 +# Copyright (C) 2011 Eric Joseph-Alexandre <erjo@slitaz.org> 1.22 + 1.23 + 1.24 +VENET_DEV=eth0 1.25 +CFGFILE=/etc/network.conf 1.26 + 1.27 +# Function to delete IP address 1.28 +function del_ip() 1.29 +{ 1.30 + if grep -q ${IP_ADDR} ${CFGFILE}; then 1.31 + sed -i 's/^IP.*/IP=\"0\"/' ${CFGFILE} 1.32 + fi 1.33 + 1.34 + # Shutting down $VENET_DEV if CT is running. 1.35 + if [ "$VE_STATE" = "running" ]; then 1.36 + /sbin/ifconfig ${VENET_DEV} down 1.37 + fi 1.38 +} 1.39 + 1.40 +del_ip 1.41 + 1.42 +exit 0