mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 07:10:09 +01:00
Rebased and going further
This commit is contained in:
parent
1d20dc9fcb
commit
bc29b89a16
@ -18,8 +18,7 @@ ENV update="yes"
|
||||
# Doing package management operations, such as upgrading
|
||||
RUN apk update \
|
||||
&& apk add --no-cache bash git curl tzdata \
|
||||
wireguard-tools sudo \
|
||||
py3-pip py3-psutil py3-bcrypt
|
||||
sudo py3-psutil py3-bcrypt
|
||||
|
||||
# Using WGDASH -- like wg_net functionally as a ARG command. But it is needed in entrypoint.sh so it needs to be exported as environment variable.
|
||||
ENV WGDASH=/opt/wireguarddashboard
|
||||
|
@ -80,17 +80,6 @@ clean_up() {
|
||||
echo "Removed unneeded logs!"
|
||||
}
|
||||
|
||||
#update_checker() {
|
||||
#if [ "$update" = "yes" ]; then
|
||||
# echo "Activating Python venv and executing the WireGuard Dashboard service."
|
||||
# . "${WGDASH}/src/venv/bin/activate"
|
||||
# cd "${WGDASH}"/src || exit
|
||||
# bash wgd.sh update
|
||||
#else
|
||||
# echo "Auto Updater disabled"
|
||||
#fi
|
||||
#}
|
||||
|
||||
# === SET ENV VARS ===
|
||||
set_envvars() {
|
||||
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
|
||||
|
62
src/wgd.sh
62
src/wgd.sh
@ -156,7 +156,6 @@ _installPythonVenv(){
|
||||
}
|
||||
|
||||
_installPythonPip(){
|
||||
|
||||
if ! $pythonExecutable -m pip -h > /dev/null 2>&1
|
||||
then
|
||||
case "$OS" in
|
||||
@ -195,34 +194,43 @@ _installPythonPip(){
|
||||
fi
|
||||
}
|
||||
|
||||
_checkWireguard(){
|
||||
if [ ! wg -h > /dev/null 2>&1 ] || [ ! wg-quick -h > /dev/null 2>&1 ]
|
||||
then
|
||||
case "$OS" in
|
||||
ubuntu|debian)
|
||||
{ sudo apt update ; sudo apt-get install -y wireguard; printf "\n\n"; } &>> ./log/install.txt
|
||||
;;
|
||||
#centos|fedora|redhat|rhel)
|
||||
# if [ "$pythonExecutable" = "python3" ]; then
|
||||
# { sudo dnf install -y python3-pip; printf "\n\n"; } >> ./log/install.txt
|
||||
# else
|
||||
# { sudo dnf install -y ${pythonExecutable}-pip; printf "\n\n"; } >> ./log/install.txt
|
||||
# fi
|
||||
#;;
|
||||
alpine)
|
||||
{ sudo apk update; sudo apk add wireguard-tools ; printf "\n\n"; } >> ./log/install.txt
|
||||
;;
|
||||
*)
|
||||
printf "[WGDashboard] %s Sorry, your OS is not supported. Currently the install script only support Debian-based, Red Hat-based OS. With experimental support for Alpine Linux.\n" "$heavy_crossmark"
|
||||
printf "%s\n" "$helpMsg"
|
||||
kill $TOP_PID
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
checkWireguard(){
|
||||
# Check if wg and wg-quick are installed
|
||||
if ! command -v wg > /dev/null 2>&1 || ! command -v wg-quick > /dev/null 2>&1
|
||||
then
|
||||
case "$OS" in
|
||||
ubuntu|debian)
|
||||
{
|
||||
sudo apt update && sudo apt-get install -y wireguard;
|
||||
printf "\nWireGuard installed on %s.\n\n" "$OS";
|
||||
} &>> ./log/install.txt
|
||||
;;
|
||||
centos|fedora|redhat|rhel)
|
||||
{
|
||||
sudo dnf install -y wireguard-tools;
|
||||
printf "\nWireGuard installed on %s.\n\n" "$OS";
|
||||
} &>> ./log/install.txt
|
||||
;;
|
||||
alpine)
|
||||
{
|
||||
sudo apk update && sudo apk add wireguard-tools;
|
||||
printf "\nWireGuard installed on %s.\n\n" "$OS";
|
||||
} &>> ./log/install.txt
|
||||
;;
|
||||
*)
|
||||
printf "[WGDashboard] %s Sorry, your OS is not supported. Currently, the install script only supports Debian-based, Red Hat-based, and Alpine Linux.\n" "$heavy_crossmark"
|
||||
printf "%s\n" "$helpMsg"
|
||||
kill $TOP_PID
|
||||
;;
|
||||
esac
|
||||
else
|
||||
printf "WireGuard is already installed.\n"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_checkPythonVersion(){
|
||||
version_pass=$($pythonExecutable -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 10) else print("0");')
|
||||
version=$($pythonExecutable --version)
|
||||
@ -250,8 +258,6 @@ _checkPythonVersion(){
|
||||
|
||||
install_wgd(){
|
||||
printf "[WGDashboard] Starting to install WGDashboard\n"
|
||||
_checkWireguard
|
||||
sudo chmod -R 755 /etc/wireguard/
|
||||
|
||||
if [ ! -d "log" ]
|
||||
then
|
||||
@ -270,6 +276,8 @@ install_wgd(){
|
||||
_checkPythonVersion
|
||||
_installPythonVenv
|
||||
_installPythonPip
|
||||
_checkWireguard
|
||||
sudo chmod -R 755 /etc/wireguard/
|
||||
|
||||
if [ ! -d "db" ]
|
||||
then
|
||||
|
Loading…
Reference in New Issue
Block a user