mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-06 07:50:13 +01:00
Update wgd.sh
This commit is contained in:
parent
8c8c5a5826
commit
91e3a3237b
21
src/wgd.sh
21
src/wgd.sh
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
# wgd.sh - Copyright(C) 2024 Donald Zou [https://github.com/donaldzou]
|
# wgd.sh - Copyright(C) 2024 Donald Zou [https://github.com/donaldzou]
|
||||||
# Under Apache-2.0 License
|
# Under Apache-2.0 License
|
||||||
|
trap "kill -s TERM $TOP_PID" TERM
|
||||||
|
export TOP_PID=$$
|
||||||
|
|
||||||
app_name="dashboard.py"
|
app_name="dashboard.py"
|
||||||
app_official_name="WGDashboard"
|
app_official_name="WGDashboard"
|
||||||
venv_python="./venv/bin/python3"
|
venv_python="./venv/bin/python3"
|
||||||
@ -50,7 +53,7 @@ _check_and_set_venv(){
|
|||||||
if ! $venv_python --version > /dev/null 2>&1
|
if ! $venv_python --version > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
printf "[WGDashboard] %s Python Virtual Environment under ./venv failed to create. Halting now.\n" "$heavy_crossmark"
|
printf "[WGDashboard] %s Python Virtual Environment under ./venv failed to create. Halting now.\n" "$heavy_crossmark"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +68,7 @@ _determineOS(){
|
|||||||
else
|
else
|
||||||
printf "[WGDashboard] %s Sorry, your OS is not supported. Currently the install script only support Debian-based, Red Hat-based OS." "$heavy_crossmark"
|
printf "[WGDashboard] %s Sorry, your OS is not supported. Currently the install script only support Debian-based, Red Hat-based OS." "$heavy_crossmark"
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +90,7 @@ _installPython(){
|
|||||||
then
|
then
|
||||||
printf "[WGDashboard] %s Python is still not installed, halting script now.\n" "$heavy_crossmark"
|
printf "[WGDashboard] %s Python is still not installed, halting script now.\n" "$heavy_crossmark"
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
else
|
else
|
||||||
printf "[WGDashboard] %s Python is installed\n" "$heavy_checkmark"
|
printf "[WGDashboard] %s Python is installed\n" "$heavy_checkmark"
|
||||||
fi
|
fi
|
||||||
@ -114,7 +117,7 @@ _installPythonVenv(){
|
|||||||
*)
|
*)
|
||||||
printf "[WGDashboard] %s Sorry, your OS is not supported. Currently the install script only support Debian-based, Red Hat-based OS." "$heavy_crossmark"
|
printf "[WGDashboard] %s Sorry, your OS is not supported. Currently the install script only support Debian-based, Red Hat-based OS." "$heavy_crossmark"
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -150,7 +153,7 @@ _installPythonPip(){
|
|||||||
*)
|
*)
|
||||||
printf "[WGDashboard] Sorry, your OS is not support auto install. Currently the install script only support Debian-based, Red Hat-based OS."
|
printf "[WGDashboard] Sorry, your OS is not support auto install. Currently the install script only support Debian-based, Red Hat-based OS."
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -159,7 +162,7 @@ _installPythonPip(){
|
|||||||
then
|
then
|
||||||
printf "[WGDashboard] %s Python Package Manager (PIP) is still not installed, halting script now.\n" "$heavy_crossmark"
|
printf "[WGDashboard] %s Python Package Manager (PIP) is still not installed, halting script now.\n" "$heavy_crossmark"
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
else
|
else
|
||||||
printf "[WGDashboard] %s Python Package Manager (PIP) is installed\n" "$heavy_checkmark"
|
printf "[WGDashboard] %s Python Package Manager (PIP) is installed\n" "$heavy_checkmark"
|
||||||
fi
|
fi
|
||||||
@ -169,12 +172,12 @@ _checkWireguard(){
|
|||||||
if ! wg -h > /dev/null 2>&1
|
if ! wg -h > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
printf "[WGDashboard] %s WireGuard is not installed. Please follow instruction on https://www.wireguard.com/install/ to install. \n" "$heavy_crossmark"
|
printf "[WGDashboard] %s WireGuard is not installed. Please follow instruction on https://www.wireguard.com/install/ to install. \n" "$heavy_crossmark"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
fi
|
fi
|
||||||
if ! wg-quick -h > /dev/null 2>&1
|
if ! wg-quick -h > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
printf "[WGDashboard] %s WireGuard is not installed. Please follow instruction on https://www.wireguard.com/install/ to install. \n" "$heavy_crossmark"
|
printf "[WGDashboard] %s WireGuard is not installed. Please follow instruction on https://www.wireguard.com/install/ to install. \n" "$heavy_crossmark"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +204,7 @@ _checkPythonVersion(){
|
|||||||
else
|
else
|
||||||
printf "[WGDashboard] %s Could not find a compatible version of Python. Current Python is %s.\n" "$heavy_crossmark" "$version"
|
printf "[WGDashboard] %s Could not find a compatible version of Python. Current Python is %s.\n" "$heavy_crossmark" "$version"
|
||||||
printf "[WGDashboard] WGDashboard required Python 3.10, 3.11 or 3.12. Halting install now.\n"
|
printf "[WGDashboard] WGDashboard required Python 3.10, 3.11 or 3.12. Halting install now.\n"
|
||||||
exit 1
|
kill -s TERM $TOP_PID
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user