wok view vzctl/stuff/slitaz-del_ip.sh @ rev 25791
Up dropbear (2024.86), libssh2 (1.11.1), xz (5.6.3)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Oct 23 13:27:53 2024 +0000 (4 weeks ago) |
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