mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 07:10:09 +01:00
Fixed issue https://github.com/donaldzou/WGDashboard/issues/329.
Regarding being able to pass in the -y flag.
This commit is contained in:
parent
adeb57864b
commit
81168c27c6
126
src/wgd.sh
126
src/wgd.sh
@ -380,20 +380,29 @@ update_wgd() {
|
|||||||
|
|
||||||
new_ver=$($venv_python -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/donaldzou/WGDashboard/releases/latest').read(); output = json.loads(data);print(output['tag_name'])")
|
new_ver=$($venv_python -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/donaldzou/WGDashboard/releases/latest').read(); output = json.loads(data);print(output['tag_name'])")
|
||||||
printf "%s\n" "$dashes"
|
printf "%s\n" "$dashes"
|
||||||
printf "[WGDashboard] Are you sure you want to update to the %s? (Y/N): " "$new_ver"
|
|
||||||
read up
|
if [ "$commandConfirmed" = "true" ]; then
|
||||||
|
printf "[WGDashboard] Confirmation granted.\n"
|
||||||
|
up="Y"
|
||||||
|
else
|
||||||
|
printf "[WGDashboard] Are you sure you want to update to the %s? (Y/N): " "$new_ver"
|
||||||
|
read up
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$up" = "Y" ] || [ "$up" = "y" ]; then
|
if [ "$up" = "Y" ] || [ "$up" = "y" ]; then
|
||||||
printf "[WGDashboard] Shutting down WGDashboard\n"
|
printf "[WGDashboard] Shutting down WGDashboard\n"
|
||||||
|
|
||||||
if check_wgd_status; then
|
if check_wgd_status; then
|
||||||
stop_wgd
|
stop_wgd
|
||||||
fi
|
fi
|
||||||
mv wgd.sh wgd.sh.old
|
|
||||||
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
|
mv wgd.sh wgd.sh.old && \
|
||||||
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt
|
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver" && \
|
||||||
chmod +x ./wgd.sh
|
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt && \
|
||||||
sudo ./wgd.sh install
|
chmod +x ./wgd.sh && \
|
||||||
printf "[WGDashboard] Update completed!\n"
|
sudo ./wgd.sh install && \
|
||||||
printf "%s\n" "$dashes"
|
printf "[WGDashboard] Update completed!\n" && \
|
||||||
|
printf "%s\n" "$dashes"; \
|
||||||
rm wgd.sh.old
|
rm wgd.sh.old
|
||||||
else
|
else
|
||||||
printf "%s\n" "$dashes"
|
printf "%s\n" "$dashes"
|
||||||
@ -402,52 +411,55 @@ update_wgd() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" != 1 ];
|
if [ "$#" -lt 1 ]; then
|
||||||
then
|
help
|
||||||
help
|
else
|
||||||
else
|
if [ "$2" = "-y" ] || [ "$2" = "-Y" ]; then
|
||||||
if [ "$1" = "start" ]; then
|
commandConfirmed="true"
|
||||||
if check_wgd_status; then
|
fi
|
||||||
printf "%s\n" "$dashes"
|
|
||||||
printf "[WGDashboard] WGDashboard is already running.\n"
|
if [ "$1" = "start" ]; then
|
||||||
printf "%s\n" "$dashes"
|
if check_wgd_status; then
|
||||||
else
|
printf "%s\n" "$dashes"
|
||||||
start_wgd
|
printf "[WGDashboard] WGDashboard is already running.\n"
|
||||||
fi
|
printf "%s\n" "$dashes"
|
||||||
elif [ "$1" = "stop" ]; then
|
else
|
||||||
if check_wgd_status; then
|
start_wgd
|
||||||
printf "%s\n" "$dashes"
|
fi
|
||||||
stop_wgd
|
elif [ "$1" = "stop" ]; then
|
||||||
printf "[WGDashboard] WGDashboard is stopped.\n"
|
if check_wgd_status; then
|
||||||
printf "%s\n" "$dashes"
|
printf "%s\n" "$dashes"
|
||||||
else
|
stop_wgd
|
||||||
printf "%s\n" "$dashes"
|
printf "[WGDashboard] WGDashboard is stopped.\n"
|
||||||
printf "[WGDashboard] WGDashboard is not running.\n"
|
printf "%s\n" "$dashes"
|
||||||
printf "%s\n" "$dashes"
|
else
|
||||||
fi
|
printf "%s\n" "$dashes"
|
||||||
elif [ "$1" = "update" ]; then
|
printf "[WGDashboard] WGDashboard is not running.\n"
|
||||||
update_wgd
|
printf "%s\n" "$dashes"
|
||||||
elif [ "$1" = "install" ]; then
|
fi
|
||||||
printf "%s\n" "$dashes"
|
elif [ "$1" = "update" ]; then
|
||||||
install_wgd
|
update_wgd
|
||||||
printf "%s\n" "$dashes"
|
elif [ "$1" = "install" ]; then
|
||||||
elif [ "$1" = "restart" ]; then
|
printf "%s\n" "$dashes"
|
||||||
if check_wgd_status; then
|
install_wgd
|
||||||
printf "%s\n" "$dashes"
|
printf "%s\n" "$dashes"
|
||||||
stop_wgd
|
elif [ "$1" = "restart" ]; then
|
||||||
printf "| WGDashboard is stopped. |\n"
|
if check_wgd_status; then
|
||||||
sleep 4
|
printf "%s\n" "$dashes"
|
||||||
start_wgd
|
stop_wgd
|
||||||
else
|
printf "| WGDashboard is stopped. |\n"
|
||||||
start_wgd
|
sleep 4
|
||||||
fi
|
start_wgd
|
||||||
elif [ "$1" = "debug" ]; then
|
else
|
||||||
if check_wgd_status; then
|
start_wgd
|
||||||
printf "| WGDashboard is already running. |\n"
|
fi
|
||||||
else
|
elif [ "$1" = "debug" ]; then
|
||||||
start_wgd_debug
|
if check_wgd_status; then
|
||||||
fi
|
printf "| WGDashboard is already running. |\n"
|
||||||
else
|
else
|
||||||
help
|
start_wgd_debug
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
help
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user