Cleanup bugfixes. Move vars to dedicated files
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
stopdls() {
|
||||
if docker ps &>/dev/null | grep -q " $DLS_CTR_NAME$"; then
|
||||
if docker ps | grep -q " $DLS_CTR_NAME$"; then
|
||||
pinfo "Stopping Direktil Local Server..."
|
||||
docker stop $DLS_CTR_NAME
|
||||
fi
|
||||
@ -28,14 +28,20 @@ cleanuppaths() {
|
||||
done
|
||||
}
|
||||
|
||||
cleanupssh() {
|
||||
for host in ${!hosts[*]}; do
|
||||
ssh-keygen -R ${hosts[$host]} &>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
cleanupnetwork() {
|
||||
if iptables -L |grep -q $QEMU_BR_NAME; then
|
||||
if iptables -L -n |grep -q $QEMU_BR_NAME; then
|
||||
pinfo "Cleaning iptables rules..."
|
||||
iptables -t nat -D POSTROUTING -j MASQUERADE -s $QEMU_BR_IP/$QEMU_BR_MASK \! -o $QEMU_BR_NAME
|
||||
iptables -D FORWARD -o $QEMU_BR_NAME -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -D FORWARD -j ACCEPT -i $QEMU_BR_NAME
|
||||
fi
|
||||
if ip li show $QEMU_BR_NAME ; then
|
||||
if ip li show $QEMU_BR_NAME &>/dev/null; then
|
||||
pinfo "Cleaning existing interfaces..."
|
||||
ip li set $QEMU_BR_NAME down
|
||||
ip li del $QEMU_BR_NAME
|
||||
@ -50,3 +56,5 @@ declare -A hosts
|
||||
get_hosts
|
||||
destroyvms
|
||||
cleanuppaths
|
||||
cleanupssh
|
||||
cleanupnetwork
|
||||
|
||||
Reference in New Issue
Block a user