#!/bin/sh # Install md-manuscript for the current user: the binary, the icon set and the # desktop launcher. Safe to re-run; it overwrites what it installed last time. # # Everything lands under ~/.local, so no root is needed. Set PREFIX to install # somewhere else (PREFIX=/usr/local sudo ./assets/install.sh). set -eu # Resolve paths against the repo, not the working directory, so this runs from # anywhere. here=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) prefix=${PREFIX:-$HOME/.local} binary=$here/target/release/md-manuscript if [ ! -x "$binary" ]; then echo "No release binary at $binary" >&2 echo "Build it first: cargo build --release" >&2 exit 1 fi install -Dm755 "$binary" "$prefix/bin/md-manuscript" for size in 16 22 24 32 48 64 128 256; do install -Dm644 \ "$here/assets/icons/hicolor/${size}x${size}/apps/md-manuscript.png" \ "$prefix/share/icons/hicolor/${size}x${size}/apps/md-manuscript.png" done install -Dm644 "$here/assets/icons/hicolor/scalable/apps/md-manuscript.svg" \ "$prefix/share/icons/hicolor/scalable/apps/md-manuscript.svg" install -Dm644 "$here/assets/md-manuscript.desktop" \ "$prefix/share/applications/md-manuscript.desktop" # Best-effort cache refreshes: the launcher works without them, it may just take # a re-login to show up. gtk-update-icon-cache -f -t "$prefix/share/icons/hicolor" 2>/dev/null || true update-desktop-database "$prefix/share/applications" 2>/dev/null || true echo "Installed to $prefix" case ":$PATH:" in *":$prefix/bin:"*) ;; *) echo "Note: $prefix/bin is not on your PATH." >&2 ;; esac