wok-current view vzctl/stuff/slitaz-del_ip.sh @ rev 18056

Up: cookutils, cookutils-daemon (737).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri May 15 16:51:30 2015 +0300 (2015-05-15)
parents
children
line source
1 #!/bin/bash
2 # Deletes IP address from a container running SliTaz distro.
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 # Copyright (C) 2011 Eric Joseph-Alexandre <erjo@slitaz.org>
21 VENET_DEV=eth0
22 CFGFILE=/etc/network.conf
24 # Function to delete IP address
25 function del_ip()
26 {
27 if grep -q ${IP_ADDR} ${CFGFILE}; then
28 sed -i 's/^IP.*/IP=\"0\"/' ${CFGFILE}
29 fi
31 # Shutting down $VENET_DEV if CT is running.
32 if [ "$VE_STATE" = "running" ]; then
33 /sbin/ifconfig ${VENET_DEV} down
34 fi
35 }
37 del_ip
39 exit 0