Merge pull request #450 from Kingtous/master

Feat: Build RustDesk by Snap
This commit is contained in:
RustDesk 2022-04-19 17:00:26 +08:00 committed by GitHub
commit da166223bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 238 additions and 0 deletions

30
.github/workflows/snap-ci.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Snap CI
on:
push:
branches:
- master
paths-ignore:
- README.md
tags:
- '*'
jobs:
build-snap-master-package:
runs-on: ubuntu-18.04
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Use Snapcraft
uses: snapcore/action-build@v1
id: build
- uses: actions/upload-artifact@v2
with:
name: rustdesk.snap
path: ${{ steps.build.outputs.snap }}
# - uses: snapcore/action-publish@v1
# with:
# store_login: ${{ secrets.SNAP_TOKEN }}
# snap: ${{ steps.build.outputs.snap }}
# release: edge

View File

@ -139,6 +139,31 @@ target/release/rustdesk
Please ensure that you are running these commands from the root of the RustDesk repository, otherwise the application may be unable to find the required resources. Also note that other cargo subcommands such as `install` or `run` are not currently supported via this method as they would install or run the program inside the container instead of the host.
## How to build and run with Snap
Begin by cloning the repository and make sure snapcraft is installed in your Linux.
```sh
git clone https://github.com/rustdesk/rustdesk
# if snapcraft is installed, please skip this
sudo snap install snapcraft --classic
# build rustdesk snap package
snapcraft --use-lxd
# install rustdesk snap package, `--dangerous` flag must exists if u manually build and install rustdesk
sudo snap install rustdesk_xxx.snap --dangerous
```
Note: Some of interfaces needed by RustDesk cannot automatically connected by Snap. Please **manually** connect them by executing:
```sh
# record system audio
snap connect rustdesk:audio-record
snap connect rustdesk:pulseaudio
# observe loginctl session
snap connect rustdesk:login-session-observe
```
After steps above, RustDesk can be found in System App Menu.
## File Structure
- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: video codec, config, tcp/udp wrapper, protobuf, fs functions for file transfer, and some other utility functions

20
snap/gui/rustdesk.desktop Normal file
View File

@ -0,0 +1,20 @@
[Desktop Entry]
Version=1.0
Name=RustDesk
GenericName=Remote Desktop
Comment=Remote Desktop
Exec=rustdesk %u
Icon=${SNAP}/meta/gui/rustdesk.png
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Categories=Other;
Keywords=internet;
Actions=new-window;
X-Desktop-File-Install-Version=0.23
[Desktop Action new-window]
Name=Open a New Window

BIN
snap/gui/rustdesk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

163
snap/snapcraft.yaml Normal file
View File

@ -0,0 +1,163 @@
name: rustdesk
version: git
summary: rustdesk
description: |
rustdesk
base: core18
confinement: strict
grade: stable
plugs:
gsettings:
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes
parts:
vcpkg-packages:
plugin: nil
build-packages:
- git
- curl
- unzip
- zip
- tar
build-environment:
- PATH: ${SNAPCRAFT_PART_SRC}/vcpkg:$PATH
override-pull: |
git clone https://github.com/Microsoft/vcpkg.git --depth=1
./vcpkg/bootstrap-vcpkg.sh
vcpkg install libyuv libvpx opus
sciter-deps:
plugin: nil
build-packages:
- curl
override-pull: |
curl "https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so" -o libsciter-gtk.so
override-build: |
mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/lib/rustdesk/
cp ${SNAPCRAFT_PART_SRC}/libsciter-gtk.so ${SNAPCRAFT_PART_INSTALL}/usr/lib/rustdesk/
rustdesk:
plugin: rust
source: .
build-environment:
- VCPKG_ROOT: ${SNAPCRAFT_PART_SRC}/../../vcpkg-packages/src/vcpkg
- PATH: ${SNAPCRAFT_PART_SRC}/../../vcpkg-packages/src/vcpkg:$PATH
override-pull: |
snapcraftctl pull
python3 inline-sciter.py
rust-features:
- inline
build-packages:
- g++
- gcc
- git
- curl
- wget
- nasm
- yasm
- libgtk-3-dev
- clang
- libxcb-randr0-dev
- libxdo-dev
- libxfixes-dev
- libxcb-shape0-dev
- libxcb-xfixes0-dev
- libasound2-dev
- libpulse-dev
- cmake
- python3
stage-packages:
- libssl1.1
- libasound2
- libpulse0
- libatk-bridge2.0-0
- libgtk-3-0
- libxcb-randr0
- libxdo3
- libxfixes3
- libxcb-shape0
- libxcb-xfixes0
- libxkbcommon0
- adwaita-icon-theme
- libcanberra-gtk-module
- libgdk-pixbuf2.0-0
- libglib2.0-bin
- xdg-user-dirs
- shared-mime-info
- light-themes
- dmz-cursor-theme
- gnome-themes-standard
- ttf-ubuntu-font-family
after:
- vcpkg-packages
rustdesk-files:
plugin: nil
override-pull: |
mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/
cp ${SNAPCRAFT_PART_SRC}/../../rustdesk/src/pynput_service.py ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/
cp ${SNAPCRAFT_PART_SRC}/../../rustdesk/src/rustdesk.service ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/
python3-deps:
plugin: python
python-packages:
- pynput
layout:
/usr/share/rustdesk:
bind: $SNAP/usr/share/rustdesk
/usr/lib/rustdesk:
bind: $SNAP/usr/lib/rustdesk
apps:
rustdesk:
command: bin/rustdesk
plugs:
- network
- audio-playback
- home
- x11
- opengl
- wayland
- desktop
- desktop-legacy
- pulseaudio
- gsettings
- unity7
# must manually connect
- login-session-observe
# [option] manually connect
- audio-record
rustdesk-service:
command: bin/rustdesk --service
daemon: simple
plugs:
- network
- audio-playback
- home
- x11
- opengl
- wayland
- desktop
- desktop-legacy
- pulseaudio
- gsettings
- unity7
# must manually connect
- login-session-observe
# [option] manually connect
- audio-record