Advertisement
dimmuboy

vpn

Nov 15th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.80 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. MYDIR="$HOME/.config/openvpn/"
  4. RUNNOW="$@"
  5.  
  6. if [ -z $RUNNOW ]; then
  7.   DIRS=`ls -l $MYDIR | egrep '^d' | awk '{print $9}'`
  8.   for DIR in $DIRS
  9.   do
  10.     RADIOLIST=$RADIOLIST" $DIR $DIR"
  11.   done
  12.  
  13.   pocet=`echo $DIRS |wc -w`
  14.   #whiptail --title "Test Menu Dialog" --menu "Choose your option" 40 60 30 ${RADIOLIST}
  15.  
  16.   vyska=`tput lines`
  17.   let "vyska -= 5"
  18.  
  19.   OPTION=$(dialog --clear --backtitle "OpenVPN Manager" --title "OpenVPN List" --cancel-label "Exit" --menu "Select one:" $vyska 70 $vyska ${RADIOLIST} 3>&1 1>&2 2>&3)
  20.    
  21.   exitstatus=$?
  22.   if [ $exitstatus = 0 ]; then
  23.       echo "Your chosen option:" $OPTION
  24.       cesta=$MYDIR$OPTION
  25.     echo $cesta
  26.     cd $cesta
  27.     sudo openvpn *.ovpn
  28.   else
  29.     clear
  30.   fi
  31. else
  32.   cd $MYDIR/$RUNNOW
  33.   sudo openvpn conf.ovpn >/dev/null
  34. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement