mirror of
https://github.com/aclist/dztui.git
synced 2025-01-01 15:12:05 +01:00
Enforce download when switching branches
This commit is contained in:
parent
1733c70cbd
commit
286ed612c8
1 changed files with 23 additions and 7 deletions
30
dzgui.sh
30
dzgui.sh
|
@ -558,7 +558,7 @@ debug_menu(){
|
||||||
)
|
)
|
||||||
debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null)
|
debug_sel=$(zenity --list --width=1280 --height=800 --column="Options" --title="DZGUI" --hide-header "${debug_list[@]}" 2>/dev/null)
|
||||||
if [[ $debug_sel == "${debug_list[0]}" ]]; then
|
if [[ $debug_sel == "${debug_list[0]}" ]]; then
|
||||||
toggle_branch
|
enforce_dl=1
|
||||||
check_version
|
check_version
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -733,19 +733,35 @@ check_branch(){
|
||||||
fi
|
fi
|
||||||
upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
upstream=$(curl -Ls "$version_url" | awk -F= '/^version=/ {print $2}')
|
||||||
}
|
}
|
||||||
|
enforce_dl(){
|
||||||
|
zenity --warning --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t\t$branch\nYour version:\t\t\t$version\nUpstream version:\t\t$upstream\n\nVersion updates introduce important bug fixes and are encouraged.\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null
|
||||||
|
rc=$?
|
||||||
|
if [[ $rc -eq 1 ]]; then
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
download_new_version && toggle_branch
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
prompt_dl(){
|
||||||
|
zenity --question --title="DZGUI" --text "Version conflict.\n\nYour branch:\t\t\t$branch\nYour version:\t\t\t$version\nUpstream version:\t\t$upstream\n\nVersion updates introduce important bug fixes and are encouraged.\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null
|
||||||
|
rc=$?
|
||||||
|
if [[ $rc -eq 1 ]]; then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
download_new_version
|
||||||
|
fi
|
||||||
|
}
|
||||||
check_version(){
|
check_version(){
|
||||||
source $config_file
|
source $config_file
|
||||||
check_branch
|
check_branch
|
||||||
if [[ $version == $upstream ]]; then
|
if [[ $version == $upstream ]]; then
|
||||||
check_unmerged
|
check_unmerged
|
||||||
else
|
else
|
||||||
echo "[DZGUI] Upstream ($upstream) is > local ($version)"
|
echo "[DZGUI] Upstream ($upstream) != local ($version)"
|
||||||
zenity --question --title="DZGUI" --text "Newer version available.\n\nYour branch:\t\t\t$branch\nYour version:\t\t\t$version\nUpstream version:\t\t$upstream\n\nVersion updates introduce important bug fixes and are encouraged.\n\nAttempt to download latest version?" --width=500 --ok-label="Yes" --cancel-label="No" 2>/dev/null
|
if [[ $enforce_dl -eq 1 ]]; then
|
||||||
rc=$?
|
enforce_dl
|
||||||
if [[ $rc -eq 1 ]]; then
|
|
||||||
return
|
|
||||||
else
|
else
|
||||||
download_new_version
|
prompt_dl
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue