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"