1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 07:10:09 +01:00
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'])")
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"
read up
fi
if [ "$up" = "Y" ] || [ "$up" = "y" ]; then
printf "[WGDashboard] Shutting down WGDashboard\n"
if check_wgd_status; then
stop_wgd
fi
mv wgd.sh wgd.sh.old
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt
chmod +x ./wgd.sh
sudo ./wgd.sh install
printf "[WGDashboard] Update completed!\n"
printf "%s\n" "$dashes"
mv wgd.sh wgd.sh.old && \
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver" && \
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt && \
chmod +x ./wgd.sh && \
sudo ./wgd.sh install && \
printf "[WGDashboard] Update completed!\n" && \
printf "%s\n" "$dashes"; \
rm wgd.sh.old
else
printf "%s\n" "$dashes"
@ -402,10 +411,13 @@ update_wgd() {
fi
}
if [ "$#" != 1 ];
then
if [ "$#" -lt 1 ]; then
help
else
if [ "$2" = "-y" ] || [ "$2" = "-Y" ]; then
commandConfirmed="true"
fi
if [ "$1" = "start" ]; then
if check_wgd_status; then
printf "%s\n" "$dashes"