AnyBot/deploy/linux/install.sh

61 lines
3.5 KiB
Bash
Raw Normal View History

#!/bin/sh
# Install AnyBot on a Linux desktop for the current user (no root needed for this part).
#
# ./deploy/linux/install.sh build from source, then install
# ./deploy/linux/install.sh --deps also install the system packages (asks for sudo)
# ./deploy/linux/install.sh --deps-only only the system packages (make deps)
#
# Puts the app in ~/.local/bin/anybot, the menu entry in ~/.local/share/applications and the
# icon in ~/.local/share/icons. Run it from the app/ folder.
set -e
cd "$(dirname "$0")/../.."
# What AnyBot uses on Linux (all optional except the first line; the app explains what's missing):
# libasound2 libxkbcommon-x11-0 libgl1 xdg-utils – the window and sound
# libnotify-bin notifications libsecret-tools saved logins (系統鑰匙圈)
# espeak-ng reading answers aloud zenity file pickers
# xclip / wl-clipboard pasting pictures; typing Chinese on GNOME/KDE Wayland
# ffmpeg video posters, Opus, demo videos
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
# docker.io the bot's own computer fonts-noto-cjk extra CJK glyphs (思源黑體/思源宋體 are built in)
DEPS_DEBIAN="libasound2 libxkbcommon-x11-0 libgl1 xdg-utils libnotify-bin libsecret-tools espeak-ng zenity xclip wl-clipboard ffmpeg docker.io fonts-noto-cjk"
DEPS_FEDORA="alsa-lib libxkbcommon-x11 mesa-libGL xdg-utils libnotify libsecret espeak-ng zenity xclip wl-clipboard ffmpeg-free moby-engine google-noto-sans-cjk-fonts"
DEPS_ARCH="alsa-lib libxkbcommon-x11 mesa xdg-utils libnotify libsecret espeak-ng zenity xclip wl-clipboard ffmpeg docker noto-fonts-cjk"
BUILD_DEBIAN="build-essential pkg-config libasound2-dev"
# The package lists above are for reference; ../../install.sh installs them (it picks the right
# names per release, e.g. libasound2t64 on Ubuntu 24.04, and installs Rust when it's missing).
if [ "${1:-}" = "--deps" ] || [ "${1:-}" = "--deps-only" ]; then
sh ./install.sh deps
fi
[ "${1:-}" = "--deps-only" ] && exit 0
OUT="${CARGO_TARGET_DIR:-target}/release/anybot"
if [ -x "$OUT" ] && [ "${1:-}" != "--rebuild" ]; then
echo "Using the existing build ($OUT)."
else
command -v cargo >/dev/null || { echo "Rust is needed to build: https://rustup.rs"; exit 1; }
cargo build --release
fi
BIN="$HOME/.local/bin"
APPS="$HOME/.local/share/applications"
ICONS="$HOME/.local/share/icons/hicolor"
mkdir -p "$BIN" "$APPS" "$ICONS/256x256/apps" "$ICONS/128x128/apps" "$ICONS/scalable/apps"
install -m 755 "$OUT" "$BIN/anybot"
install -m 644 deploy/linux/anybot.desktop "$APPS/anybot.desktop"
install -m 644 icons/anybot.svg "$ICONS/scalable/apps/anybot.svg"
"$BIN/anybot" --write-icon "$ICONS/256x256/apps/anybot.png" 256
"$BIN/anybot" --write-icon "$ICONS/128x128/apps/anybot.png" 128
command -v update-desktop-database >/dev/null && update-desktop-database "$APPS" 2>/dev/null || true
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -q "$ICONS" 2>/dev/null || true
echo "AnyBot is installed: find it in your app menu, or run: anybot"
echo "To make this computer a brain, or hands for your brain (also without a screen): anybot setup"
case ":$PATH:" in *":$BIN:"*) ;; *) echo "(Add $BIN to your PATH to start it from a terminal.)" ;; esac
if [ "${XDG_SESSION_TYPE:-}" = "wayland" ]; then
echo "Wayland: bots can see and use your screen. On GNOME/KDE the first time, a system window asks:"
echo " turn on 「允許遠端操作」 (Allow remote interaction), then press 「分享」 (Share)."
echo " Recording a demonstration (教它一項任務) needs an Xorg session."
fi