mirror of
https://github.com/pivpn/pivpn.git
synced 2025-04-22 15:20:11 +00:00
Added uninstall and Pi-hole detection
This commit is contained in:
parent
e77f668021
commit
84f90b00a4
9 changed files with 275 additions and 42 deletions
|
@ -19,7 +19,7 @@ backup_openvpn(){
|
|||
cp -r $openvpndir $ovpnsdir $backupdir 2&>1
|
||||
backupzip=$date-pivpnbackup.tgz
|
||||
tar -czf $backupzip -C ${install_home} $backupdir 2&>1
|
||||
echo -e "Backup crated to $install_home/$backupdir/$backupzip \nTo restore the backup, follow instructions at:\nhttps://github.com/pivpn/pivpn/wiki/FAQ#how-can-i-migrate-my-configs-to-another-pivpn-instance"
|
||||
echo -e "Backup crated to $install_home/$backupdir/$backupzip \nTo restore the backup, follow instructions at:\nhttps://github.com/pivpn/pivpn/wiki/FAQ#how-can-i-migrate-my-configs-to-another-pivpn-instance"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ helpFunc() {
|
|||
if [ -z "$HELP_SHOWN" ]; then
|
||||
helpFunc
|
||||
echo
|
||||
echo "HELP_SHOWN=1" >> "$setupVars"
|
||||
echo "HELP_SHOWN=1" >> "$setupVars"
|
||||
fi
|
||||
|
||||
# Parse input arguments
|
||||
|
@ -351,9 +351,9 @@ if [ "$iOS" = "1" ]; then
|
|||
fi
|
||||
|
||||
} > "${NAME}${FILEEXT}"
|
||||
|
||||
|
||||
# Copy the .ovpn profile to the home directory for convenient remote access
|
||||
|
||||
|
||||
printf "========================================================\n"
|
||||
printf "Generating an .ovpn12 file for use with iOS devices\n"
|
||||
printf "Please remember the export password\n"
|
||||
|
|
|
@ -62,7 +62,7 @@ function update {
|
|||
|
||||
function backup {
|
||||
|
||||
$SUDO /opt/pivpn/backup.sh
|
||||
$SUDO /opt/pivpn/backup.sh
|
||||
exit 0
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ fi
|
|||
if [[ -z "${CERTS_TO_REVOKE}" ]]; then
|
||||
printf "\n"
|
||||
printf " ::\e[4m Certificate List \e[0m:: \n"
|
||||
|
||||
|
||||
i=0
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
STATUS=$(echo "$line" | awk '{print $1}')
|
||||
|
@ -61,26 +61,26 @@ if [[ -z "${CERTS_TO_REVOKE}" ]]; then
|
|||
fi
|
||||
done <${INDEX}
|
||||
printf "\n"
|
||||
|
||||
|
||||
echo -n "::: Please enter the Name of the client to be revoked from the list above: "
|
||||
read -r NAME
|
||||
|
||||
|
||||
if [[ -z "${NAME}" ]]; then
|
||||
echo "You can not leave this blank!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
for((x=1;x<=i;++x)); do
|
||||
if [ "${CERTS[$x]}" = "${NAME}" ]; then
|
||||
VALID=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [ -z "${VALID}" ]; then
|
||||
printf "You didn't enter a valid cert name!\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
CERTS_TO_REVOKE=( "${NAME}" )
|
||||
else
|
||||
i=0
|
||||
|
@ -92,7 +92,7 @@ else
|
|||
let i=i+1
|
||||
fi
|
||||
done <${INDEX}
|
||||
|
||||
|
||||
for (( ii = 0; ii < ${#CERTS_TO_REVOKE[@]}; ii++)); do
|
||||
VALID=0
|
||||
for((x=1;x<=i;++x)); do
|
||||
|
@ -100,7 +100,7 @@ else
|
|||
VALID=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [ "${VALID}" != 1 ]; then
|
||||
printf "You passed an invalid cert name: '"%s"'!\n" "${CERTS_TO_REVOKE[ii]}"
|
||||
exit 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#/bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
###Updates pivpn scripts (Not PiVPN)
|
||||
###Main Vars
|
||||
|
@ -11,7 +11,7 @@ bashcompletiondir="/etc/bash_completion.d/pivpn"
|
|||
###Functions
|
||||
##Updates scripts
|
||||
updatepivpnscripts(){
|
||||
##We don't know what sort of changes users have made.
|
||||
##We don't know what sort of changes users have made.
|
||||
##Lets remove first /etc/.pivpn dir then clone it back again
|
||||
echo "going do update PiVPN Scripts"
|
||||
if [[ -d $pivpnlocalpath ]]; then
|
||||
|
@ -25,9 +25,9 @@ updatepivpnscripts(){
|
|||
echo "PiVPN Scripts have been updated"
|
||||
}
|
||||
|
||||
##Updates scripts using test branch
|
||||
##Updates scripts using test branch
|
||||
updatefromtest(){
|
||||
##We don't know what sort of changes users have made.
|
||||
##We don't know what sort of changes users have made.
|
||||
##Lets remove first /etc/.pivpn dir then clone it back again
|
||||
echo "PiVPN Scripts updating from test branch"
|
||||
if [[ -d /etc/.pivpn ]]; then
|
||||
|
@ -89,8 +89,8 @@ else
|
|||
scriptusage
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
updatepivpnscripts
|
||||
* )
|
||||
updatepivpnscripts
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue