Do not do automatic upgrades of remote kitty

Can be disruptive, since upgrading outputs to the terminal.
Instead updating can be triggerred manually with kitty update-kitty
This commit is contained in:
Kovid Goyal 2022-04-04 14:50:11 +05:30
parent c1f06941f5
commit 709c4abb53
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 14 deletions

View File

@ -113,7 +113,8 @@ and run kitty when kitty is first executed on the remote server. A value of
:code:`needed` means kitty is installed only if not already present in the
system-wide PATH. A value of :code:`yes` means that kitty is installed even if
already present, and the installed kitty takes precedence. Finally, :code:`no`
means no kitty is installed on the remote machine.
means no kitty is installed on the remote machine. The installed kitty
can be updated by running: :code:`kitty +update-kitty` on the remote machine.
''')
egr() # }}}

View File

@ -27,22 +27,12 @@ script_path=$(command readlink -f "$0" 2> /dev/null)
[ $? == 0 ] || script_path="$0"
script_dir=$(command dirname "$script_path")
install_dir="$(command dirname "$script_dir")/install"
remote_kitty_version_file="$script_dir/../version"
local_kitty_version_file="$install_dir/installed-kitty-version"
kitty_exe="$install_dir/bin/kitty"
what="installed"
local_kitty_version=""
if [ -r "$local_kitty_version_file" -a -f "$local_kitty_version_file" ]; then
what="updated"
version_sort_key() {
printf "%05d%05d%05d" $(echo "$1" | command tr '.' '\n' | command head -n 3)
}
remote_kitty_version=$(command cat "$script_dir/../version")
[ $? = 0 ] || die "Failed to read remote kitty version"
local_kitty_version=$(command cat "$local_kitty_version_file")
[ $? = 0 ] || die "Failed to read local kitty version"
[ $(version_sort_key "$remote_kitty_version") -le $(version_sort_key "$local_kitty_version") ] && exec_kitty "$@"
fi
[ -f "$kitty_exe" -a -x "$kitty_exe" -a "$1" != "+update-kitty" ] && exec_kitty "$@"
case "$(command uname)" in
'Linux') OS="linux";;
@ -99,7 +89,7 @@ if ! command mkdir "$lock_dir" 2> /dev/null; then
fi
trap 'delete_lock_dir' EXIT INT QUIT TERM
printf "\033[33mkitty needs to be %s\033[m\n\n" "$what"
printf "\033[33mkitty needs to be installed\033[m\n\n"
command rm -rf "$install_dir"
command mkdir -p "$install_dir"
printf "Downloading kitty from: \033[32m%s\033[m\n\n" "$url"