summaryrefslogblamecommitdiffstats
path: root/src/os-plugins/plugins/qemukvm/files/ifdown
blob: a79c0edc5e1d5b324f15385e8635fc2d4531a3ef (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
         
                                       












                                                                               


                                      

                                                                            


                             
#!/bin/sh
# Copyright (c) 2009..11 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# ifdown
#    - Script used for network cleanup of qemukvm in stage4
# -----------------------------------------------------------------------------

# get VM_ID through tap name
VM_ID=$(echo $1 | grep -oE "0[0-4]$")
QKTMPDIR=/tmp/qemukvm/${USER}/${VM_ID}
sudo /opt/openslx/rootfs/bin/kill -9 $(cat ${QKTMPDIR}/udhcpd.pid) || exit 0
sudo /opt/openslx/rootfs/bin/ip link set dev $1 down || exit 0

# Produce a clean exit status
exit 0