#!/bin/sh # Installs Keepshot for Linux for the current user. # curl -fsSL https://keepshot.ai/install.sh | sh # Guide: https://keepshot.ai/install-linux set -eu main() { version='1.3.0' url='https://downloads.keepshot.ai/releases/1.3.0/linux/Keepshot-1.3.0-b7-linux-x86_64.tar.gz' sha256='a0438c8e1098b064d630ea46b40a0fd16022611920cd0eb9bb7690b449641612' release_id='Keepshot-1.3.0-b7-linux-x86_64' if [ "$(uname -s)" != Linux ]; then stop "This installer is for Linux. Download Keepshot for your computer at https://keepshot.ai/downloads" fi if [ "$(uname -m)" != x86_64 ]; then stop "Keepshot for Linux needs a 64-bit Intel or AMD (x86_64) computer. This one is $(uname -m)." fi if [ "$(id -u)" -eq 0 ]; then stop "Run this without sudo. Keepshot installs for your user only." fi glibc="$(getconf GNU_LIBC_VERSION 2>/dev/null | awk '{print $2}')" if ! glibc_ok "$glibc"; then stop "Keepshot needs glibc 2.39 or newer (Ubuntu 24.04+, Debian 13, Fedora 40+, Arch). This system has ${glibc:-an unknown C library}." fi for tool in curl tar gzip sha256sum pgrep; do command -v "$tool" >/dev/null 2>&1 || stop "$tool is required. Install it with your package manager, then run this command again." done data_home="${XDG_DATA_HOME:-$HOME/.local/share}" if [ -d "$data_home/keepshot/releases/$release_id" ]; then say "Keepshot $version is already installed and up to date." check_components exit 0 fi if pgrep -x keepshot >/dev/null 2>&1; then stop "Quit Keepshot, then run this command again." fi work="$(mktemp -d)" trap 'rm -rf "$work"' EXIT HUP INT TERM say "Downloading Keepshot $version..." curl -fL --proto '=https' --tlsv1.2 --retry 2 --progress-bar -o "$work/keepshot.tar.gz" "$url" || stop "The download failed. Check your connection and run this command again." printf '%s %s\n' "$sha256" "$work/keepshot.tar.gz" | sha256sum -c --status || stop "The download did not match its checksum. Run this command again." tar -xzf "$work/keepshot.tar.gz" -C "$work" sh "$work/$release_id/install-user.sh" >/dev/null || stop "The installer stopped. See the message above." say "" say "Keepshot $version is installed." check_components say "Open Keepshot from your applications menu and follow the instructions on the Record tab." if [ -n "${XDG_SESSION_TYPE:-}" ] && [ "$XDG_SESSION_TYPE" != wayland ]; then say "Note: Keepshot records Wayland desktops. This session is $XDG_SESSION_TYPE." fi } say() { printf '%s\n' "$1"; } stop() { printf 'Keepshot was not installed: %s\n' "$1" >&2 exit 1 } glibc_ok() { major="${1%%.*}" minor="${1#*.}" minor="${minor%%.*}" case "$major$minor" in '' | *[!0-9]*) return 1 ;; esac [ "$major" -gt 2 ] || { [ "$major" -eq 2 ] && [ "$minor" -ge 39 ]; } } # Recording needs GStreamer plugins from the distribution. Report what is # missing; never install system packages from here. check_components() { plugins="" for dir in /usr/lib/x86_64-linux-gnu/gstreamer-1.0 /usr/lib64/gstreamer-1.0 /usr/lib/gstreamer-1.0; do [ -d "$dir" ] && plugins="$dir" && break done missing=no if [ -z "$plugins" ]; then missing=yes else # x264 is the software encoder; the VA plugin can exist without a usable driver. for plugin in app videocrop videoparsersbad libav pipewire alsa x264; do [ -e "$plugins/libgst$plugin.so" ] || missing=yes done fi [ "$missing" = yes ] || return 0 say "" say "One more step: install Keepshot's recording components." # shellcheck source=/dev/null distro="$(. /etc/os-release 2>/dev/null && printf '%s %s' "${ID:-}" "${ID_LIKE:-}")" case " $distro " in *" arch "*) say " sudo pacman -S --needed gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav gst-plugin-pipewire" ;; *" fedora "*) say "Enable RPM Fusion Free (https://rpmfusion.org/Configuration), then run:" say " sudo dnf install gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-bad-free gstreamer1-plugins-ugly gstreamer1-plugin-libav pipewire-gstreamer" ;; *" debian "* | *" ubuntu "*) say " sudo apt install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-pipewire gstreamer1.0-alsa" ;; *) say "See the package list at https://keepshot.ai/install-linux" ;; esac } main "$@"