mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
Updates and improvements
install.sh installScripts function: update script not being copied over to /opt therefore update funcion was probably broken. changed script to copy all .sh scripts from .pivpn/scripts directory. Issue #871: fix backup script I was probably very drunk when i first wrote this backup script. fixed it, now works with new code refactoring, loads vars from setupVars Added backup for wireguard Moved script to global pivpnscripts. Added backup script to bash-completion Added backup script to pivpn script update.sh Commented the update from master branch to avoid users trying to update test from master. Updated LatestChages.md
This commit is contained in:
parent
8096af7ad0
commit
dd6bb069f0
6 changed files with 46 additions and 43 deletions
|
@ -5,6 +5,31 @@ patch release notes.
|
|||
|
||||
Everytime Test branch is merged into master, a new entry should be created with the date and changes being merged.
|
||||
|
||||
## Jan 8th 2020
|
||||
|
||||
Updates and improvements
|
||||
Issue #871: fix backup script
|
||||
|
||||
install.sh
|
||||
installScripts function:
|
||||
update script not being copied over to /opt therefore update funcion was probably broken.
|
||||
changed script to copy all .sh scripts from .pivpn/scripts directory.
|
||||
|
||||
Issue #871: fix backup script
|
||||
I was probably very drunk when i first wrote this backup script.
|
||||
fixed it, now works with new code refactoring,
|
||||
loads vars from setupVars
|
||||
Added backup for wireguard
|
||||
Moved script to global pivpnscripts.
|
||||
Added backup script to bash-completion
|
||||
Added backup script to pivpn script
|
||||
|
||||
update.sh
|
||||
Commented the update from master branch to avoid users trying to update test from master.
|
||||
|
||||
|
||||
Updated LatestChages.md
|
||||
|
||||
## Jan 7th 2020
|
||||
|
||||
Changes for FR #897
|
||||
|
|
|
@ -1893,7 +1893,7 @@ installScripts(){
|
|||
$SUDO chmod 0755 /opt/pivpn
|
||||
fi
|
||||
|
||||
$SUDO cp /etc/.pivpn/scripts/uninstall.sh /opt/pivpn/
|
||||
$SUDO cp /etc/.pivpn/scripts/*.sh /opt/pivpn/
|
||||
$SUDO cp /etc/.pivpn/scripts/$VPN/*.sh /opt/pivpn/
|
||||
$SUDO chmod 0755 /opt/pivpn/*.sh
|
||||
$SUDO cp /etc/.pivpn/scripts/$VPN/pivpn /usr/local/bin/pivpn
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/bash
|
||||
setupVars="/etc/pivpn/setupVars.conf"
|
||||
backupdir=pivpnbackup
|
||||
openvpndir=/etc/openvpn
|
||||
ovpnsdir=${install_home}/ovpns
|
||||
date=$(date +%Y-%m-%d-%H%M%S)
|
||||
|
||||
if [ ! -f "${setupVars}" ]; then
|
||||
echo "::: Missing setup vars file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "${setupVars}"
|
||||
|
||||
backup_openvpn(){
|
||||
if [[ ! -d $install_home/$backupdir ]]; then
|
||||
mkdir $install_home/$backupdir
|
||||
fi
|
||||
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"
|
||||
}
|
||||
|
||||
|
||||
if [[ ! $EUID -eq 0 ]];then
|
||||
if [[ $(dpkg-query -s sudo) ]];then
|
||||
export SUDO="sudo"
|
||||
else
|
||||
echo "::: Please install sudo or run this as root."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
backup_openvpn
|
||||
|
|
@ -50,9 +50,18 @@ updatefromtest(){
|
|||
|
||||
##Clone and copy pivpn scripts to /opt/pivpn
|
||||
cloneandupdate(){
|
||||
git clone "$pivpnrepo" "$pivpnlocalpath"
|
||||
cp "${pivpnlocalpath}"/scripts/*.sh "$pivpnscripts"
|
||||
cp "${pivpnlocalpath}"/scripts/bash-completion "$bashcompletiondir"
|
||||
##This is to be removed after merge.
|
||||
##Alert for users trying to update from master.
|
||||
if [ $VPN == "wireguard" ]; then
|
||||
echo "ERROR: You have installed pivpn from test branch."
|
||||
echo "Wireguard not yet available on master, please use -t flag"
|
||||
exit 1
|
||||
fi
|
||||
## Remove Above and uncomment below when test is moved to master
|
||||
# git clone "$pivpnrepo" "$pivpnlocalpath"
|
||||
# cp "${pivpnlocalpath}"/scripts/*.sh "$pivpnscripts"
|
||||
# cp "${pivpnlocalpath}"/scripts/$VPN/*.sh "$pivpnscripts"
|
||||
# cp "${pivpnlocalpath}"/scripts/$VPN/bash-completion "$bashcompletiondir"
|
||||
}
|
||||
|
||||
##same as cloneandupdate() but from test branch
|
||||
|
@ -97,4 +106,3 @@ else
|
|||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ _pivpn()
|
|||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
dashopts="-a -c -d -l -qr -r -h -u -up"
|
||||
opts="add clients debug list qrcode remove help uninstall update"
|
||||
dashopts="-a -c -d -l -qr -r -h -u -up -bk"
|
||||
opts="add clients debug list qrcode remove help uninstall update backup"
|
||||
if [ "${#COMP_WORDS[@]}" -eq 2 ]
|
||||
then
|
||||
if [[ ${cur} == -* ]] ; then
|
||||
|
|
|
@ -54,6 +54,10 @@ updateScripts(){
|
|||
exit 0
|
||||
}
|
||||
|
||||
backup(){
|
||||
$SUDO /opt/pivpn/backup.sh
|
||||
}
|
||||
|
||||
showHelp(){
|
||||
echo "::: Control all PiVPN specific functions!"
|
||||
echo ":::"
|
||||
|
@ -69,6 +73,7 @@ showHelp(){
|
|||
echo "::: -h, help Show this help dialog"
|
||||
echo "::: -u, uninstall Uninstall pivpn from your system!"
|
||||
echo "::: -up, update Updates PiVPN Scripts"
|
||||
echo "::: -bk, Backup Backup vpn configs and user profiles"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
@ -87,5 +92,6 @@ case "$1" in
|
|||
"-h" | "help" ) showHelp;;
|
||||
"-u" | "uninstall" ) uninstallServer;;
|
||||
"-up" | "update" ) updateScripts "$@" ;;
|
||||
"-bk" | "backup" ) backup ;;
|
||||
* ) showHelp;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue