Freek
New Member
Since LET is broken beyond repairs, I'm hoping someone can help me out here with the OpenVPN script I am trying to expand. Basically I took this bash script: http://www.putdispenserhere.com/openvpn-debianubuntu-setup-script-for-openvz/ and expanded it with some features.
What I am trying to do is detecting of tun/tap is (properly) enabled on OpenVZ and if not, it'll try to fix it.
Here's what I have:
#Check if TUN/TAP is(properly) enabled on OpenVZ before continuing
echo
echo "############################################"
echo "Checking if TUN/TAP is properly enabled on OpenVZ...."
echo "############################################"
case lscpu in
VT-x )
if [ -c /dev/net/tun ] ;
then echo TUN/TAP is ENABLED
else
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
if [ -c /dev/net/tun ] ; then
echo TUN/TAP was not setup properly, but now it is. Yay
else
echo TUN/TAP looks DISABLED.
echo Please check in SolusVM under 'Settings' if TUN/TAP is Enabled.
echo Quitting....
exit
fi
fi;;
*) echo ;;
esac
The idea behind it is that sometimes TUN/TAP does not get setup properly even if enabled in SolusVM. To fix this, one has to execute the steps described here:
http://wiki.vpslink.com/TUN/TAP_device_with_OpenVPN_or_Hamachi
If the first check fails, it'll try to fix the tun/tap device and check again if it's fixed now.
If so, it'll continue, else it'll quit with an error.
The problem is the nested check is not being executed. Is my nesting wrong or am I making an thinking error here?
Thanks
What I am trying to do is detecting of tun/tap is (properly) enabled on OpenVZ and if not, it'll try to fix it.
Here's what I have:
#Check if TUN/TAP is(properly) enabled on OpenVZ before continuing
echo
echo "############################################"
echo "Checking if TUN/TAP is properly enabled on OpenVZ...."
echo "############################################"
case lscpu in
VT-x )
if [ -c /dev/net/tun ] ;
then echo TUN/TAP is ENABLED
else
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
if [ -c /dev/net/tun ] ; then
echo TUN/TAP was not setup properly, but now it is. Yay
else
echo TUN/TAP looks DISABLED.
echo Please check in SolusVM under 'Settings' if TUN/TAP is Enabled.
echo Quitting....
exit
fi
fi;;
*) echo ;;
esac
The idea behind it is that sometimes TUN/TAP does not get setup properly even if enabled in SolusVM. To fix this, one has to execute the steps described here:
http://wiki.vpslink.com/TUN/TAP_device_with_OpenVPN_or_Hamachi
If the first check fails, it'll try to fix the tun/tap device and check again if it's fixed now.
If so, it'll continue, else it'll quit with an error.
The problem is the nested check is not being executed. Is my nesting wrong or am I making an thinking error here?
Thanks