Update the unisntall script, OK.

This commit is contained in:
Stephen KINGER 2016-09-27 14:31:41 +02:00
parent a7c9a35352
commit e541fd39ac
2 changed files with 10 additions and 9 deletions

View file

@ -476,13 +476,11 @@ update_repo() {
} }
setCustomProto() { setCustomProto() {
# Turn the available interfaces into an array so it can be used with a whiptail dialog # Set the available protocols into an array so it can be used with a whiptail dialog
protoArray=() protoArray=()
protoArray+=("udp" "available" "ON") protoArray+=("udp" "available" "ON")
protoArray+=("tcp" "available" "OFF") protoArray+=("tcp" "available" "OFF")
# Find out how many interfaces are available to choose from
chooseProtoCmd=(whiptail --separate-output --radiolist "Choose A Protocol" $r $c 2) chooseProtoCmd=(whiptail --separate-output --radiolist "Choose A Protocol" $r $c 2)
echo "${chooseProtoCmd[@]}" "${protoArray[@]}" echo "${chooseProtoCmd[@]}" "${protoArray[@]}"
chooseProtoOptions=$("${chooseProtoCmd[@]}" "${protoArray[@]}" 2>&1 >/dev/tty) chooseProtoOptions=$("${chooseProtoCmd[@]}" "${protoArray[@]}" 2>&1 >/dev/tty)
@ -763,6 +761,7 @@ confOpenVPN() {
$SUDO sed -i "s/1194/${PORT}/g" /etc/openvpn/server.conf $SUDO sed -i "s/1194/${PORT}/g" /etc/openvpn/server.conf
fi fi
# if they modified protocol put value in server.conf
if [ $PROTO != "udp" ]; then if [ $PROTO != "udp" ]; then
$SUDO sed -i "s/proto udp/proto tcp/g" /etc/openvpn/server.conf $SUDO sed -i "s/proto udp/proto tcp/g" /etc/openvpn/server.conf
fi fi
@ -886,6 +885,7 @@ confOVPN() {
$SUDO sed -i -e "s/1194/${PORT}/g" /etc/openvpn/easy-rsa/keys/Default.txt $SUDO sed -i -e "s/1194/${PORT}/g" /etc/openvpn/easy-rsa/keys/Default.txt
fi fi
# if they modified protocol put value in Default.txt for clients to use
if [ $PROTO != "udp" ]; then if [ $PROTO != "udp" ]; then
$SUDO sed -i -e "s/proto udp/proto tcp/g" /etc/openvpn/easy-rsa/keys/Default.txt $SUDO sed -i -e "s/proto udp/proto tcp/g" /etc/openvpn/easy-rsa/keys/Default.txt
fi fi

View file

@ -20,6 +20,7 @@ INSTALL_USER=$(cat /etc/pivpn/INSTALL_USER)
PLAT=$(cat /etc/pivpn/DET_PLATFORM) PLAT=$(cat /etc/pivpn/DET_PLATFORM)
NO_UFW=$(cat /etc/pivpn/NO_UFW) NO_UFW=$(cat /etc/pivpn/NO_UFW)
PORT=$(cat /etc/pivpn/INSTALL_PORT) PORT=$(cat /etc/pivpn/INSTALL_PORT)
PROTO=$(cat /etc/pivpn/INSTALL_PROTO)
# Find the rows and columns # Find the rows and columns
rows=$(tput lines) rows=$(tput lines)
@ -53,7 +54,7 @@ echo ":::"
while true; do while true; do
read -rp "::: Do you wish to remove $i from your system? [y/n]: " yn read -rp "::: Do you wish to remove $i from your system? [y/n]: " yn
case $yn in case $yn in
[Yy]* ) printf ":::\tRemoving %s..." "$i"; $SUDO apt-get -y remove --purge "$i" &> /dev/null & spinner $!; printf "done!\n"; [Yy]* ) printf ":::\tRemoving %s..." "$i"; $SUDO apt-get -y remove --purge "$i" &> /dev/null & spinner $!; printf "done!\n";
if [ "$i" == "openvpn" ]; then UINST_OVPN=1 ; fi if [ "$i" == "openvpn" ]; then UINST_OVPN=1 ; fi
if [ "$i" == "unattended-upgrades" ]; then UINST_UNATTUPG=1 ; fi if [ "$i" == "unattended-upgrades" ]; then UINST_UNATTUPG=1 ; fi
break;; break;;
@ -100,15 +101,15 @@ echo ":::"
# Disable IPv4 forwarding # Disable IPv4 forwarding
sed -i '/net.ipv4.ip_forward=1/c\#net.ipv4.ip_forward=1' /etc/sysctl.conf sed -i '/net.ipv4.ip_forward=1/c\#net.ipv4.ip_forward=1' /etc/sysctl.conf
sysctl -p sysctl -p
if [[ $NO_UFW -eq 0 ]]; then if [[ $NO_UFW -eq 0 ]]; then
$SUDO sed -i "s/\(DEFAULT_FORWARD_POLICY=\).*/\1\"DROP\"/" /etc/default/ufw $SUDO sed -i "s/\(DEFAULT_FORWARD_POLICY=\).*/\1\"DROP\"/" /etc/default/ufw
$SUDO sed -i '/START OPENVPN RULES/,/END OPENVPN RULES/ d' /etc/ufw/before.rules $SUDO sed -i '/START OPENVPN RULES/,/END OPENVPN RULES/ d' /etc/ufw/before.rules
$SUDO ufw delete allow from 10.8.0.0/24 >/dev/null $SUDO ufw delete allow from 10.8.0.0/24 >/dev/null
$SUDO ufw delete allow ${PORT}/udp >/dev/null $SUDO ufw delete allow ${PORT}/${PROTO} >/dev/null
$SUDO ufw reload $SUDO ufw reload
fi fi
echo ":::" echo ":::"
printf "::: Finished removing PiVPN from your system.\n" printf "::: Finished removing PiVPN from your system.\n"
printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L https://install.pivpn.io | bash\n:::\n::: at any time!\n:::\n" printf "::: Reinstall by simpling running\n:::\n:::\tcurl -L https://install.pivpn.io | bash\n:::\n::: at any time!\n:::\n"
@ -132,7 +133,7 @@ while true; do
read -rp "::: Do you wish to completely remove PiVPN configuration and installed packages from your system? (You will be prompted for each package) [y/n]: " yn read -rp "::: Do you wish to completely remove PiVPN configuration and installed packages from your system? (You will be prompted for each package) [y/n]: " yn
case $yn in case $yn in
[Yy]* ) removeAll; askreboot; break;; [Yy]* ) removeAll; askreboot; break;;
[Nn]* ) printf "::: Not removing anything, exiting...\n"; break;; [Nn]* ) printf "::: Not removing anything, exiting...\n"; break;;
esac esac
done done