diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bea6a9f..6d8b5e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,14 @@ jobs: run: | cargo build --locked --features wayland,portal,engine-plugins --bin uuremote-server test -f target/debug/libuu-wayland.so + - name: Debian package installs + run: | + packaging/deb/build-deb.sh 0.0.0~ci target/debug /tmp/deb + dpkg-deb -I /tmp/deb/*.deb | grep -E 'Depends|Recommends' + sudo apt-get install -y /tmp/deb/*.deb + uuremote-server --help | head -1 + test -f /usr/lib/uu-remote-linux/libuu-wayland.so + systemd-analyze verify /usr/lib/systemd/user/uuremote-native.service test-viewer: runs-on: ubuntu-22.04 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 735e1fc..cb700d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,10 +69,20 @@ jobs: cp -r contrib "$name/" tar czf "$name.tar.gz" "$name" sha256sum "$name.tar.gz" > "$name.tar.gz.sha256" + - name: Debian package + run: | + packaging/deb/build-deb.sh "${GITHUB_REF_NAME#v}" target/release . + deb=$(ls uu-remote-linux_*.deb) + sha256sum "$deb" > "$deb.sha256" + sudo apt-get install -y "./$deb" + uuremote-server --help | head -1 + systemd-analyze verify /usr/lib/systemd/user/uuremote-native.service - uses: actions/upload-artifact@v4 with: name: package-${{ matrix.arch }} - path: uu-remote-linux-*.tar.gz* + path: | + uu-remote-linux-*.tar.gz* + uu-remote-linux_*.deb* # One publisher, so the matrix legs never race to create the release. release: @@ -90,6 +100,8 @@ jobs: files: | uu-remote-linux-*.tar.gz uu-remote-linux-*.tar.gz.sha256 + uu-remote-linux_*.deb + uu-remote-linux_*.deb.sha256 # Headless NAS image (docker/), built from the release tarball published by the job above. docker: diff --git a/README.en.md b/README.en.md index 16a7106..edf8f03 100644 --- a/README.en.md +++ b/README.en.md @@ -131,7 +131,18 @@ Switching reuses one video track and pauses input until the new source sends a f ### 0. Prebuilt release package (recommended, x86_64 / aarch64) -Download `uu-remote-linux--x86_64-linux.tar.gz` (ARM64: `aarch64-linux`) from [Releases](../../releases/latest), extract it, then: +**Ubuntu / Debian (v0.2.18+)**: download `uu-remote-linux__amd64.deb` (ARM64: `arm64`), then: + +```sh +sudo apt install ./uu-remote-linux__amd64.deb +uuremote-server login # scan the QR code with the UU Remote app +systemctl --user enable --now uuremote-native.service # start with the graphical session +``` + +The deb installs the binaries, plugins, a systemd user unit and menu entries; uinput access stays opt-in (step 5). +GNOME and KDE pass the display environment to the unit; on desktops that don't (e.g. Xfce) add `DISPLAY` as in step 4. + +**Other distributions**: download `uu-remote-linux--x86_64-linux.tar.gz` (ARM64: `aarch64-linux`) from [Releases](../../releases/latest), extract it, then: ```sh install -Dm755 uuremote-server ~/.local/bin/uuremote-server diff --git a/README.md b/README.md index d3c79e1..d9e1565 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,18 @@ GNOME Portal 的控制通道不再等待授权窗口或第一帧画面:先通 ### 0. 直接用 Release 预编译包(推荐,x86_64 / aarch64) -从 [Releases](../../releases/latest) 下载 `uu-remote-linux-<版本>-x86_64-linux.tar.gz`(ARM64 选 `aarch64-linux`),解压后: +**Ubuntu / Debian(v0.2.18 起)**:下载 `uu-remote-linux_<版本>_amd64.deb`(ARM64 选 `arm64`)后: + +```sh +sudo apt install ./uu-remote-linux_<版本>_amd64.deb +uuremote-server login # 用 UU 远程 App 扫码 +systemctl --user enable --now uuremote-native.service # 随图形会话启动 +``` + +deb 会安装程序、插件、用户级 systemd 服务和应用菜单图标;uinput 权限不会自动开启(见第 5 步)。 +GNOME / KDE 会把显示环境自动传给服务;Xfce 等不传的桌面需按第 4 步补 `DISPLAY`。 + +**其他发行版**:从 [Releases](../../releases/latest) 下载 `uu-remote-linux-<版本>-x86_64-linux.tar.gz`(ARM64 选 `aarch64-linux`),解压后: ```sh install -Dm755 uuremote-server ~/.local/bin/uuremote-server diff --git a/packaging/deb/build-deb.sh b/packaging/deb/build-deb.sh new file mode 100755 index 0000000..675f156 --- /dev/null +++ b/packaging/deb/build-deb.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# Build uu-remote-linux__.deb from release binaries. +# usage: packaging/deb/build-deb.sh VERSION BIN_DIR OUT_DIR (VERSION without the leading v) +set -eu +version=$1 bin=$2 out=$3 +here=$(cd "$(dirname "$0")" && pwd) root=$(cd "$here/../.." && pwd) +case $(uname -m) in x86_64) arch=amd64 ;; aarch64) arch=arm64 ;; *) echo "unsupported arch" >&2; exit 1 ;; esac +pkg=$(mktemp -d) +trap 'rm -rf "$pkg"' EXIT +install -Dm755 "$bin/uuremote-server" "$pkg/usr/bin/uuremote-server" +[ -f "$bin/uuremote-viewer" ] && install -Dm755 "$bin/uuremote-viewer" "$pkg/usr/bin/uuremote-viewer" +for lib in libuu-wayland.so libuu-portal.so; do + [ -f "$bin/$lib" ] && install -Dm644 "$bin/$lib" "$pkg/usr/lib/uu-remote-linux/$lib" +done +install -Dm644 "$here/uuremote-native.service" "$pkg/usr/lib/systemd/user/uuremote-native.service" +install -Dm644 "$root/contrib/desktop/uu-remote-linux.desktop" "$pkg/usr/share/applications/uu-remote-linux.desktop" +[ -f "$pkg/usr/bin/uuremote-viewer" ] && install -Dm644 "$root/contrib/desktop/uu-remote-linux-viewer.desktop" "$pkg/usr/share/applications/uu-remote-linux-viewer.desktop" +install -Dm644 "$root/contrib/desktop/uu-remote-linux.svg" "$pkg/usr/share/icons/hicolor/scalable/apps/uu-remote-linux.svg" +install -Dm644 "$root/LICENSE" "$pkg/usr/share/doc/uu-remote-linux/copyright" +# uinput access is opt-in: it lets the service inject input into the whole seat. +printf '%s\n' 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' \ + > "$pkg/usr/share/doc/uu-remote-linux/60-uu-remote-linux-uinput.rules" +size=$(du -sk "$pkg/usr" | cut -f1) +# Library dependencies from the binaries themselves (the server hard, the viewer recommended). +shlibdeps() { + work=$(mktemp -d); mkdir "$work/debian" + printf 'Source: uu-remote-linux\n\nPackage: uu-remote-linux\nArchitecture: any\n' > "$work/debian/control" + (cd "$work" && dpkg-shlibdeps -O --ignore-missing-info "$1" 2>/dev/null) | sed -n 's/^shlibs:Depends=//p' + rm -rf "$work" +} +depends=$(shlibdeps "$pkg/usr/bin/uuremote-server") +recommends="" +[ -f "$pkg/usr/bin/uuremote-viewer" ] && recommends=$(shlibdeps "$pkg/usr/bin/uuremote-viewer") +[ -n "$depends" ] || { echo "dpkg-shlibdeps produced no dependencies" >&2; exit 1; } +mkdir -p "$pkg/DEBIAN" +cat > "$pkg/DEBIAN/control" < +Installed-Size: $size +Depends: $depends, ffmpeg +Recommends: ${recommends:+$recommends, }libwayland-client0, libxkbcommon0 +Suggests: libpipewire-0.3-0, libei1, wl-clipboard +Section: net +Priority: optional +Homepage: https://github.com/VallierDev/uu-remote-linux +Description: Unofficial native Linux host for NetEase UU Remote + Lets the official NetEase UU Remote clients control this Linux desktop + (X11, wlroots Wayland and GNOME/KDE Wayland through runtime plugins). + Includes the experimental uuremote-viewer. Not affiliated with NetEase. +CONTROL +cat > "$pkg/DEBIAN/postinst" <<'POSTINST' +#!/bin/sh +set -e +if [ "$1" = configure ]; then + cat <<'MSG' +uu-remote-linux installed. As your desktop user (not root): + uuremote-server login # scan the QR code with the UU Remote app + systemctl --user enable --now uuremote-native.service # start with the graphical session +Optional uinput keyboard/mouse (Wayland): see /usr/share/doc/uu-remote-linux/60-uu-remote-linux-uinput.rules +MSG +fi +POSTINST +chmod 755 "$pkg/DEBIAN/postinst" +mkdir -p "$out" +dpkg-deb --build --root-owner-group "$pkg" "$out/uu-remote-linux_${version}_${arch}.deb" diff --git a/packaging/deb/uuremote-native.service b/packaging/deb/uuremote-native.service new file mode 100644 index 0000000..4ca3732 --- /dev/null +++ b/packaging/deb/uuremote-native.service @@ -0,0 +1,17 @@ +# Installed by the uu-remote-linux .deb as a systemd *user* unit; enable it per user: +# systemctl --user enable --now uuremote-native.service +# GNOME and KDE import DISPLAY / WAYLAND_DISPLAY into the user manager when the graphical session +# starts. Desktops that do not (e.g. Xfce) can add a drop-in with Environment=DISPLAY=:0. +[Unit] +Description=UU Remote Linux host (unofficial) +After=graphical-session.target +PartOf=graphical-session.target + +[Service] +Environment=RUST_LOG=info +ExecStart=/usr/bin/uuremote-server +Restart=always +RestartSec=5 + +[Install] +WantedBy=graphical-session.target