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