#!/bin/sh # wallrus installer — https://wallrus.pages.dev # curl -fsSL https://wallrus.pages.dev/install.sh | bash # curl -fsSL https://wallrus.pages.dev/install.sh | bash -s -- --yes # accept all defaults, no prompts # Env: WALLRUS_VERSION= WALLRUS_BIN_DIR=~/.local/bin set -eu REPO="joexk1/wallrus" BIN_DIR="${WALLRUS_BIN_DIR:-$HOME/.local/bin}" SCENES_DIR="$HOME/.local/share/wallrus/scenes" ASSUME_YES=0 for arg in "$@"; do case "$arg" in -y|--yes) ASSUME_YES=1 ;; -h|--help) sed -n 2,5p "$0" 2>/dev/null || true; exit 0 ;; esac done if [ -t 1 ]; then ESC=$(printf '\033') B="${ESC}[1m" D="${ESC}[2m" G="${ESC}[32m" Y="${ESC}[33m" R="${ESC}[31m" C="${ESC}[36m" N="${ESC}[0m" else B= D= G= Y= R= C= N= fi step() { printf '\n%s==>%s %s%s%s\n' "$C" "$N" "$B" "$*" "$N"; } ok() { printf ' %s✓%s %s\n' "$G" "$N" "$*"; } warn() { printf ' %s!%s %s\n' "$Y" "$N" "$*"; } die() { printf '\n%s✗ %s%s\n' "$R" "$*" "$N" >&2; exit 1; } # Prompts read from the terminal even when piped through `curl | bash`. TTY= if [ "$ASSUME_YES" = 0 ] && ( : /dev/null; then TTY=/dev/tty; fi ask() ( # ask "question" default(y/n) q=$1 def=$2 [ "$def" = y ] && hint="Y/n" || hint="y/N" # No terminal: --yes accepts everything; otherwise only "safe" (4th-arg) steps run. if [ -z "$TTY" ]; then [ "$ASSUME_YES" = 1 ] || [ "${3:-}" = safe ]; return; fi printf ' %s?%s %s %s[%s]%s ' "$C" "$N" "$q" "$D" "$hint" "$N" >/dev/tty read -r ans /dev/null 2>&1; } cat <<'EOF' ╦ ╦╔═╗╦ ╦ ╦═╗╦ ╦╔═╗ ║║║╠═╣║ ║ ╠╦╝║ ║╚═╗ live three.js wallpapers ╚╩╝╩ ╩╩═╝╩═╝╩╚═╚═╝╚═╝ for linux & macos EOF # ─── 1. Detect platform ─────────────────────────────────────────────── step "Detecting your system" OS=$(uname -s); ARCH=$(uname -m) TARGET= case "$OS" in Linux) case "$ARCH" in x86_64|amd64) TARGET=x86_64-unknown-linux-gnu ;; esac DISTRO=unknown [ -r /etc/os-release ] && DISTRO=$(. /etc/os-release; echo "${ID_LIKE:-} ${ID:-}") SESSION="${XDG_SESSION_TYPE:-unknown}" DESKTOP="${XDG_CURRENT_DESKTOP:-${DESKTOP_SESSION:-unknown}}" [ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ] && DESKTOP=Hyprland ok "Linux ($ARCH) · $SESSION · $DESKTOP" if [ "$SESSION" = wayland ]; then case "$DESKTOP" in *GNOME*) warn "GNOME/Mutter has no wlr-layer-shell, so wallrus will fall back to a desktop-type window there." ;; esac fi ;; Darwin) case "$ARCH" in arm64|aarch64) TARGET=aarch64-apple-darwin ;; esac ok "macOS $(sw_vers -productVersion 2>/dev/null || echo '') ($ARCH)" ;; *) die "wallrus supports Linux and macOS only (got $OS)." ;; esac need curl || die "curl is required." need tar || die "tar is required." # ─── 2. Linux runtime libraries ─────────────────────────────────────── if [ "$OS" = Linux ]; then step "Checking runtime libraries (WebKitGTK, GTK layer-shell)" missing= have_lib() { { ldconfig -p 2>/dev/null || /sbin/ldconfig -p 2>/dev/null || true; } | grep -F "$1" >/dev/null && return 0 for candidate in /usr/lib*/"$1"* /usr/lib/*/"$1"*; do [ -f "$candidate" ] && return 0 done return 1 } have_lib libwebkit2gtk-4.1.so.0 || missing=webkit have_lib libgtk-layer-shell.so.0 || missing="${missing:+$missing }layershell" if [ -z "$missing" ]; then ok "All runtime libraries found" else pkgcmd= case " $DISTRO " in *arch*) pkgcmd="sudo pacman -S --needed webkit2gtk-4.1 gtk-layer-shell" ;; *debian*|*ubuntu*) pkgcmd="sudo apt-get install -y libwebkit2gtk-4.1-0 libgtk-layer-shell0" ;; *fedora*|*rhel*) pkgcmd="sudo dnf install -y webkit2gtk4.1 gtk-layer-shell" ;; *suse*) pkgcmd="sudo zypper install -y libwebkit2gtk-4_1-0 gtk-layer-shell" ;; esac warn "Missing: $missing" if [ -n "$pkgcmd" ] && ask "Install them now with: $pkgcmd ?" y; then $pkgcmd || die "Package install failed. Run it yourself, then re-run this installer." ok "Runtime libraries installed" else warn "Install WebKitGTK 4.1 + gtk-layer-shell from your package manager before running wallrus." fi fi fi # ─── 3. Download (or build) ─────────────────────────────────────────── TMP=$(mktemp -d) trap 'rm -rf "$TMP"' 0 VERSION="${WALLRUS_VERSION:-}" if [ -z "$VERSION" ]; then release_url="https://github.com/$REPO/releases" latest_url=$(curl -fsSIL -o /dev/null -w '%{url_effective}' "$release_url/latest") || latest_url= case "$latest_url" in "$release_url/tag/"*) VERSION=${latest_url#"$release_url/tag/"} ;; esac case "$VERSION" in ''|[!a-zA-Z0-9]*|*[!a-zA-Z0-9._-]*) die "Could not determine the latest release. Visit $release_url and set WALLRUS_VERSION to a release tag." ;; esac fi PAYLOAD= if [ -n "$TARGET" ]; then step "Downloading wallrus $VERSION for $TARGET" base="https://github.com/$REPO/releases/download/$VERSION" file="wallrus-$VERSION-$TARGET.tar.gz" curl -fSL --progress-bar "$base/$file" -o "$TMP/$file" || die "Download failed: $base/$file" if curl -fsSL "$base/SHA256SUMS.txt" -o "$TMP/SHA256SUMS.txt" 2>/dev/null; then want=$(grep " $file\$" "$TMP/SHA256SUMS.txt" | awk '{print $1}') if need sha256sum; then got=$(sha256sum "$TMP/$file" | awk '{print $1}'); else got=$(shasum -a 256 "$TMP/$file" | awk '{print $1}'); fi [ -n "$want" ] && [ "$want" = "$got" ] || die "Checksum mismatch for $file" ok "Checksum verified" else warn "No SHA256SUMS.txt in this release; skipping checksum" fi mkdir -p "$TMP/x" && tar xzf "$TMP/$file" -C "$TMP/x" PAYLOAD="$TMP/x" else step "No prebuilt binary for $OS/$ARCH, so building from source" need git || die "git is required to build from source." if ! need cargo; then if ask "Rust is not installed. Install it via rustup (https://rustup.rs)?" y; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o "$TMP/rustup.sh" sh "$TMP/rustup.sh" -y --profile minimal # shellcheck disable=SC1091 . "$HOME/.cargo/env" else die "Rust is needed to build wallrus on $OS/$ARCH." fi fi git clone --depth 1 --branch "$VERSION" "https://github.com/$REPO.git" "$TMP/src" 2>/dev/null \ || git clone --depth 1 "https://github.com/$REPO.git" "$TMP/src" (cd "$TMP/src" && cargo build --release) mkdir -p "$TMP/x" && cp "$TMP/src/target/release/wallrus" "$TMP/x/" && cp -R "$TMP/src/library" "$TMP/x/" 2>/dev/null || true PAYLOAD="$TMP/x" fi # ─── 4. Install ─────────────────────────────────────────────────────── step "Installing" if pgrep -x wallrus >/dev/null 2>&1 && [ -x "$BIN_DIR/wallrus" ]; then "$BIN_DIR/wallrus" stop >/dev/null 2>&1 || true RESTART=1 fi mkdir -p "$BIN_DIR" "$SCENES_DIR" [ -L "$BIN_DIR/wallrus" ] && rm -f "$BIN_DIR/wallrus" install -m 755 "$PAYLOAD/wallrus" "$BIN_DIR/wallrus" [ "$OS" = Darwin ] && xattr -d com.apple.quarantine "$BIN_DIR/wallrus" 2>/dev/null || true ok "Binary → $BIN_DIR/wallrus" if [ -d "$PAYLOAD/library" ]; then n=0 for f in "$PAYLOAD"/library/*.js "$PAYLOAD"/library/*.html; do [ -e "$f" ] && [ ! -e "$SCENES_DIR/$(basename "$f")" ] && { cp "$f" "$SCENES_DIR/"; n=$((n+1)); } || true done [ -d "$PAYLOAD/library/_vendor" ] && cp -R "$PAYLOAD/library/_vendor" "$SCENES_DIR/" ok "$n starter scenes → $SCENES_DIR" fi W="$BIN_DIR/wallrus" "$W" --version >/dev/null 2>&1 || die "wallrus binary failed to run. Check the runtime libraries above." # ─── 5. Wizard ──────────────────────────────────────────────────────── step "Setup" if ask "Install agent skills (wallrus + wallrusify) for Claude Code, Codex & other agents?" y safe; then "$W" install-skill >/dev/null for root in "$HOME/.claude/skills" "$HOME/.agents/skills"; do # older binaries don't embed wallrusify yet [ -f "$root/wallrusify/SKILL.md" ] && continue mkdir -p "$root/wallrusify" curl -fsSL https://wallrus.pages.dev/skills/wallrusify/SKILL.md -o "$root/wallrusify/SKILL.md" 2>/dev/null || true head -1 "$root/wallrusify/SKILL.md" 2>/dev/null | grep -q '^---' || rm -rf "$root/wallrusify" # pages.dev serves index.html for 404s done ok "Skills → ~/.claude/skills & ~/.agents/skills" fi if ask "Set a wallpaper now?" y; then if "$W" random >/dev/null 2>&1 || "$W" random --online >/dev/null 2>&1; then ok "Wallpaper is live: $("$W" status --json 2>/dev/null | sed -n 's/.*"scene_title": *"\([^"]*\)".*/\1/p')" else warn "Couldn't start a wallpaper. Run \`wallrus doctor\` to see why." fi elif [ "${RESTART:-0}" = 1 ]; then "$W" restore >/dev/null 2>&1 && ok "Restored your previous wallpaper" || true fi if [ "$OS" = Darwin ]; then key="⌃⌥I"; else key="Ctrl+Alt+I"; fi if ask "Bind $key to Interactive Mode (orbit + WASD)?" y; then "$W" bind >/dev/null 2>&1 && ok "Shortcut bound: $key" || warn "Couldn't auto-bind on this desktop; run \`wallrus bind\` to see how to add it manually." fi if ask "Start wallrus automatically at login?" y; then "$W" enable >/dev/null 2>&1 && ok "Autostart enabled" || warn "Autostart failed; try \`wallrus enable\`" fi # ─── 6. PATH + summary ──────────────────────────────────────────────── case ":$PATH:" in *":$BIN_DIR:"*) ;; *) rc="$HOME/.profile" case "${SHELL:-}" in */zsh) rc="$HOME/.zshrc" ;; */bash) rc="$HOME/.bashrc" ;; */fish) rc= ;; esac if [ -n "$rc" ] && ask "$BIN_DIR is not on your PATH. Add it to $rc?" y; then printf '\nexport PATH="%s:$PATH"\n' "$BIN_DIR" >>"$rc" ok "Added to $rc (open a new terminal)" else warn "Add $BIN_DIR to your PATH (fish: fish_add_path $BIN_DIR)" fi ;; esac cat <