1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 15:20:09 +01:00

Update wgd.sh

This commit is contained in:
Donald Cheng Hong Zou 2021-12-25 17:35:36 -05:00
parent 649b66ba1a
commit fcf9300a49

View File

@ -33,7 +33,6 @@ _check_and_set_venv(){
install_wgd(){ install_wgd(){
# Check Python3 version # Check Python3 version
printf "%s\n" "$dashes"
printf "| Starting to install WGDashboard |\n" printf "| Starting to install WGDashboard |\n"
version_pass=$(python3 -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 7) else print("0");') version_pass=$(python3 -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 7) else print("0");')
if [ $version_pass == "0" ] if [ $version_pass == "0" ]
@ -64,9 +63,7 @@ install_wgd(){
# printf "| Consider 'systemctl enable wg-dashboard' |\n" # printf "| Consider 'systemctl enable wg-dashboard' |\n"
# printf " and 'systemctl start wg-dashboard'\n" # printf " and 'systemctl start wg-dashboard'\n"
# printf " use '${0} stop' before starting with systemctl\n" # printf " use '${0} stop' before starting with systemctl\n"
echo printf "| Enter ./wgd start to start the dashboard |\n"
printf "| Now starting Dashboard in background |\n"
start_wgd
} }
@ -80,7 +77,6 @@ check_wgd_status(){
} }
start_wgd () { start_wgd () {
# _check_and_set_venv
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
printf "| Starting WGDashboard in the background. |\n" printf "| Starting WGDashboard in the background. |\n"
if [ ! -d "log" ] if [ ! -d "log" ]
@ -98,7 +94,6 @@ stop_wgd() {
start_wgd_debug() { start_wgd_debug() {
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
# _check_and_set_venv
printf "| Starting WGDashboard in the foreground. |\n" printf "| Starting WGDashboard in the foreground. |\n"
python3 "$app_name" python3 "$app_name"
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
@ -115,12 +110,14 @@ update_wgd() {
mv wgd.sh wgd.sh.old mv wgd.sh wgd.sh.old
printf "| Downloading %s from GitHub... |\n" "$new_ver" printf "| Downloading %s from GitHub... |\n" "$new_ver"
git stash > /dev/null 2>&1 git stash > /dev/null 2>&1
git pull https://github.com/donaldzou/wireguard-dashboard.git $new_ver --force > /dev/null 2>&1 # git pull https://github.com/donaldzou/wireguard-dashboard.git $new_ver --force > /dev/null 2>&1
printf "| Installing latest Python dependencies |\n" # printf "| Installing latest Python dependencies |\n"
python3 -m pip install -U -r requirements.txt > /dev/null 2>&1 # python3 -m pip install -U -r requirements.txt > /dev/null 2>&1
printf "| Update Successfully! |\n" # printf "| Update Successfully! |\n"
rm wgd.sh.old install_wgd
printf "| Enter ./wgd start to start the dashboard |\n" printf "| Enter ./wgd start to start the dashboard |\n"
printf "%s\n" "$dashes"
rm wgd.sh.old
else else
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
printf "| Update Canceled. |\n" printf "| Update Canceled. |\n"
@ -155,7 +152,9 @@ if [ "$#" != 1 ];
elif [ "$1" = "update" ]; then elif [ "$1" = "update" ]; then
update_wgd update_wgd
elif [ "$1" = "install" ]; then elif [ "$1" = "install" ]; then
printf "%s\n" "$dashes"
install_wgd install_wgd
printf "%s\n" "$dashes"
elif [ "$1" = "restart" ]; then elif [ "$1" = "restart" ]; then
if check_wgd_status; then if check_wgd_status; then
printf "%s\n" "$dashes" printf "%s\n" "$dashes"