Regarding being able to pass in the -y flag.
This commit is contained in:
Daan 2024-10-24 23:10:36 +02:00
parent adeb57864b
commit 81168c27c6

View File

@ -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"
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" printf "[WGDashboard] Are you sure you want to update to the %s? (Y/N): " "$new_ver"
read up 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,10 +411,13 @@ update_wgd() {
fi fi
} }
if [ "$#" != 1 ]; if [ "$#" -lt 1 ]; then
then
help help
else else
if [ "$2" = "-y" ] || [ "$2" = "-Y" ]; then
commandConfirmed="true"
fi
if [ "$1" = "start" ]; then if [ "$1" = "start" ]; then
if check_wgd_status; then if check_wgd_status; then
printf "%s\n" "$dashes" printf "%s\n" "$dashes"