#!/bin/bash # Installs Transcribe 1.9.1 on Linux (x86_64) for this user, no sudo needed: # curl -fsSL https://transcribe.anthony-tong.com/install-linux.sh | bash # curl -fsSL https://transcribe.anthony-tong.com/install-linux.sh | bash -s -- --with-stems (also set up the stem separator) # curl -fsSL https://transcribe.anthony-tong.com/install-linux.sh | bash -s -- --uninstall # Puts the AppImage in ~/Applications (it updates itself there), a `transcribe` command in ~/.local/bin, # and a menu entry; .transcribe projects open in Transcribe, audio files list it under "Open with". set -euo pipefail STEMS=0 UNINSTALL=0 for arg in "$@"; do case "$arg" in --with-stems) STEMS=1 ;; --uninstall) UNINSTALL=1 ;; *) echo "Unknown option: $arg (did you mean --with-stems or --uninstall?)" >&2; exit 1 ;; esac done APPDIR="$HOME/Applications" APP="$APPDIR/Transcribe.AppImage" BIN="$HOME/.local/bin/transcribe" DATA="${XDG_DATA_HOME:-$HOME/.local/share}" DESKTOP="$DATA/applications/transcribe.desktop" MIMEXML="$DATA/mime/packages/transcribe.xml" ICON="$DATA/icons/hicolor/256x256/apps/transcribe.png" refresh() { command -v update-mime-database >/dev/null && update-mime-database "$DATA/mime" >/dev/null 2>&1 || true command -v update-desktop-database >/dev/null && update-desktop-database "$DATA/applications" >/dev/null 2>&1 || true } if [ "$UNINSTALL" = 1 ]; then rm -f "$APP" "$BIN" "$DESKTOP" "$MIMEXML" "$ICON" refresh echo "Removed Transcribe. Your projects, and settings in ~/.config/Transcribe, are left where they are." exit 0 fi if [ "$(uname -m)" != x86_64 ]; then echo "Transcribe for Linux is built for x86_64 only (this is $(uname -m))." >&2; exit 1 fi if pgrep -f "$APP" >/dev/null 2>&1; then echo "Transcribe is running. Quit it and run this again." >&2; exit 1 fi BASE="https://dl.anthony-tong.com/transcribe" FILE="Transcribe-1.9.1-linux-x86_64.AppImage" SHA="aab20833d4ffbe5a999d18bc122390dc181dfa5aa52031625fa62ff3fe9b9b9b" TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT echo "Downloading Transcribe 1.9.1 for Linux..." curl -fL --progress-bar -o "$TMP/$FILE" "$BASE/$FILE" echo "$SHA $TMP/$FILE" | sha256sum -c - >/dev/null || { echo "Download is corrupt (checksum mismatch). Try again." >&2; exit 1; } chmod +x "$TMP/$FILE" mkdir -p "$APPDIR" "$(dirname "$BIN")" "$(dirname "$DESKTOP")" "$(dirname "$MIMEXML")" "$(dirname "$ICON")" mv -f "$TMP/$FILE" "$APP" # How to start it here: # - Chromium's sandbox needs user namespaces in an AppImage (the .deb package has a setuid helper instead). # Ubuntu 23.10+ restricts them, and some systems turn them off; then the app only starts with --no-sandbox. # - AppImages mount themselves with FUSE; without libfuse2 they can unpack and run instead (slower start). FLAGS="" ENVS="" if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns 2>/dev/null || echo 0)" = 1 ] || ! unshare -Ur true >/dev/null 2>&1; then FLAGS="--no-sandbox" NOTE_SANDBOX=1 fi if ! { ldconfig -p 2>/dev/null || /sbin/ldconfig -p 2>/dev/null || true; } | grep -q 'libfuse\.so\.2' && ! ls /lib*/libfuse.so.2 /usr/lib*/libfuse.so.2 /lib/*-linux-gnu/libfuse.so.2 /usr/lib/*-linux-gnu/libfuse.so.2 >/dev/null 2>&1; then ENVS="APPIMAGE_EXTRACT_AND_RUN=1 " NOTE_FUSE=1 fi QUIET="" [ -n "$ENVS" ] && QUIET=" >/dev/null" # unpacking lists every file it extracts cat > "$BIN" </dev/null 2>&1 && cp "$(ls -S squashfs-root/*.png 2>/dev/null | head -1)" "$ICON" ) 2>/dev/null || true ICON_NAME=transcribe [ -f "$ICON" ] || ICON_NAME=audio-x-generic cat > "$MIMEXML" <<'EOF' Transcribe project EOF cat > "$DESKTOP" </dev/null && xdg-mime default transcribe.desktop application/x-transcribe-project >/dev/null 2>&1 || true echo "Installed Transcribe 1.9.1 to $APP" case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) echo "Add ~/.local/bin to your PATH to start it with the transcribe command (it is in your app menu either way)." ;; esac [ -n "${NOTE_SANDBOX:-}" ] && echo "Note: this system restricts the sandbox AppImages use, so Transcribe runs without it. The .deb package from the download page keeps it." [ -n "${NOTE_FUSE:-}" ] && echo "Note: libfuse2 isn't installed, so Transcribe unpacks itself on each start (a few seconds). Install libfuse2 (Ubuntu: sudo apt install libfuse2t64) for a quicker start." if [ "$STEMS" = 1 ]; then REQ="${XDG_CONFIG_HOME:-$HOME/.config}/Transcribe/stem-separator" mkdir -p "$REQ" && printf '{"gpu":true}' > "$REQ/install-requested" echo "The stem separator will download when Transcribe opens." fi if [ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]; then nohup "$BIN" >/dev/null 2>&1 & fi