Add qemu ifup/ifdown scripts
This commit is contained in:
parent
c4f7ca2241
commit
ab4841031d
4 changed files with 73 additions and 0 deletions
22
scripts/qemu-custom-ifdown
Executable file
22
scripts/qemu-custom-ifdown
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
# This script removes the specified interface if it exists
|
||||
|
||||
if [[ $EUID != 0 ]]; then
|
||||
echo "This script needs sudo priveleges"
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for INT in $(ls /sys/class/net); do
|
||||
if [[ $INT == $1 ]]; then
|
||||
/sbin/ip link delete dev $1 type tap
|
||||
DELETED=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ !$DELETED ]]; then
|
||||
echo "Interface $1 not found, nothing to delete"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue