Simplify getting released kitty version
Also if fetching release version fails and local version exists, use it
This commit is contained in:
@@ -27,6 +27,7 @@ install_dir="$(command dirname "$script_dir")/install"
|
|||||||
local_kitty_version_file="$install_dir/installed-kitty-version"
|
local_kitty_version_file="$install_dir/installed-kitty-version"
|
||||||
kitty_exe="$install_dir/bin/kitty"
|
kitty_exe="$install_dir/bin/kitty"
|
||||||
what="installed"
|
what="installed"
|
||||||
|
local_kitty_version=""
|
||||||
|
|
||||||
if [ -r "$local_kitty_version_file" -a -f "$local_kitty_version_file" ]; then
|
if [ -r "$local_kitty_version_file" -a -f "$local_kitty_version_file" ]; then
|
||||||
what="updated"
|
what="updated"
|
||||||
@@ -75,8 +76,11 @@ if [ "$OS" = "linux" ]; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
release_version=$(fetch_quiet "https://api.github.com/repos/kovidgoyal/kitty/releases/latest" | command grep tag_name | command head -n1 | command cut -dv -f2 | command cut -d '"' -f1)
|
release_version=$(fetch_quiet "https://sw.kovidgoyal.net/kitty/current-version.txt")
|
||||||
[ -z "$release_version" ] && die "Could not get kitty latest release version"
|
[ $? -ne 0 -o -z "$release_version" ] && {
|
||||||
|
[ -n "$local_kitty_version" ] && exec_kitty "$@"
|
||||||
|
die "Could not get kitty latest release version"
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$OS" = "linux" ]; then
|
if [ "$OS" = "linux" ]; then
|
||||||
url="https://github.com/kovidgoyal/kitty/releases/download/v$release_version/kitty-$release_version-$arch.txz"
|
url="https://github.com/kovidgoyal/kitty/releases/download/v$release_version/kitty-$release_version-$arch.txz"
|
||||||
|
|||||||
Reference in New Issue
Block a user