From 7c4977146f5bf93c2c354466552339105e9942cd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Aug 2024 08:51:08 +0530 Subject: [PATCH] Fix #7741 --- docs/installer.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/installer.sh b/docs/installer.sh index 3002bcd0f..6336e30c6 100644 --- a/docs/installer.sh +++ b/docs/installer.sh @@ -126,20 +126,24 @@ download_installer() { } } +ensure_dest() { + printf "%s\n" "Installing to $dest" + command rm -rf "$dest" || die "Failed to delete $dest" + command mkdir -p "$dest" || die "Failed to mkdir -p $dest" + command rm -rf "$dest" || die "Failed to delete $dest" +} + linux_install() { command mkdir "$tdir/mp" command tar -C "$tdir/mp" "-xJof" "$installer" || die "Failed to extract kitty tarball" - printf "%s\n" "Installing to $dest" - command rm -rf "$dest" || die "Failed to delete $dest" + ensure_dest command mv "$tdir/mp" "$dest" || die "Failed to move kitty.app to $dest" } macos_install() { command mkdir "$tdir/mp" command hdiutil attach "$installer" "-mountpoint" "$tdir/mp" || die "Failed to mount kitty.dmg" - printf "%s\n" "Installing to $dest" - command rm -rf "$dest" - command mkdir -p "$dest" || die "Failed to create the directory: $dest" + ensure_dest command ditto -v "$tdir/mp/kitty.app" "$dest" rc="$?" command hdiutil detach "$tdir/mp"