More safeguards, some fixes, standardized some code, WireGuard update script, removed redundant code

- Add curl as a dependency for those who run the script without 'curl URL | bash'.
  - Use POSIX 'command -v' instead of 'hash'.
  - Check if packages have actually been installed and abort execution if they have not.
  - Fixed issue with getStaticIPv4Settings() that prevented existing network settings
    to be used as static IP settings when running the script unattended with empty
    $IPv4addr and $IPv4gw variables.
  - Exit if processing wireguard-linux-compat fails.
  - Exit if 50unattended-upgrades fails to extract.
  - Exit clientSTAT.sh if the wg0 interface is not available.
  - Moved the Self Check to a single script since dedicated versions were very similar.
  - Add 'pivpn -wg' to update WireGuard for users running Raspbian with armv6l kernel.
This commit is contained in:
Orazio 2020-01-24 17:12:36 +01:00
parent e725b8cdb5
commit deee38b20e
16 changed files with 444 additions and 382 deletions

View file

@ -15,6 +15,17 @@ fi
source "${setupVars}"
scriptusage(){
echo "::: Updates PiVPN scripts"
echo ":::"
echo "::: Usage: pivpn <-up|update> [-t|--test]"
echo ":::"
echo "::: Commands:"
echo "::: [none] Updates from master branch"
echo "::: -t, test Updates from test branch"
echo "::: -h, help Show this usage dialog"
}
###Functions
##Updates scripts
updatepivpnscripts(){
@ -68,14 +79,6 @@ cloneupdttest(){
git -C "$pivpnlocalpath" checkout master
}
scriptusage(){
echo -e "Updates pivpn scripts,
Usage:
pivpn update | updates from master branch
pivpn update -t or --test | updates from test branch"
}
## SCRIPT
if [[ $# -eq 0 ]]; then
@ -83,15 +86,15 @@ if [[ $# -eq 0 ]]; then
else
while true; do
case "$1" in
-t|--test|test)
-t|test)
updatefromtest
exit 0
;;
-h|--help|help)
-h|help)
scriptusage
exit 0
;;
* )
*)
updatepivpnscripts
exit 0
;;