mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-06 07:50:13 +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
|
# Doing package management operations, such as upgrading
|
||||||
RUN apk update \
|
RUN apk update \
|
||||||
&& apk add --no-cache bash git curl tzdata \
|
&& apk add --no-cache bash git curl tzdata \
|
||||||
wireguard-tools sudo \
|
sudo py3-psutil py3-bcrypt
|
||||||
py3-pip 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.
|
# 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
|
ENV WGDASH=/opt/wireguarddashboard
|
||||||
|
@ -80,17 +80,6 @@ clean_up() {
|
|||||||
echo "Removed unneeded logs!"
|
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 ENV VARS ===
|
||||||
set_envvars() {
|
set_envvars() {
|
||||||
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
|
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
|
||||||
|
62
src/wgd.sh
62
src/wgd.sh
@ -156,7 +156,6 @@ _installPythonVenv(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
_installPythonPip(){
|
_installPythonPip(){
|
||||||
|
|
||||||
if ! $pythonExecutable -m pip -h > /dev/null 2>&1
|
if ! $pythonExecutable -m pip -h > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
@ -195,34 +194,43 @@ _installPythonPip(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_checkWireguard(){
|
checkWireguard(){
|
||||||
if [ ! wg -h > /dev/null 2>&1 ] || [ ! wg-quick -h > /dev/null 2>&1 ]
|
# Check if wg and wg-quick are installed
|
||||||
then
|
if ! command -v wg > /dev/null 2>&1 || ! command -v wg-quick > /dev/null 2>&1
|
||||||
case "$OS" in
|
then
|
||||||
ubuntu|debian)
|
case "$OS" in
|
||||||
{ sudo apt update ; sudo apt-get install -y wireguard; printf "\n\n"; } &>> ./log/install.txt
|
ubuntu|debian)
|
||||||
;;
|
{
|
||||||
#centos|fedora|redhat|rhel)
|
sudo apt update && sudo apt-get install -y wireguard;
|
||||||
# if [ "$pythonExecutable" = "python3" ]; then
|
printf "\nWireGuard installed on %s.\n\n" "$OS";
|
||||||
# { sudo dnf install -y python3-pip; printf "\n\n"; } >> ./log/install.txt
|
} &>> ./log/install.txt
|
||||||
# else
|
;;
|
||||||
# { sudo dnf install -y ${pythonExecutable}-pip; printf "\n\n"; } >> ./log/install.txt
|
centos|fedora|redhat|rhel)
|
||||||
# fi
|
{
|
||||||
#;;
|
sudo dnf install -y wireguard-tools;
|
||||||
alpine)
|
printf "\nWireGuard installed on %s.\n\n" "$OS";
|
||||||
{ sudo apk update; sudo apk add wireguard-tools ; printf "\n\n"; } >> ./log/install.txt
|
} &>> ./log/install.txt
|
||||||
;;
|
;;
|
||||||
*)
|
alpine)
|
||||||
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"
|
sudo apk update && sudo apk add wireguard-tools;
|
||||||
kill $TOP_PID
|
printf "\nWireGuard installed on %s.\n\n" "$OS";
|
||||||
;;
|
} &>> ./log/install.txt
|
||||||
esac
|
;;
|
||||||
fi
|
*)
|
||||||
|
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(){
|
_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_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)
|
version=$($pythonExecutable --version)
|
||||||
@ -250,8 +258,6 @@ _checkPythonVersion(){
|
|||||||
|
|
||||||
install_wgd(){
|
install_wgd(){
|
||||||
printf "[WGDashboard] Starting to install WGDashboard\n"
|
printf "[WGDashboard] Starting to install WGDashboard\n"
|
||||||
_checkWireguard
|
|
||||||
sudo chmod -R 755 /etc/wireguard/
|
|
||||||
|
|
||||||
if [ ! -d "log" ]
|
if [ ! -d "log" ]
|
||||||
then
|
then
|
||||||
@ -270,6 +276,8 @@ install_wgd(){
|
|||||||
_checkPythonVersion
|
_checkPythonVersion
|
||||||
_installPythonVenv
|
_installPythonVenv
|
||||||
_installPythonPip
|
_installPythonPip
|
||||||
|
_checkWireguard
|
||||||
|
sudo chmod -R 755 /etc/wireguard/
|
||||||
|
|
||||||
if [ ! -d "db" ]
|
if [ ! -d "db" ]
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user