BlueGit

ict rusty-teams

Merge pull request #62: feat(packaging): Linux AppImage, deb, rpm and Flatpak

metis Daniel Däschle · pushed by metis

Authored 2026-11-17 · 2 weeks ago

Hash
2607e1d08a932e6c14749f9755ac92629eab072d
30 files changed +1356 −13
.github/workflows/build.yml +37 −4
@@ -1,6 +1,7 @@
1 1 # Builds per README "Quick start": `cargo build -p app`, plus the universal macOS
2 # binary from scripts/build-macos.sh. Tests live in test.yml; this file only
3 # packages the artifacts.
2 # binary from scripts/build-macos.sh and the Linux packages from
3 # packaging/linux/package.sh. Tests live in test.yml; this file only packages the
4 # artifacts.
4 5 name: Build
5 6
6 7 # Builds run for tags (the release assets); pushes are tested in test.yml.
@@ -23,7 +24,10 @@ env:
23 24 jobs:
24 25 linux:
25 26 name: Linux
26 runs-on: ubuntu-latest
27 # The oldest supported Ubuntu LTS: the binary needs the glibc it was built
28 # against, so building here lets it, the AppImage and the deb/rpm run on
29 # glibc 2.35 and newer.
30 runs-on: ubuntu-22.04
27 31 timeout-minutes: 90
28 32 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
29 33 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
@@ -41,19 +45,45 @@ jobs:
41 45
42 46 - uses: dtolnay/rust-toolchain@stable
43 47
48 # Its own key: build scripts cached on a newer Ubuntu would need a newer glibc.
44 49 - uses: Swatinem/rust-cache@v2
45 50 with:
46 key: build
51 key: build-ubuntu-22.04
47 52
48 53 - name: Build
49 54 run: cargo build -p app --release
50 55
56 # nfpm builds the deb and rpm, zsync the AppImage's .zsync; desktop-file-utils
57 # and appstream validate the metadata. AppImage tooling is downloaded by
58 # package.sh at pinned digests.
59 - name: Install packaging tools
60 env:
61 NFPM_VERSION: 2.48.0
62 NFPM_SHA256: 787af76e172dd5fc7cedf4d7c5a090a2f62be9001557a4db1103e270f90ddefd
63 run: |
64 sudo apt-get install --no-install-recommends -y zsync desktop-file-utils appstream
65 curl -fsSL -o "$RUNNER_TEMP/nfpm.deb" \
66 "https://github.com/goreleaser/nfpm/releases/download/v$NFPM_VERSION/nfpm_${NFPM_VERSION}_amd64.deb"
67 echo "$NFPM_SHA256 $RUNNER_TEMP/nfpm.deb" | sha256sum -c -
68 sudo dpkg -i "$RUNNER_TEMP/nfpm.deb"
69
70 # A tag build carries the tag's version (v0.5.0-rc.1 -> 0.5.0~rc.1 in the deb).
71 - name: Package
72 env:
73 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
74 run: packaging/linux/package.sh --skip-build --formats "appimage deb rpm"
75
51 76 # The runner is x86_64; the artifact name carries the architecture.
52 77 - uses: actions/upload-artifact@v7
53 78 with:
54 79 name: teams-linux-amd64
55 80 path: target/release/teams
56 81
82 - uses: actions/upload-artifact@v7
83 with:
84 name: teams-linux-packages
85 path: dist/release/*
86
57 87 windows:
58 88 name: Windows
59 89 runs-on: windows-latest
@@ -131,6 +161,9 @@ jobs:
131 161 cp dist/teams-linux-amd64/teams "release/rusty-teams-$TAG-linux-amd64"
132 162 cp dist/teams-windows-amd64/teams.exe "release/rusty-teams-$TAG-windows-amd64.exe"
133 163 cp dist/teams-macos/teams-macos.zip "release/rusty-teams-$TAG-macos-universal.zip"
164 # deb, rpm, AppImage and its .zsync, named rusty-teams-<version>-linux-x86_64.*;
165 # the AppImage's update information looks for that .zsync name.
166 cp dist/teams-linux-packages/* release/
134 167
135 168 - uses: softprops/action-gh-release@v3
136 169 with:
@@ -1,6 +1,7 @@
1# Builds per README "Quick start": `cargo build -p app`, plus the universal macOS
1# Builds per README "Quick start": `cargo build -p app`, plus the universal macOS
2# binary from scripts/build-macos.sh. Tests live in test.yml; this file only
2# binary from scripts/build-macos.sh and the Linux packages from
3# packages the artifacts.
3# packaging/linux/package.sh. Tests live in test.yml; this file only packages the
4# artifacts.
4name: Build
5name: Build
5
6
6# Builds run for tags (the release assets); pushes are tested in test.yml.
7# Builds run for tags (the release assets); pushes are tested in test.yml.
@@ -23,7 +24,10 @@ env:
23jobs:
24jobs:
24 linux:
25 linux:
25 name: Linux
26 name: Linux
26 runs-on: ubuntu-latest
27 # The oldest supported Ubuntu LTS: the binary needs the glibc it was built
28 # against, so building here lets it, the AppImage and the deb/rpm run on
29 # glibc 2.35 and newer.
30 runs-on: ubuntu-22.04
27 timeout-minutes: 90
31 timeout-minutes: 90
28 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
32 # webrtc-sys compiles its C++ against the hermetic libc++ inside the libwebrtc
29 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
33 # artifact, which needs a clang as new as that libc++ (clang 21 today, see
@@ -41,19 +45,45 @@ jobs:
41
45
42 - uses: dtolnay/rust-toolchain@stable
46 - uses: dtolnay/rust-toolchain@stable
43
47
48 # Its own key: build scripts cached on a newer Ubuntu would need a newer glibc.
44 - uses: Swatinem/rust-cache@v2
49 - uses: Swatinem/rust-cache@v2
45 with:
50 with:
46 key: build
51 key: build-ubuntu-22.04
47
52
48 - name: Build
53 - name: Build
49 run: cargo build -p app --release
54 run: cargo build -p app --release
50
55
56 # nfpm builds the deb and rpm, zsync the AppImage's .zsync; desktop-file-utils
57 # and appstream validate the metadata. AppImage tooling is downloaded by
58 # package.sh at pinned digests.
59 - name: Install packaging tools
60 env:
61 NFPM_VERSION: 2.48.0
62 NFPM_SHA256: 787af76e172dd5fc7cedf4d7c5a090a2f62be9001557a4db1103e270f90ddefd
63 run: |
64 sudo apt-get install --no-install-recommends -y zsync desktop-file-utils appstream
65 curl -fsSL -o "$RUNNER_TEMP/nfpm.deb" \
66 "https://github.com/goreleaser/nfpm/releases/download/v$NFPM_VERSION/nfpm_${NFPM_VERSION}_amd64.deb"
67 echo "$NFPM_SHA256 $RUNNER_TEMP/nfpm.deb" | sha256sum -c -
68 sudo dpkg -i "$RUNNER_TEMP/nfpm.deb"
69
70 # A tag build carries the tag's version (v0.5.0-rc.1 -> 0.5.0~rc.1 in the deb).
71 - name: Package
72 env:
73 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
74 run: packaging/linux/package.sh --skip-build --formats "appimage deb rpm"
75
51 # The runner is x86_64; the artifact name carries the architecture.
76 # The runner is x86_64; the artifact name carries the architecture.
52 - uses: actions/upload-artifact@v7
77 - uses: actions/upload-artifact@v7
53 with:
78 with:
54 name: teams-linux-amd64
79 name: teams-linux-amd64
55 path: target/release/teams
80 path: target/release/teams
56
81
82 - uses: actions/upload-artifact@v7
83 with:
84 name: teams-linux-packages
85 path: dist/release/*
86
57 windows:
87 windows:
58 name: Windows
88 name: Windows
59 runs-on: windows-latest
89 runs-on: windows-latest
@@ -131,6 +161,9 @@ jobs:
131 cp dist/teams-linux-amd64/teams "release/rusty-teams-$TAG-linux-amd64"
161 cp dist/teams-linux-amd64/teams "release/rusty-teams-$TAG-linux-amd64"
132 cp dist/teams-windows-amd64/teams.exe "release/rusty-teams-$TAG-windows-amd64.exe"
162 cp dist/teams-windows-amd64/teams.exe "release/rusty-teams-$TAG-windows-amd64.exe"
133 cp dist/teams-macos/teams-macos.zip "release/rusty-teams-$TAG-macos-universal.zip"
163 cp dist/teams-macos/teams-macos.zip "release/rusty-teams-$TAG-macos-universal.zip"
164 # deb, rpm, AppImage and its .zsync, named rusty-teams-<version>-linux-x86_64.*;
165 # the AppImage's update information looks for that .zsync name.
166 cp dist/teams-linux-packages/* release/
134
167
135 - uses: softprops/action-gh-release@v3
168 - uses: softprops/action-gh-release@v3
136 with:
169 with:
.github/workflows/packaging-lint.yml added +50 −0
@@ -0,0 +1,50 @@
1 # Quick static checks for the Linux packaging (seconds, no Rust build): the packaging shell
2 # scripts, the desktop entry and AppStream metadata, AppRun's desktop integration and the
3 # verified AppImage tool downloads. The packages themselves are built in build.yml.
4 name: Packaging lint
5
6 on:
7 push:
8 branches: [main]
9 paths: [".github/workflows/packaging-lint.yml", "packaging/**"]
10 pull_request:
11 paths: [".github/workflows/packaging-lint.yml", "packaging/**"]
12 workflow_dispatch:
13
14 permissions:
15 contents: read
16
17 concurrency:
18 group: ${{ github.workflow }}-${{ github.ref }}
19 cancel-in-progress: true
20
21 jobs:
22 lint:
23 name: Linux packaging
24 # Same Ubuntu as the package build in build.yml, so the validators match.
25 runs-on: ubuntu-22.04
26 timeout-minutes: 10
27 steps:
28 - uses: actions/checkout@v6
29
30 - name: Install validators
31 run: |
32 sudo apt-get update
33 sudo apt-get install --no-install-recommends -y shellcheck desktop-file-utils appstream
34
35 - name: shellcheck
36 run: shellcheck packaging/env.sh packaging/linux/*.sh packaging/linux/AppRun
37
38 - name: Desktop entry and AppStream metadata
39 run: |
40 desktop-file-validate packaging/linux/rusty-teams.desktop
41 metainfo="$RUNNER_TEMP/io.github.danieldaeschle.RustyTeams.metainfo.xml"
42 sed -e 's/@VERSION@/0.0.0/' -e "s/@DATE@/$(date -u +%Y-%m-%d)/" \
43 packaging/linux/rusty-teams.metainfo.xml.in >"$metainfo"
44 appstreamcli validate --no-net --explain "$metainfo"
45
46 - name: AppRun desktop integration
47 run: bash packaging/linux/apprun-test.sh
48
49 - name: Verified AppImage inputs
50 run: bash packaging/linux/verified-download-test.sh
@@ -0,0 +1,50 @@
1# Quick static checks for the Linux packaging (seconds, no Rust build): the packaging shell
2# scripts, the desktop entry and AppStream metadata, AppRun's desktop integration and the
3# verified AppImage tool downloads. The packages themselves are built in build.yml.
4name: Packaging lint
5
6on:
7 push:
8 branches: [main]
9 paths: [".github/workflows/packaging-lint.yml", "packaging/**"]
10 pull_request:
11 paths: [".github/workflows/packaging-lint.yml", "packaging/**"]
12 workflow_dispatch:
13
14permissions:
15 contents: read
16
17concurrency:
18 group: ${{ github.workflow }}-${{ github.ref }}
19 cancel-in-progress: true
20
21jobs:
22 lint:
23 name: Linux packaging
24 # Same Ubuntu as the package build in build.yml, so the validators match.
25 runs-on: ubuntu-22.04
26 timeout-minutes: 10
27 steps:
28 - uses: actions/checkout@v6
29
30 - name: Install validators
31 run: |
32 sudo apt-get update
33 sudo apt-get install --no-install-recommends -y shellcheck desktop-file-utils appstream
34
35 - name: shellcheck
36 run: shellcheck packaging/env.sh packaging/linux/*.sh packaging/linux/AppRun
37
38 - name: Desktop entry and AppStream metadata
39 run: |
40 desktop-file-validate packaging/linux/rusty-teams.desktop
41 metainfo="$RUNNER_TEMP/io.github.danieldaeschle.RustyTeams.metainfo.xml"
42 sed -e 's/@VERSION@/0.0.0/' -e "s/@DATE@/$(date -u +%Y-%m-%d)/" \
43 packaging/linux/rusty-teams.metainfo.xml.in >"$metainfo"
44 appstreamcli validate --no-net --explain "$metainfo"
45
46 - name: AppRun desktop integration
47 run: bash packaging/linux/apprun-test.sh
48
49 - name: Verified AppImage inputs
50 run: bash packaging/linux/verified-download-test.sh
.gitignore +1 −0
@@ -14,3 +14,4 @@ docs/design/islands/*
14 14 !docs/research/
15 15 docs/research/*
16 16 !docs/research/internal-endpoints.md
17 dist/
@@ -14,3 +14,4 @@ docs/design/islands/*
14!docs/research/
14!docs/research/
15docs/research/*
15docs/research/*
16!docs/research/internal-endpoints.md
16!docs/research/internal-endpoints.md
17dist/
README.md +1 −0
@@ -124,6 +124,7 @@ Without these env vars the calendar stays Outlook-only.
124 124 | Against Chrome on a debug port | `cargo run -p app -- --endpoint http://127.0.0.1:9222` |
125 125 | Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
126 126 | macOS .app (universal arm64 + x86_64), Xcode CLT only | `scripts/build-macos.sh crates/app teams` |
127 | Linux AppImage, deb, rpm and tar.gz in `dist/release` (needs [nfpm](https://nfpm.goreleaser.com) for deb/rpm) | `packaging/linux/package.sh` |
127 128 | Tests | `cargo test` |
128 129 | Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
129 130 | Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
@@ -124,6 +124,7 @@ Without these env vars the calendar stays Outlook-only.
124| Against Chrome on a debug port | `cargo run -p app -- --endpoint http://127.0.0.1:9222` |
124| Against Chrome on a debug port | `cargo run -p app -- --endpoint http://127.0.0.1:9222` |
125| Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
125| Windows exe from WSL/Linux | `scripts/build-windows.sh crates/app teams` |
126| macOS .app (universal arm64 + x86_64), Xcode CLT only | `scripts/build-macos.sh crates/app teams` |
126| macOS .app (universal arm64 + x86_64), Xcode CLT only | `scripts/build-macos.sh crates/app teams` |
127| Linux AppImage, deb, rpm and tar.gz in `dist/release` (needs [nfpm](https://nfpm.goreleaser.com) for deb/rpm) | `packaging/linux/package.sh` |
127| Tests | `cargo test` |
128| Tests | `cargo test` |
128| Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
129| Headless screenshot (Xvfb, xdotool, xclip, mesa-vulkan-drivers) | `cargo build -p app && scripts/headless-shot.sh shot.png -- "mousemove 450 740" "click 1" "type hello"` |
129| Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
130| Layout sweep before every UI deploy: 8 screens at 640x480 and 1920x1080, PNGs in `target/layout-sweep` (look at each) | `cargo build -p app && scripts/layout-sweep.sh` |
crates/app-base/src/linux_desktop.rs +26 −0
@@ -81,6 +81,15 @@ pub fn is_installed(executable: &Path, layout: &Layout) -> bool {
81 81 .is_some_and(|parent| canonical(parent) == canonical(&install_dir))
82 82 }
83 83
84 /// Installed by a deb/rpm (under `/usr` or `/opt`) or started from an AppImage, whose
85 /// runtime sets `APPIMAGE`. Those bring their own menu entry and updates, so the app
86 /// does not offer to install itself (and, outside the install folder, never updates itself).
87 pub fn is_packaged(executable: &Path, appimage: Option<&std::ffi::OsStr>) -> bool {
88 appimage.is_some_and(|path| !path.is_empty())
89 || executable.starts_with("/usr")
90 || executable.starts_with("/opt")
91 }
92
84 93 pub fn should_offer_install(executable: &Path, layout: &Layout, dont_ask: bool) -> bool {
85 94 !dont_ask && !is_installed(executable, layout)
86 95 }
@@ -283,6 +292,23 @@ mod tests {
283 292 );
284 293 }
285 294
295 #[test]
296 fn package_and_appimage_installs_count_as_packaged() {
297 use std::ffi::OsStr;
298 assert!(is_packaged(Path::new("/usr/bin/teams"), None));
299 assert!(is_packaged(Path::new("/opt/rusty-teams/teams"), None));
300 assert!(is_packaged(
301 Path::new("/tmp/.mount_teamsAbc/usr/bin/teams"),
302 Some(OsStr::new("/home/a/Apps/rusty-teams.AppImage"))
303 ));
304 assert!(!is_packaged(Path::new("/home/a/Downloads/teams"), None));
305 assert!(!is_packaged(
306 Path::new("/home/a/.local/share/rusty-teams/teams"),
307 Some(OsStr::new(""))
308 ));
309 assert!(!is_packaged(Path::new("/usrlocal/teams"), None));
310 }
311
286 312 #[test]
287 313 fn the_entry_starts_the_binary_and_matches_the_window() {
288 314 let entry = desktop_entry(Path::new("/home/a/my apps/te\"a$ms"));
@@ -81,6 +81,15 @@ pub fn is_installed(executable: &Path, layout: &Layout) -> bool {
81 .is_some_and(|parent| canonical(parent) == canonical(&install_dir))
81 .is_some_and(|parent| canonical(parent) == canonical(&install_dir))
82}
82}
83
83
84/// Installed by a deb/rpm (under `/usr` or `/opt`) or started from an AppImage, whose
85/// runtime sets `APPIMAGE`. Those bring their own menu entry and updates, so the app
86/// does not offer to install itself (and, outside the install folder, never updates itself).
87pub fn is_packaged(executable: &Path, appimage: Option<&std::ffi::OsStr>) -> bool {
88 appimage.is_some_and(|path| !path.is_empty())
89 || executable.starts_with("/usr")
90 || executable.starts_with("/opt")
91}
92
84pub fn should_offer_install(executable: &Path, layout: &Layout, dont_ask: bool) -> bool {
93pub fn should_offer_install(executable: &Path, layout: &Layout, dont_ask: bool) -> bool {
85 !dont_ask && !is_installed(executable, layout)
94 !dont_ask && !is_installed(executable, layout)
86}
95}
@@ -283,6 +292,23 @@ mod tests {
283 );
292 );
284 }
293 }
285
294
295 #[test]
296 fn package_and_appimage_installs_count_as_packaged() {
297 use std::ffi::OsStr;
298 assert!(is_packaged(Path::new("/usr/bin/teams"), None));
299 assert!(is_packaged(Path::new("/opt/rusty-teams/teams"), None));
300 assert!(is_packaged(
301 Path::new("/tmp/.mount_teamsAbc/usr/bin/teams"),
302 Some(OsStr::new("/home/a/Apps/rusty-teams.AppImage"))
303 ));
304 assert!(!is_packaged(Path::new("/home/a/Downloads/teams"), None));
305 assert!(!is_packaged(
306 Path::new("/home/a/.local/share/rusty-teams/teams"),
307 Some(OsStr::new(""))
308 ));
309 assert!(!is_packaged(Path::new("/usrlocal/teams"), None));
310 }
311
286 #[test]
312 #[test]
287 fn the_entry_starts_the_binary_and_matches_the_window() {
313 fn the_entry_starts_the_binary_and_matches_the_window() {
288 let entry = desktop_entry(Path::new("/home/a/my apps/te\"a$ms"));
314 let entry = desktop_entry(Path::new("/home/a/my apps/te\"a$ms"));
crates/app/assets/linux/rusty-teams.desktop deleted +0 −9
@@ -1,9 +0,0 @@
1 [Desktop Entry]
2 Type=Application
3 Name=Rusty Teams
4 Comment=A fast, native Microsoft Teams chat client
5 Exec=teams
6 Icon=rusty-teams
7 StartupWMClass=rusty-teams
8 Terminal=false
9 Categories=Network;InstantMessaging;
@@ -1,9 +0,0 @@
1[Desktop Entry]
2Type=Application
3Name=Rusty Teams
4Comment=A fast, native Microsoft Teams chat client
5Exec=teams
6Icon=rusty-teams
7StartupWMClass=rusty-teams
8Terminal=false
9Categories=Network;InstantMessaging;
crates/app/src/linux_install.rs +3 −0
@@ -20,6 +20,9 @@ pub fn start(cx: &mut App) {
20 20 let (Ok(executable), Some(layout)) = (std::env::current_exe(), Layout::current()) else {
21 21 return;
22 22 };
23 if linux_desktop::is_packaged(&executable, std::env::var_os("APPIMAGE").as_deref()) {
24 return;
25 }
23 26 if linux_desktop::is_installed(&executable, &layout) {
24 27 // Keeps the menu entry pointing at this file, e.g. after it was deleted by hand.
25 28 if !layout.desktop_file().is_file()
@@ -20,6 +20,9 @@ pub fn start(cx: &mut App) {
20 let (Ok(executable), Some(layout)) = (std::env::current_exe(), Layout::current()) else {
20 let (Ok(executable), Some(layout)) = (std::env::current_exe(), Layout::current()) else {
21 return;
21 return;
22 };
22 };
23 if linux_desktop::is_packaged(&executable, std::env::var_os("APPIMAGE").as_deref()) {
24 return;
25 }
23 if linux_desktop::is_installed(&executable, &layout) {
26 if linux_desktop::is_installed(&executable, &layout) {
24 // Keeps the menu entry pointing at this file, e.g. after it was deleted by hand.
27 // Keeps the menu entry pointing at this file, e.g. after it was deleted by hand.
25 if !layout.desktop_file().is_file()
28 if !layout.desktop_file().is_file()
docs/decisions/0021-linux-packages.md added +21 −0
@@ -0,0 +1,21 @@
1 ---
2 status: proposed
3 date: 2026-11-17
4 ---
5
6 # ADR 0021: Linux releases also ship an AppImage, a deb and an rpm
7
8 ## Context
9
10 The Linux release is a bare binary that installs and updates itself (ADR 0014). Users who manage software through their distribution, or who want a single file with a menu entry and delta updates, have no package. ADR 0014 left system packages open, as long as they do not offer the self-install. The Craft apps (PhotoCraft) already ship a Linux packaging set: one script staging an FHS tree, nfpm for deb and rpm, an AppImage with a self-integrating `AppRun`, all built on the oldest supported Ubuntu LTS. The Linux binary needs the glibc it was built against (the v0.4.0 release binary needs 2.43, newer than Ubuntu 24.04 or Debian 13 have), which is what packages built on an old distro, or a Flatpak with its own runtime, avoid.
11
12 ## Decision
13
14 `packaging/linux/package.sh` builds `rusty-teams-<version>-linux-<arch>.{AppImage,AppImage.zsync,deb,rpm,tar.gz}` the same way PhotoCraft does, and `build.yml` attaches the AppImage, its `.zsync`, the deb and the rpm to every `v*` release, next to the unchanged bare binary and tarball. The Linux release job builds on Ubuntu 22.04, so the binary needs glibc 2.35. The desktop id stays `rusty-teams` (the window's app id); the AppStream component id is `io.github.danieldaeschle.RustyTeams`. A binary under `/usr` or `/opt`, or started from an AppImage (`APPIMAGE` set), counts as packaged and does not offer to install itself; outside the install folder it never updates itself either, so packages update through the package manager and the AppImage through its `.zsync`.
15
16 ## Consequences
17
18 - deb and rpm list the libraries the binary loads with `dlopen` (Wayland, X11, Vulkan or EGL) as dependencies and the call stack's (PulseAudio, PipeWire, VA-API) as recommendations; they conflict with Microsoft's old `teams` package, which also owned `/usr/bin/teams`.
19 - The AppImage's `AppRun` writes `~/.local/share/applications/rusty-teams.desktop` like the self-install does; an entry the self-install wrote keeps its `Exec`.
20 - The Flatpak (`packaging/linux/flatpak-bundle.sh`, app id `io.github.danieldaeschle.RustyTeams`) builds but is broken and not released: the app starts the user's own browser with a debug port, and inside the sandbox it can neither see nor start the host's browsers. It needs the browser start to go through `flatpak-spawn --host`. A working Flatpak would end the glibc floor entirely, since it brings its own runtime.
21 - No package repository: deb and rpm are release downloads.
@@ -0,0 +1,21 @@
1---
2status: proposed
3date: 2026-11-17
4---
5
6# ADR 0021: Linux releases also ship an AppImage, a deb and an rpm
7
8## Context
9
10The Linux release is a bare binary that installs and updates itself (ADR 0014). Users who manage software through their distribution, or who want a single file with a menu entry and delta updates, have no package. ADR 0014 left system packages open, as long as they do not offer the self-install. The Craft apps (PhotoCraft) already ship a Linux packaging set: one script staging an FHS tree, nfpm for deb and rpm, an AppImage with a self-integrating `AppRun`, all built on the oldest supported Ubuntu LTS. The Linux binary needs the glibc it was built against (the v0.4.0 release binary needs 2.43, newer than Ubuntu 24.04 or Debian 13 have), which is what packages built on an old distro, or a Flatpak with its own runtime, avoid.
11
12## Decision
13
14`packaging/linux/package.sh` builds `rusty-teams-<version>-linux-<arch>.{AppImage,AppImage.zsync,deb,rpm,tar.gz}` the same way PhotoCraft does, and `build.yml` attaches the AppImage, its `.zsync`, the deb and the rpm to every `v*` release, next to the unchanged bare binary and tarball. The Linux release job builds on Ubuntu 22.04, so the binary needs glibc 2.35. The desktop id stays `rusty-teams` (the window's app id); the AppStream component id is `io.github.danieldaeschle.RustyTeams`. A binary under `/usr` or `/opt`, or started from an AppImage (`APPIMAGE` set), counts as packaged and does not offer to install itself; outside the install folder it never updates itself either, so packages update through the package manager and the AppImage through its `.zsync`.
15
16## Consequences
17
18- deb and rpm list the libraries the binary loads with `dlopen` (Wayland, X11, Vulkan or EGL) as dependencies and the call stack's (PulseAudio, PipeWire, VA-API) as recommendations; they conflict with Microsoft's old `teams` package, which also owned `/usr/bin/teams`.
19- The AppImage's `AppRun` writes `~/.local/share/applications/rusty-teams.desktop` like the self-install does; an entry the self-install wrote keeps its `Exec`.
20- The Flatpak (`packaging/linux/flatpak-bundle.sh`, app id `io.github.danieldaeschle.RustyTeams`) builds but is broken and not released: the app starts the user's own browser with a debug port, and inside the sandbox it can neither see nor start the host's browsers. It needs the browser start to go through `flatpak-spawn --host`. A working Flatpak would end the glibc floor entirely, since it brings its own runtime.
21- No package repository: deb and rpm are release downloads.
docs/decisions/README.md +1 −0
@@ -36,5 +36,6 @@ Statuses: `proposed`, `accepted`, `superseded`.
36 36 | [0018](0018-regional-format-is-separate-from-the-app-language.md) | Regional format is separate from the app language |
37 37 | [0019](0019-caldav-app-password-and-keyring.md) | CalDAV with app password and OS keyring |
38 38 | [0020](0020-macos-tray-and-close-to-tray.md) | macOS tray and close-to-tray match Linux |
39 | [0021](0021-linux-packages.md) | Linux releases also ship an AppImage, a deb and an rpm |
39 40
40 41 Records `0001` to `0020` are the decisions already shipped. `0001` follows Daniel's call-window note in `GUARDRAILS.md`.
@@ -36,5 +36,6 @@ Statuses: `proposed`, `accepted`, `superseded`.
36| [0018](0018-regional-format-is-separate-from-the-app-language.md) | Regional format is separate from the app language |
36| [0018](0018-regional-format-is-separate-from-the-app-language.md) | Regional format is separate from the app language |
37| [0019](0019-caldav-app-password-and-keyring.md) | CalDAV with app password and OS keyring |
37| [0019](0019-caldav-app-password-and-keyring.md) | CalDAV with app password and OS keyring |
38| [0020](0020-macos-tray-and-close-to-tray.md) | macOS tray and close-to-tray match Linux |
38| [0020](0020-macos-tray-and-close-to-tray.md) | macOS tray and close-to-tray match Linux |
39| [0021](0021-linux-packages.md) | Linux releases also ship an AppImage, a deb and an rpm |
39
40
40Records `0001` to `0020` are the decisions already shipped. `0001` follows Daniel's call-window note in `GUARDRAILS.md`.
41Records `0001` to `0020` are the decisions already shipped. `0001` follows Daniel's call-window note in `GUARDRAILS.md`.
packaging/.shellcheckrc added +3 −0
@@ -0,0 +1,3 @@
1 # shellcheck config for the packaging scripts (CI: .github/workflows/packaging-lint.yml).
2 source-path=SCRIPTDIR
3 external-sources=true
@@ -0,0 +1,3 @@
1# shellcheck config for the packaging scripts (CI: .github/workflows/packaging-lint.yml).
2source-path=SCRIPTDIR
3external-sources=true
packaging/env.sh added +53 −0
@@ -0,0 +1,53 @@
1 # shellcheck shell=bash
2 # Shared setup for the packaging scripts. Source it: `. "$(dirname "$0")/../env.sh"`.
3 #
4 # Exports:
5 # ROOT workspace root
6 # VERSION [workspace.package] version from Cargo.toml (override: RUSTY_TEAMS_VERSION)
7 # DIST output directory for release artifacts (default: $ROOT/dist/release)
8 # BUILD_DATE UTC build date, YYYY-MM-DD (override: RUSTY_TEAMS_BUILD_DATE)
9 # CARGO_TARGET_DIR cargo's target dir (default: $ROOT/target)
10
11 ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12 export ROOT
13
14 # The version lives in one place: `[workspace.package] version` in the root Cargo.toml.
15 workspace_version() {
16 awk '
17 /^\[/ { in_pkg = ($0 == "[workspace.package]") ; next }
18 in_pkg && $1 == "version" { gsub(/[" ]/, "", $3); print $3; exit }
19 ' "$ROOT/Cargo.toml"
20 }
21
22 VERSION="${RUSTY_TEAMS_VERSION:-$(workspace_version)}"
23 VERSION="${VERSION#v}"
24 if [[ -z "$VERSION" ]]; then
25 echo "error: could not read [workspace.package] version from $ROOT/Cargo.toml" >&2
26 exit 1
27 fi
28 export VERSION
29
30 DIST="${DIST:-$ROOT/dist/release}"
31 mkdir -p "$DIST"
32 export DIST
33
34 export BUILD_DATE="${RUSTY_TEAMS_BUILD_DATE:-$(date -u +%Y-%m-%d)}"
35 export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$ROOT/target}"
36
37 # Emit a GitHub Actions warning (plain stderr outside Actions).
38 warn() {
39 if [[ -n "${GITHUB_ACTIONS:-}" ]]; then echo "::warning::$*"; else echo "warning: $*" >&2; fi
40 }
41
42 # Copy licence and readme files that exist into a package directory.
43 copy_docs() {
44 local dest="$1" f
45 for f in README.md LICENSE; do
46 if [[ -f "$ROOT/$f" ]]; then cp "$ROOT/$f" "$dest/"; fi
47 done
48 }
49
50 # Portable SHA-256 of a file (prints just the hash).
51 sha256() {
52 if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi
53 }
@@ -0,0 +1,53 @@
1# shellcheck shell=bash
2# Shared setup for the packaging scripts. Source it: `. "$(dirname "$0")/../env.sh"`.
3#
4# Exports:
5# ROOT workspace root
6# VERSION [workspace.package] version from Cargo.toml (override: RUSTY_TEAMS_VERSION)
7# DIST output directory for release artifacts (default: $ROOT/dist/release)
8# BUILD_DATE UTC build date, YYYY-MM-DD (override: RUSTY_TEAMS_BUILD_DATE)
9# CARGO_TARGET_DIR cargo's target dir (default: $ROOT/target)
10
11ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12export ROOT
13
14# The version lives in one place: `[workspace.package] version` in the root Cargo.toml.
15workspace_version() {
16 awk '
17 /^\[/ { in_pkg = ($0 == "[workspace.package]") ; next }
18 in_pkg && $1 == "version" { gsub(/[" ]/, "", $3); print $3; exit }
19 ' "$ROOT/Cargo.toml"
20}
21
22VERSION="${RUSTY_TEAMS_VERSION:-$(workspace_version)}"
23VERSION="${VERSION#v}"
24if [[ -z "$VERSION" ]]; then
25 echo "error: could not read [workspace.package] version from $ROOT/Cargo.toml" >&2
26 exit 1
27fi
28export VERSION
29
30DIST="${DIST:-$ROOT/dist/release}"
31mkdir -p "$DIST"
32export DIST
33
34export BUILD_DATE="${RUSTY_TEAMS_BUILD_DATE:-$(date -u +%Y-%m-%d)}"
35export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$ROOT/target}"
36
37# Emit a GitHub Actions warning (plain stderr outside Actions).
38warn() {
39 if [[ -n "${GITHUB_ACTIONS:-}" ]]; then echo "::warning::$*"; else echo "warning: $*" >&2; fi
40}
41
42# Copy licence and readme files that exist into a package directory.
43copy_docs() {
44 local dest="$1" f
45 for f in README.md LICENSE; do
46 if [[ -f "$ROOT/$f" ]]; then cp "$ROOT/$f" "$dest/"; fi
47 done
48}
49
50# Portable SHA-256 of a file (prints just the hash).
51sha256() {
52 if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi
53}
packaging/linux/AppRun added +218 −0
@@ -0,0 +1,218 @@
1 #!/bin/sh
2 # Rusty Teams AppImage entry point (packaging/linux/AppRun; installed by package.sh).
3 #
4 # On Wayland the compositor resolves a window's dock icon by taking the window's
5 # app_id (rusty-teams) and looking up an installed .desktop file. An AppImage
6 # installs nothing, so every AppImage run would otherwise show the generic
7 # "Wayland" icon. Best-effort desktop integration: on first run (and whenever the
8 # AppImage's path changes) install the .desktop entry and the hicolor icons into
9 # $XDG_DATA_HOME, then launch. Every failure here must leave the launch untouched.
10 # Opt out with RUSTY_TEAMS_NO_DESKTOP_INTEGRATION=1.
11 #
12 # The app's own "install to ~/.local/share/rusty-teams" offer writes the same
13 # rusty-teams.desktop; an entry whose Exec is not this AppImage counts as a user
14 # customization below and keeps its Exec. The app skips that offer when it runs
15 # from an AppImage (linux_desktop::is_packaged).
16
17 set -u
18
19 APPDIR="$(dirname "$(readlink -f "$0")")"
20 DESK_ID=rusty-teams
21
22 # A damaged snapshot is not evidence that an absent user key was newly added.
23 # Treat it like a legacy installation and preserve the existing launcher.
24 valid_baseline() {
25 [ -f "$1" ] && [ ! -L "$1" ] && [ -s "$1" ] || return 1
26 awk '
27 /^\[/ { group = $0; if (group == "[Desktop Entry]") sections++; next }
28 /^[ \t]*($|#)/ { next }
29 /^[^= \t][^=]*=/ {
30 name = $0; sub(/=.*/, "", name)
31 k = group SUBSEP name
32 if (seen[k]++) bad = 1
33 if (group == "[Desktop Entry]") {
34 if ($0 == "Type=Application") type = 1
35 if ($0 ~ /^Name=.+$/) title = 1
36 if ($0 ~ /^Exec=".+"$/) executable = 1
37 }
38 next
39 }
40 { bad = 1 }
41 END { exit !(sections == 1 && type && title && executable && !bad) }
42 ' "$1"
43 }
44
45 integrate() {
46 case "${RUSTY_TEAMS_NO_DESKTOP_INTEGRATION:-}" in
47 1 | true | yes) return 0 ;;
48 esac
49 # The AppImage runtime exports $APPIMAGE; without it (an extracted AppDir) there
50 # is no path to register and nothing to do.
51 appimage="${APPIMAGE:-}"
52 [ -n "$appimage" ] && [ -f "$appimage" ] || return 0
53 appimage="$(readlink -f "$appimage")" || return 0
54 # Exec= is parsed by the desktop: a path holding a quote, backquote, dollar, backslash,
55 # percent or a line break would need escaping (or could add lines), so skip integration.
56 case "$appimage" in
57 *[\"\`\$\\%]* | *'
58 '*) return 0 ;;
59 esac
60 home="${HOME:-}"
61 [ -n "$home" ] || return 0
62 data="${XDG_DATA_HOME:-$home/.local/share}"
63 src_desktop="$APPDIR/usr/share/applications/$DESK_ID.desktop"
64 [ -f "$src_desktop" ] || return 0
65
66 # If another integrator already registered a .desktop whose Exec points at this
67 # AppImage, do not write a second launcher; remove our own if one is left over,
68 # and still install the hicolor icons below. $DESKTOPINTEGRATION is not that
69 # signal: the entry sets X-AppImage-Integrate=false, so AppImageLauncher skips the
70 # AppImage and still exports the variable on its binfmt bypass. Treating it as
71 # "already integrated" would leave the menu with no entry.
72 apps="$data/applications"
73 mkdir -p "$apps" 2>/dev/null || return 0
74 desktop="$apps/$DESK_ID.desktop"
75 baseline="$apps/.$DESK_ID.generated"
76 external=0
77 for f in "$apps"/*.desktop; do
78 if [ ! -f "$f" ] || [ "$f" = "$apps/$DESK_ID.desktop" ]; then
79 continue
80 fi
81 if grep '^Exec=' "$f" 2>/dev/null | grep -Fq "$appimage"; then
82 external=1
83 break
84 fi
85 done
86 # AM / AppMan install their own launcher, whose Exec runs a command on
87 # PATH rather than this AppImage, so the check above misses it. AM's author
88 # names the only two places it writes one: system-wide for AM, per user for
89 # AppMan and rootless installs.
90 for f in /usr/local/share/applications/rusty-teams-AM.desktop "$apps/rusty-teams-AM.desktop"; do
91 if [ -f "$f" ]; then
92 external=1
93 break
94 fi
95 done
96 if [ -L "$desktop" ] || [ -L "$baseline" ] ||
97 { [ -e "$desktop" ] && [ ! -f "$desktop" ]; } ||
98 { [ -e "$baseline" ] && [ ! -f "$baseline" ]; }; then
99 # A link (including a dangling one) or special file is not our installation.
100 # Leave both launcher and snapshot alone; icons may still be installed below.
101 :
102 elif [ "$external" = 1 ]; then
103 # Only a byte-identical, valid generated snapshot proves this is ours to
104 # remove. A customized or legacy launcher belongs to the user.
105 if [ -f "$desktop" ] && valid_baseline "$baseline" && cmp -s "$baseline" "$desktop" && [ ! -L "$desktop" ]; then
106 if rm -f "$desktop" 2>/dev/null; then
107 command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$apps" >/dev/null 2>&1
108 fi
109 fi
110 else
111 # Rewrite Exec to this AppImage (the binary is not on the host PATH) and drop
112 # TryExec, which would hide the entry; everything else is shipped as packaged.
113 tmp="$apps/.$DESK_ID.tmp.$$"
114 esc="$(printf '%s' "$appimage" | sed 's/[\\&|]/\\&/g')"
115 if sed -e "s|^Exec=.*|Exec=\"$esc\"|" -e '/^TryExec=/d' "$src_desktop" 2>/dev/null >"$tmp"; then
116 generated="$tmp.generated"
117 cp "$tmp" "$generated" 2>/dev/null || { rm -f "$tmp"; return 0; }
118 if [ -f "$desktop" ]; then
119 # Three-way merge: update shipped keys only if the user has not changed
120 # them. Keep custom keys, comments and deletions. The snapshot is hidden
121 # and has no .desktop suffix, so desktop menus do not discover it.
122 # For older installs without a snapshot, the current template is the
123 # conservative baseline. An unknown previous executable is left alone.
124 previous="$baseline"
125 bootstrap=0
126 if ! valid_baseline "$previous"; then
127 previous="$tmp.previous"
128 cp "$generated" "$previous" 2>/dev/null || { rm -f "$tmp" "$generated"; return 0; }
129 bootstrap=1
130 fi
131 if ! awk -v bootstrap="$bootstrap" '
132 function key(line) {
133 if (line ~ /^\[/) { group = line; return "" }
134 if (line ~ /^[^#= \t][^=]*=/) {
135 name = line; sub(/=.*/, "", name); return group SUBSEP name
136 }
137 return ""
138 }
139 FNR == 1 { group = "" }
140 FILENAME == ARGV[1] {
141 k = key($0); if (k != "") old[k] = $0
142 if (group == "[Desktop Entry]" && $0 ~ /^Exec=".*"$/)
143 old_exec = substr($0, 6)
144 next
145 }
146 FILENAME == ARGV[2] {
147 k = key($0); if (k != "") { fresh[k] = $0; order[++n] = k }
148 if (group == "[Desktop Entry]" && $0 ~ /^Exec=/)
149 new_exec = substr($0, 6)
150 next
151 }
152 function additions( i, k) {
153 for (i = 1; i <= n; i++) {
154 k = order[i]
155 if (index(k, "[Desktop Entry]" SUBSEP) == 1 && !(k in old) && !(k in seen))
156 print fresh[k]
157 }
158 }
159 {
160 if ($0 ~ /^\[/ && group == "[Desktop Entry]") additions()
161 k = key($0)
162 if (k != "") {
163 seen[k] = 1
164 if (k in old && $0 == old[k]) {
165 if (k in fresh) print fresh[k]
166 next
167 }
168 if (group == "[Desktop Entry]" && name == "Exec") {
169 # Literal substitution, never a regex or shell evaluation: keep
170 # environment wrappers and arguments around the managed path.
171 pos = index($0, old_exec)
172 prefix = substr($0, 1, pos - 1)
173 if (old_exec != "" && pos > 0 && prefix ~ /^Exec=(env[ \t]+([^ \t=]+=[^ \t]*[ \t]+)*)?$/)
174 $0 = substr($0, 1, pos - 1) new_exec substr($0, pos + length(old_exec))
175 }
176 }
177 print
178 }
179 END { if (group == "[Desktop Entry]") additions() }
180 ' "$previous" "$generated" "$desktop" >"$tmp"; then
181 rm -f "$tmp" "$generated"
182 [ "$bootstrap" = 0 ] || rm -f "$previous"
183 return 0
184 fi
185 [ "$bootstrap" = 0 ] || rm -f "$previous"
186 fi
187 if cmp -s "$tmp" "$desktop"; then
188 rm -f "$tmp"
189 else
190 if mv -f "$tmp" "$desktop" 2>/dev/null; then
191 command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$apps" >/dev/null 2>&1
192 else
193 rm -f "$tmp" "$generated"
194 return 0
195 fi
196 fi
197 mv -f "$generated" "$baseline" 2>/dev/null || rm -f "$generated"
198 else
199 rm -f "$tmp"
200 return 0
201 fi
202
203 fi
204
205 # Icons: per-file compare so an unchanged install costs a handful of cmp calls.
206 src_icons="$APPDIR/usr/share/icons/hicolor"
207 [ -d "$src_icons" ] || return 0
208 icons="$data/icons/hicolor"
209 (cd "$src_icons" && find . -type f) | while IFS= read -r rel; do
210 mkdir -p "$icons/$(dirname "$rel")" 2>/dev/null || continue
211 if ! cmp -s "$src_icons/$rel" "$icons/$rel"; then
212 cp "$src_icons/$rel" "$icons/$rel" 2>/dev/null || true
213 fi
214 done
215 }
216
217 integrate
218 exec "$APPDIR/usr/bin/teams" "$@"
@@ -0,0 +1,218 @@
1#!/bin/sh
2# Rusty Teams AppImage entry point (packaging/linux/AppRun; installed by package.sh).
3#
4# On Wayland the compositor resolves a window's dock icon by taking the window's
5# app_id (rusty-teams) and looking up an installed .desktop file. An AppImage
6# installs nothing, so every AppImage run would otherwise show the generic
7# "Wayland" icon. Best-effort desktop integration: on first run (and whenever the
8# AppImage's path changes) install the .desktop entry and the hicolor icons into
9# $XDG_DATA_HOME, then launch. Every failure here must leave the launch untouched.
10# Opt out with RUSTY_TEAMS_NO_DESKTOP_INTEGRATION=1.
11#
12# The app's own "install to ~/.local/share/rusty-teams" offer writes the same
13# rusty-teams.desktop; an entry whose Exec is not this AppImage counts as a user
14# customization below and keeps its Exec. The app skips that offer when it runs
15# from an AppImage (linux_desktop::is_packaged).
16
17set -u
18
19APPDIR="$(dirname "$(readlink -f "$0")")"
20DESK_ID=rusty-teams
21
22# A damaged snapshot is not evidence that an absent user key was newly added.
23# Treat it like a legacy installation and preserve the existing launcher.
24valid_baseline() {
25 [ -f "$1" ] && [ ! -L "$1" ] && [ -s "$1" ] || return 1
26 awk '
27 /^\[/ { group = $0; if (group == "[Desktop Entry]") sections++; next }
28 /^[ \t]*($|#)/ { next }
29 /^[^= \t][^=]*=/ {
30 name = $0; sub(/=.*/, "", name)
31 k = group SUBSEP name
32 if (seen[k]++) bad = 1
33 if (group == "[Desktop Entry]") {
34 if ($0 == "Type=Application") type = 1
35 if ($0 ~ /^Name=.+$/) title = 1
36 if ($0 ~ /^Exec=".+"$/) executable = 1
37 }
38 next
39 }
40 { bad = 1 }
41 END { exit !(sections == 1 && type && title && executable && !bad) }
42 ' "$1"
43}
44
45integrate() {
46 case "${RUSTY_TEAMS_NO_DESKTOP_INTEGRATION:-}" in
47 1 | true | yes) return 0 ;;
48 esac
49 # The AppImage runtime exports $APPIMAGE; without it (an extracted AppDir) there
50 # is no path to register and nothing to do.
51 appimage="${APPIMAGE:-}"
52 [ -n "$appimage" ] && [ -f "$appimage" ] || return 0
53 appimage="$(readlink -f "$appimage")" || return 0
54 # Exec= is parsed by the desktop: a path holding a quote, backquote, dollar, backslash,
55 # percent or a line break would need escaping (or could add lines), so skip integration.
56 case "$appimage" in
57 *[\"\`\$\\%]* | *'
58'*) return 0 ;;
59 esac
60 home="${HOME:-}"
61 [ -n "$home" ] || return 0
62 data="${XDG_DATA_HOME:-$home/.local/share}"
63 src_desktop="$APPDIR/usr/share/applications/$DESK_ID.desktop"
64 [ -f "$src_desktop" ] || return 0
65
66 # If another integrator already registered a .desktop whose Exec points at this
67 # AppImage, do not write a second launcher; remove our own if one is left over,
68 # and still install the hicolor icons below. $DESKTOPINTEGRATION is not that
69 # signal: the entry sets X-AppImage-Integrate=false, so AppImageLauncher skips the
70 # AppImage and still exports the variable on its binfmt bypass. Treating it as
71 # "already integrated" would leave the menu with no entry.
72 apps="$data/applications"
73 mkdir -p "$apps" 2>/dev/null || return 0
74 desktop="$apps/$DESK_ID.desktop"
75 baseline="$apps/.$DESK_ID.generated"
76 external=0
77 for f in "$apps"/*.desktop; do
78 if [ ! -f "$f" ] || [ "$f" = "$apps/$DESK_ID.desktop" ]; then
79 continue
80 fi
81 if grep '^Exec=' "$f" 2>/dev/null | grep -Fq "$appimage"; then
82 external=1
83 break
84 fi
85 done
86 # AM / AppMan install their own launcher, whose Exec runs a command on
87 # PATH rather than this AppImage, so the check above misses it. AM's author
88 # names the only two places it writes one: system-wide for AM, per user for
89 # AppMan and rootless installs.
90 for f in /usr/local/share/applications/rusty-teams-AM.desktop "$apps/rusty-teams-AM.desktop"; do
91 if [ -f "$f" ]; then
92 external=1
93 break
94 fi
95 done
96 if [ -L "$desktop" ] || [ -L "$baseline" ] ||
97 { [ -e "$desktop" ] && [ ! -f "$desktop" ]; } ||
98 { [ -e "$baseline" ] && [ ! -f "$baseline" ]; }; then
99 # A link (including a dangling one) or special file is not our installation.
100 # Leave both launcher and snapshot alone; icons may still be installed below.
101 :
102 elif [ "$external" = 1 ]; then
103 # Only a byte-identical, valid generated snapshot proves this is ours to
104 # remove. A customized or legacy launcher belongs to the user.
105 if [ -f "$desktop" ] && valid_baseline "$baseline" && cmp -s "$baseline" "$desktop" && [ ! -L "$desktop" ]; then
106 if rm -f "$desktop" 2>/dev/null; then
107 command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$apps" >/dev/null 2>&1
108 fi
109 fi
110 else
111 # Rewrite Exec to this AppImage (the binary is not on the host PATH) and drop
112 # TryExec, which would hide the entry; everything else is shipped as packaged.
113 tmp="$apps/.$DESK_ID.tmp.$$"
114 esc="$(printf '%s' "$appimage" | sed 's/[\\&|]/\\&/g')"
115 if sed -e "s|^Exec=.*|Exec=\"$esc\"|" -e '/^TryExec=/d' "$src_desktop" 2>/dev/null >"$tmp"; then
116 generated="$tmp.generated"
117 cp "$tmp" "$generated" 2>/dev/null || { rm -f "$tmp"; return 0; }
118 if [ -f "$desktop" ]; then
119 # Three-way merge: update shipped keys only if the user has not changed
120 # them. Keep custom keys, comments and deletions. The snapshot is hidden
121 # and has no .desktop suffix, so desktop menus do not discover it.
122 # For older installs without a snapshot, the current template is the
123 # conservative baseline. An unknown previous executable is left alone.
124 previous="$baseline"
125 bootstrap=0
126 if ! valid_baseline "$previous"; then
127 previous="$tmp.previous"
128 cp "$generated" "$previous" 2>/dev/null || { rm -f "$tmp" "$generated"; return 0; }
129 bootstrap=1
130 fi
131 if ! awk -v bootstrap="$bootstrap" '
132 function key(line) {
133 if (line ~ /^\[/) { group = line; return "" }
134 if (line ~ /^[^#= \t][^=]*=/) {
135 name = line; sub(/=.*/, "", name); return group SUBSEP name
136 }
137 return ""
138 }
139 FNR == 1 { group = "" }
140 FILENAME == ARGV[1] {
141 k = key($0); if (k != "") old[k] = $0
142 if (group == "[Desktop Entry]" && $0 ~ /^Exec=".*"$/)
143 old_exec = substr($0, 6)
144 next
145 }
146 FILENAME == ARGV[2] {
147 k = key($0); if (k != "") { fresh[k] = $0; order[++n] = k }
148 if (group == "[Desktop Entry]" && $0 ~ /^Exec=/)
149 new_exec = substr($0, 6)
150 next
151 }
152 function additions( i, k) {
153 for (i = 1; i <= n; i++) {
154 k = order[i]
155 if (index(k, "[Desktop Entry]" SUBSEP) == 1 && !(k in old) && !(k in seen))
156 print fresh[k]
157 }
158 }
159 {
160 if ($0 ~ /^\[/ && group == "[Desktop Entry]") additions()
161 k = key($0)
162 if (k != "") {
163 seen[k] = 1
164 if (k in old && $0 == old[k]) {
165 if (k in fresh) print fresh[k]
166 next
167 }
168 if (group == "[Desktop Entry]" && name == "Exec") {
169 # Literal substitution, never a regex or shell evaluation: keep
170 # environment wrappers and arguments around the managed path.
171 pos = index($0, old_exec)
172 prefix = substr($0, 1, pos - 1)
173 if (old_exec != "" && pos > 0 && prefix ~ /^Exec=(env[ \t]+([^ \t=]+=[^ \t]*[ \t]+)*)?$/)
174 $0 = substr($0, 1, pos - 1) new_exec substr($0, pos + length(old_exec))
175 }
176 }
177 print
178 }
179 END { if (group == "[Desktop Entry]") additions() }
180 ' "$previous" "$generated" "$desktop" >"$tmp"; then
181 rm -f "$tmp" "$generated"
182 [ "$bootstrap" = 0 ] || rm -f "$previous"
183 return 0
184 fi
185 [ "$bootstrap" = 0 ] || rm -f "$previous"
186 fi
187 if cmp -s "$tmp" "$desktop"; then
188 rm -f "$tmp"
189 else
190 if mv -f "$tmp" "$desktop" 2>/dev/null; then
191 command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$apps" >/dev/null 2>&1
192 else
193 rm -f "$tmp" "$generated"
194 return 0
195 fi
196 fi
197 mv -f "$generated" "$baseline" 2>/dev/null || rm -f "$generated"
198 else
199 rm -f "$tmp"
200 return 0
201 fi
202
203 fi
204
205 # Icons: per-file compare so an unchanged install costs a handful of cmp calls.
206 src_icons="$APPDIR/usr/share/icons/hicolor"
207 [ -d "$src_icons" ] || return 0
208 icons="$data/icons/hicolor"
209 (cd "$src_icons" && find . -type f) | while IFS= read -r rel; do
210 mkdir -p "$icons/$(dirname "$rel")" 2>/dev/null || continue
211 if ! cmp -s "$src_icons/$rel" "$icons/$rel"; then
212 cp "$src_icons/$rel" "$icons/$rel" 2>/dev/null || true
213 fi
214 done
215}
216
217integrate
218exec "$APPDIR/usr/bin/teams" "$@"
packaging/linux/apprun-test.sh added +289 −0
@@ -0,0 +1,289 @@
1 #!/usr/bin/env bash
2 # Smoke test for packaging/linux/AppRun: the AppImage's desktop integration writes
3 # and refreshes the host .desktop entry and icons, is idempotent, honours the opt-out
4 # and an unwritable HOME, and always launches the app.
5 #
6 # Runs in seconds with no build (CI: .github/workflows/packaging-lint.yml).
7 set -euo pipefail
8
9 HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10 APP_ID=rusty-teams
11
12 TMP="$(mktemp -d)"
13 trap 'rm -rf "$TMP"' EXIT
14
15 # Fake AppDir with the real AppRun, .desktop template, icons, and a stub binary.
16 APPDIR="$TMP/RustyTeams.AppDir"
17 mkdir -p "$APPDIR/usr/bin"
18 install -Dm755 "$HERE/AppRun" "$APPDIR/AppRun"
19 install -Dm644 "$HERE/$APP_ID.desktop" "$APPDIR/usr/share/applications/$APP_ID.desktop"
20 mkdir -p "$APPDIR/usr/share/icons"
21 cp -R "$HERE/hicolor" "$APPDIR/usr/share/icons/"
22 printf '#!/bin/sh\necho "stub: $*"\n' >"$APPDIR/usr/bin/teams"
23 chmod +x "$APPDIR/usr/bin/teams"
24
25 APPIMAGE="$TMP/rusty teams test.AppImage" # spaces on purpose: Exec must stay quoted
26 : >"$APPIMAGE"
27 export APPIMAGE
28 export HOME="$TMP/home"
29 export XDG_DATA_HOME="$HOME/.local/share"
30 unset DESKTOPINTEGRATION RUSTY_TEAMS_NO_DESKTOP_INTEGRATION
31 mkdir -p "$HOME"
32
33 fail() {
34 echo "FAIL: $*" >&2
35 exit 1
36 }
37
38 # 1. Launch works and passes arguments through.
39 out="$("$APPDIR/AppRun" open file.png)" || fail "AppRun exited non-zero"
40 [[ "$out" = "stub: open file.png" ]] || fail "arguments not forwarded: $out"
41
42 DESKTOP="$XDG_DATA_HOME/applications/$APP_ID.desktop"
43 [[ -f "$DESKTOP" ]] || fail "desktop entry not installed"
44
45 # 2. Exec rewritten to the AppImage (quoted, spaces intact), TryExec dropped,
46 # everything else preserved from the packaged entry.
47 expected_exec="Exec=\"$(readlink -f "$APPIMAGE")\""
48 grep -Fxq "$expected_exec" "$DESKTOP" || fail "Exec not rewritten: $(grep '^Exec=' "$DESKTOP")"
49 grep -q '^TryExec=' "$DESKTOP" && fail "TryExec kept, the entry would be hidden"
50 grep -Fxq "Icon=$APP_ID" "$DESKTOP" || fail "Icon line lost"
51 grep -Fxq "X-AppImage-Integrate=false" "$DESKTOP" || fail "X-AppImage-Integrate=false missing"
52 grep -Fxq 'Categories=Network;InstantMessaging;Chat;' "$DESKTOP" || fail "metadata lines lost"
53 if command -v desktop-file-validate >/dev/null; then
54 desktop-file-validate "$DESKTOP" || fail "generated desktop entry is invalid"
55 fi
56
57 # 3. Icons landed under the name the .desktop entry references.
58 for f in "16x16/apps/$APP_ID.png" "256x256/apps/$APP_ID.png"; do
59 [[ -f "$XDG_DATA_HOME/icons/hicolor/$f" ]] || fail "icon missing: $f"
60 done
61
62 # 4. Idempotent: a second launch must not rewrite anything (inode unchanged).
63 before="$(stat -c %i "$DESKTOP")"
64 out="$("$APPDIR/AppRun")" || fail "second launch exited non-zero"
65 [[ "$out" = "stub: " ]] || fail "second launch output: $out"
66 after="$(stat -c %i "$DESKTOP")"
67 [[ "$before" = "$after" ]] || fail "desktop entry rewritten although unchanged"
68
69 # 5. Moving the AppImage refreshes Exec.
70 mv "$APPIMAGE" "$TMP/moved.AppImage"
71 export APPIMAGE="$TMP/moved.AppImage"
72 "$APPDIR/AppRun" >/dev/null || fail "launch after move exited non-zero"
73 grep -Fxq "Exec=\"$(readlink -f "$APPIMAGE")\"" "$DESKTOP" || fail "Exec not refreshed after move"
74
75 # Customized launch options and metadata survive launches and relocation .
76 old_path="$(readlink -f "$APPIMAGE")"
77 sed -i "s|^Exec=.*|Exec=env WAYLAND_DISPLAY= \"$old_path\" --custom|; s|^Name=.*|Name=My Teams|" "$DESKTOP"
78 printf '\nX-User-Setting=keep me\n' >>"$DESKTOP"
79 cp "$DESKTOP" "$TMP/custom.desktop"
80 before="$(stat -c %i "$DESKTOP")"
81 "$APPDIR/AppRun" >/dev/null
82 cmp -s "$DESKTOP" "$TMP/custom.desktop" || fail "customized launcher overwritten"
83 [ "$before" = "$(stat -c %i "$DESKTOP")" ] || fail "custom launcher rewritten although unchanged"
84 mv "$APPIMAGE" "$TMP/new version.AppImage"
85 export APPIMAGE="$TMP/new version.AppImage"
86 "$APPDIR/AppRun" >/dev/null
87 grep -Fxq "Exec=env WAYLAND_DISPLAY= \"$APPIMAGE\" --custom" "$DESKTOP" || fail "custom Exec not relocated"
88 grep -Fxq 'Name=My Teams' "$DESKTOP" || fail "custom Name lost"
89 grep -Fxq 'X-User-Setting=keep me' "$DESKTOP" || fail "custom key lost"
90
91 # Packaged updates apply only to untouched keys; user deletions stay deleted.
92 sed -i '/^Comment=/d' "$DESKTOP"
93 sed -i 's/^Name=.*/Name=Packaged update/; s/^Categories=.*/Categories=Graphics;/; s/^Comment=.*/Comment=Updated description/' "$APPDIR/usr/share/applications/$APP_ID.desktop"
94 printf '\nX-New-Packaged-Key=added\n' >>"$APPDIR/usr/share/applications/$APP_ID.desktop"
95 "$APPDIR/AppRun" >/dev/null
96 grep -Fxq 'Name=My Teams' "$DESKTOP" || fail "packaged update erased custom Name"
97 grep -Fxq 'Categories=Graphics;' "$DESKTOP" || fail "untouched metadata not updated"
98 grep -q '^Comment=' "$DESKTOP" && fail "user deletion undone"
99 grep -Fxq 'X-New-Packaged-Key=added' "$DESKTOP" || fail "new packaged key missing"
100 if command -v desktop-file-validate >/dev/null; then
101 desktop-file-validate "$DESKTOP" || fail "customized entry is invalid"
102 fi
103
104 # A replaced executable may mention the old AppImage as an argument: leave it.
105 sed -i "s|^Exec=.*|Exec=\"/custom/wrapper\" \"$APPIMAGE\"|" "$DESKTOP"
106 expected_wrapper="$(grep '^Exec=' "$DESKTOP")"
107 mv "$APPIMAGE" "$TMP/another version.AppImage"
108 export APPIMAGE="$TMP/another version.AppImage"
109 "$APPDIR/AppRun" >/dev/null
110 grep -Fxq "$expected_wrapper" "$DESKTOP" || fail "wrapper argument mistaken for managed executable"
111
112 # Existing launchers from before snapshots: bootstrap without losing edits.
113 rm -f "$XDG_DATA_HOME/applications/.$APP_ID.generated"
114 cp "$DESKTOP" "$TMP/legacy.desktop"
115 "$APPDIR/AppRun" >/dev/null
116 cmp -s "$DESKTOP" "$TMP/legacy.desktop" || fail "legacy custom launcher overwritten"
117 rm -f "$XDG_DATA_HOME/applications/.$APP_ID.generated"
118 sed -i 's|^Exec=.*|Exec="/custom/wrapper"|' "$DESKTOP"
119 "$APPDIR/AppRun" >/dev/null
120 grep -Fxq 'Exec="/custom/wrapper"' "$DESKTOP" || fail "legacy executable customization overwritten"
121
122
123 # Empty or malformed snapshots must never resurrect user-deleted keys.
124 for invalid in empty garbage missing-exec; do
125 baseline="$XDG_DATA_HOME/applications/.$APP_ID.generated"
126 case "$invalid" in
127 empty) : >"$baseline" ;;
128 garbage) printf 'not a desktop entry\n' >"$baseline" ;;
129 missing-exec) printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\n' >"$baseline" ;;
130 esac
131 sed -i '/^Comment=/d; /^StartupNotify=/d' "$DESKTOP"
132 cp "$DESKTOP" "$TMP/before-invalid.desktop"
133 "$APPDIR/AppRun" >/dev/null || fail "invalid baseline blocked launch"
134 cmp -s "$DESKTOP" "$TMP/before-invalid.desktop" || fail "$invalid baseline changed user launcher"
135 done
136
137 # External integration must preserve customized and unknown legacy entries.
138 for baseline_kind in valid missing empty; do
139 baseline="$XDG_DATA_HOME/applications/.$APP_ID.generated"
140 case "$baseline_kind" in
141 missing) rm -f "$baseline" ;;
142 empty) : >"$baseline" ;;
143 esac
144 cp "$DESKTOP" "$TMP/before-external.desktop"
145 DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null
146 cmp -s "$DESKTOP" "$TMP/before-external.desktop" || fail "DESKTOPINTEGRATION changed $baseline_kind custom entry"
147 ext="$XDG_DATA_HOME/applications/external.desktop"
148 printf '[Desktop Entry]\nType=Application\nName=External\nExec="%s"\n' "$APPIMAGE" >"$ext"
149 "$APPDIR/AppRun" >/dev/null
150 cmp -s "$DESKTOP" "$TMP/before-external.desktop" || fail "external desktop removed $baseline_kind custom entry"
151 rm -f "$ext"
152 done
153
154 # Linked launchers and snapshots are externally owned, even when their bytes
155 # match a generated entry. Check both normal refresh and external deduplication.
156 for integration in normal external; do
157 for linked in launcher dangling-launcher baseline dangling-baseline; do
158 rm -rf "$XDG_DATA_HOME"
159 "$APPDIR/AppRun" >/dev/null
160 baseline="$XDG_DATA_HOME/applications/.$APP_ID.generated"
161 target="$TMP/linked-target"
162 cp "$DESKTOP" "$target"
163 case "$linked" in
164 launcher|dangling-launcher) link="$DESKTOP" ;;
165 baseline|dangling-baseline) link="$baseline" ;;
166 esac
167 rm -f "$link"
168 case "$linked" in dangling-*) rm -f "$target" ;; esac
169 ln -s "$target" "$link"
170 [ ! -f "$target" ] || cp "$target" "$TMP/linked-target-before"
171 # A packaged metadata change would otherwise cause a symlink to be replaced.
172 template="$APPDIR/usr/share/applications/$APP_ID.desktop"
173 cp "$template" "$TMP/link-template-before"
174 printf '\nX-Link-Refresh=changed\n' >>"$template"
175 if [ "$integration" = external ]; then
176 ext="$XDG_DATA_HOME/applications/external.desktop"
177 printf '[Desktop Entry]\nType=Application\nName=External\nExec="%s"\n' "$APPIMAGE" >"$ext"
178 DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null
179 else
180 "$APPDIR/AppRun" >/dev/null
181 fi
182 [ -L "$link" ] || fail "$integration replaced or removed $linked"
183 [ "$(readlink "$link")" = "$target" ] || fail "$integration retargeted $linked"
184 case "$linked" in
185 dangling-*) [ ! -e "$target" ] || fail "$integration created dangling target" ;;
186 *) cmp -s "$target" "$TMP/linked-target-before" || fail "$integration changed linked target" ;;
187 esac
188 [ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ] || fail "link preservation skipped icons"
189 cp "$TMP/link-template-before" "$template"
190 done
191 done
192
193 # Reset the stub fixture so the duplicate-removal test starts with an untouched entry.
194 rm -rf "$XDG_DATA_HOME"
195 "$APPDIR/AppRun" >/dev/null
196
197 # 6. External AppImage integrator: if another .desktop file in $XDG_DATA_HOME/applications
198 # already launches this AppImage (e.g. AppImageLauncher's appimagekit-*.desktop), AppRun removes
199 # its own duplicate .desktop entry while keeping the hicolor icons installed.
200 ext_desktop="$XDG_DATA_HOME/applications/appimagekit-rusty-teams.desktop"
201 printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\nExec="%s"\nIcon=%s\n' "$(readlink -f "$APPIMAGE")" "$APP_ID" >"$ext_desktop"
202 "$APPDIR/AppRun" >/dev/null || fail "launch with external integrator desktop entry exited non-zero"
203 [[ ! -e "$DESKTOP" ]] || fail "duplicate desktop entry kept alongside external integrator entry"
204 [[ -f "$ext_desktop" ]] || fail "external integrator desktop entry removed"
205 [[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing with external integrator"
206 rm -f "$ext_desktop"
207
208 # 7. AppImageLauncher exports DESKTOPINTEGRATION even after X-AppImage-Integrate=false
209 # made it skip the AppImage. That is not an existing launcher, so AppRun still
210 # writes its own entry and a later launch must not delete it.
211 rm -rf "$XDG_DATA_HOME"
212 DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null || fail "DESKTOPINTEGRATION launch exited non-zero"
213 [[ -f "$DESKTOP" ]] || fail "DESKTOPINTEGRATION suppressed the desktop entry"
214 grep -Fxq "Exec=\"$(readlink -f "$APPIMAGE")\"" "$DESKTOP" || fail "Exec missing under DESKTOPINTEGRATION"
215 grep -Fxq "X-AppImage-Integrate=false" "$DESKTOP" || fail "X-AppImage-Integrate=false missing under DESKTOPINTEGRATION"
216 [[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons not installed under DESKTOPINTEGRATION"
217 before="$(stat -c %i "$DESKTOP")"
218 DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null || fail "second DESKTOPINTEGRATION launch exited non-zero"
219 [[ -f "$DESKTOP" ]] || fail "DESKTOPINTEGRATION removed the desktop entry on a later launch"
220 [[ "$before" = "$(stat -c %i "$DESKTOP")" ]] || fail "desktop entry rewritten under DESKTOPINTEGRATION although unchanged"
221 # A real integrator entry still wins, including when DESKTOPINTEGRATION is also set.
222 ext_desktop="$XDG_DATA_HOME/applications/appimagekit-rusty-teams.desktop"
223 printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\nExec="%s"\nIcon=%s\n' "$(readlink -f "$APPIMAGE")" "$APP_ID" >"$ext_desktop"
224 DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null || fail "launch with integrator entry and DESKTOPINTEGRATION exited non-zero"
225 [[ ! -e "$DESKTOP" ]] || fail "duplicate desktop entry kept when an integrator entry exists"
226 [[ -f "$ext_desktop" ]] || fail "external integrator desktop entry removed"
227 [[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing when DESKTOPINTEGRATION and an integrator entry coexist"
228 rm -f "$ext_desktop"
229
230 # 8. Opt-out installs nothing.
231 rm -rf "$XDG_DATA_HOME"
232 RUSTY_TEAMS_NO_DESKTOP_INTEGRATION=1 "$APPDIR/AppRun" >/dev/null || fail "opt-out launch exited non-zero"
233 [[ ! -e "$XDG_DATA_HOME" ]] || fail "opt-out still integrated"
234
235 # 9. An unwritable data dir never blocks the launch.
236 mkdir -p "$TMP/ro" && chmod a-w "$TMP/ro"
237 out="$(XDG_DATA_HOME="$TMP/ro/data" "$APPDIR/AppRun" out.txt)" || fail "launch blocked by unwritable data dir"
238 [[ "$out" = "stub: out.txt" ]] || fail "stub not run against unwritable data dir: $out"
239 chmod u+w "$TMP/ro"
240
241 # 10. No $APPIMAGE (extracted AppDir): launch only, nothing installed.
242 rm -rf "$XDG_DATA_HOME"
243 env -u APPIMAGE "$APPDIR/AppRun" >/dev/null || fail "extracted-AppDir launch exited non-zero"
244 [[ ! -e "$XDG_DATA_HOME" ]] || fail "integrated without $APPIMAGE"
245
246 # 11. A path that would need Exec escaping (here a `$`): launch only, nothing installed.
247 rm -rf "$XDG_DATA_HOME"
248 odd="$TMP/odd\$(id).AppImage"
249 : >"$odd"
250 out="$(APPIMAGE="$odd" "$APPDIR/AppRun" x)" || fail "launch with an odd path exited non-zero"
251 [[ "$out" = "stub: x" ]] || fail "odd path: $out"
252 [[ ! -e "$XDG_DATA_HOME" ]] || fail "integrated an AppImage path that needs escaping"
253
254 # 12. AM / AppMan: a rusty-teams-AM.desktop launcher in the user's applications
255 # dir owns the menu entry. AppRun removes its own entry left from an earlier run,
256 # writes no second one and still installs the icons.
257 rm -rf "$XDG_DATA_HOME"
258 "$APPDIR/AppRun" >/dev/null || fail "launch before AM install exited non-zero"
259 [[ -f "$DESKTOP" ]] || fail "no desktop entry before AM install"
260 am_desktop="$XDG_DATA_HOME/applications/rusty-teams-AM.desktop"
261 printf '[Desktop Entry]
262 Type=Application
263 Name=Rusty Teams
264 Exec=teams
265 Icon=%s
266 ' "$APP_ID" >"$am_desktop"
267 "$APPDIR/AppRun" >/dev/null || fail "launch with AM launcher exited non-zero"
268 [[ ! -e "$DESKTOP" ]] || fail "duplicate desktop entry kept alongside AM launcher"
269 [[ -f "$am_desktop" ]] || fail "AM launcher was removed"
270 [[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing with AM launcher"
271
272 # 13. Once AM removes its launcher, AppRun writes its own entry again.
273 rm -f "$am_desktop"
274 "$APPDIR/AppRun" >/dev/null || fail "launch after AM removal exited non-zero"
275 [[ -f "$DESKTOP" ]] || fail "no desktop entry after the AM launcher was removed"
276
277 # 14. The app's own install (Settings > General, ADR 0014) writes the same entry with
278 # Exec pointing at ~/.local/share/rusty-teams/teams. AppRun keeps that Exec.
279 rm -rf "$XDG_DATA_HOME"
280 mkdir -p "$XDG_DATA_HOME/applications"
281 self_installed="$XDG_DATA_HOME/rusty-teams/teams"
282 printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\nExec="%s"\nTryExec=%s\nIcon=%s\nStartupWMClass=%s\n' \
283 "$self_installed" "$self_installed" "$APP_ID" "$APP_ID" >"$DESKTOP"
284 "$APPDIR/AppRun" >/dev/null || fail "launch beside a self-installed copy exited non-zero"
285 grep -Fxq "Exec=\"$self_installed\"" "$DESKTOP" || fail "self-installed copy's Exec replaced: $(grep '^Exec=' "$DESKTOP")"
286 grep -Fxq "TryExec=$self_installed" "$DESKTOP" || fail "self-installed copy's TryExec dropped"
287 [[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing beside a self-installed copy"
288
289 echo "AppRun desktop integration ok"
@@ -0,0 +1,289 @@
1#!/usr/bin/env bash
2# Smoke test for packaging/linux/AppRun: the AppImage's desktop integration writes
3# and refreshes the host .desktop entry and icons, is idempotent, honours the opt-out
4# and an unwritable HOME, and always launches the app.
5#
6# Runs in seconds with no build (CI: .github/workflows/packaging-lint.yml).
7set -euo pipefail
8
9HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10APP_ID=rusty-teams
11
12TMP="$(mktemp -d)"
13trap 'rm -rf "$TMP"' EXIT
14
15# Fake AppDir with the real AppRun, .desktop template, icons, and a stub binary.
16APPDIR="$TMP/RustyTeams.AppDir"
17mkdir -p "$APPDIR/usr/bin"
18install -Dm755 "$HERE/AppRun" "$APPDIR/AppRun"
19install -Dm644 "$HERE/$APP_ID.desktop" "$APPDIR/usr/share/applications/$APP_ID.desktop"
20mkdir -p "$APPDIR/usr/share/icons"
21cp -R "$HERE/hicolor" "$APPDIR/usr/share/icons/"
22printf '#!/bin/sh\necho "stub: $*"\n' >"$APPDIR/usr/bin/teams"
23chmod +x "$APPDIR/usr/bin/teams"
24
25APPIMAGE="$TMP/rusty teams test.AppImage" # spaces on purpose: Exec must stay quoted
26: >"$APPIMAGE"
27export APPIMAGE
28export HOME="$TMP/home"
29export XDG_DATA_HOME="$HOME/.local/share"
30unset DESKTOPINTEGRATION RUSTY_TEAMS_NO_DESKTOP_INTEGRATION
31mkdir -p "$HOME"
32
33fail() {
34 echo "FAIL: $*" >&2
35 exit 1
36}
37
38# 1. Launch works and passes arguments through.
39out="$("$APPDIR/AppRun" open file.png)" || fail "AppRun exited non-zero"
40[[ "$out" = "stub: open file.png" ]] || fail "arguments not forwarded: $out"
41
42DESKTOP="$XDG_DATA_HOME/applications/$APP_ID.desktop"
43[[ -f "$DESKTOP" ]] || fail "desktop entry not installed"
44
45# 2. Exec rewritten to the AppImage (quoted, spaces intact), TryExec dropped,
46# everything else preserved from the packaged entry.
47expected_exec="Exec=\"$(readlink -f "$APPIMAGE")\""
48grep -Fxq "$expected_exec" "$DESKTOP" || fail "Exec not rewritten: $(grep '^Exec=' "$DESKTOP")"
49grep -q '^TryExec=' "$DESKTOP" && fail "TryExec kept, the entry would be hidden"
50grep -Fxq "Icon=$APP_ID" "$DESKTOP" || fail "Icon line lost"
51grep -Fxq "X-AppImage-Integrate=false" "$DESKTOP" || fail "X-AppImage-Integrate=false missing"
52grep -Fxq 'Categories=Network;InstantMessaging;Chat;' "$DESKTOP" || fail "metadata lines lost"
53if command -v desktop-file-validate >/dev/null; then
54 desktop-file-validate "$DESKTOP" || fail "generated desktop entry is invalid"
55fi
56
57# 3. Icons landed under the name the .desktop entry references.
58for f in "16x16/apps/$APP_ID.png" "256x256/apps/$APP_ID.png"; do
59 [[ -f "$XDG_DATA_HOME/icons/hicolor/$f" ]] || fail "icon missing: $f"
60done
61
62# 4. Idempotent: a second launch must not rewrite anything (inode unchanged).
63before="$(stat -c %i "$DESKTOP")"
64out="$("$APPDIR/AppRun")" || fail "second launch exited non-zero"
65[[ "$out" = "stub: " ]] || fail "second launch output: $out"
66after="$(stat -c %i "$DESKTOP")"
67[[ "$before" = "$after" ]] || fail "desktop entry rewritten although unchanged"
68
69# 5. Moving the AppImage refreshes Exec.
70mv "$APPIMAGE" "$TMP/moved.AppImage"
71export APPIMAGE="$TMP/moved.AppImage"
72"$APPDIR/AppRun" >/dev/null || fail "launch after move exited non-zero"
73grep -Fxq "Exec=\"$(readlink -f "$APPIMAGE")\"" "$DESKTOP" || fail "Exec not refreshed after move"
74
75# Customized launch options and metadata survive launches and relocation .
76old_path="$(readlink -f "$APPIMAGE")"
77sed -i "s|^Exec=.*|Exec=env WAYLAND_DISPLAY= \"$old_path\" --custom|; s|^Name=.*|Name=My Teams|" "$DESKTOP"
78printf '\nX-User-Setting=keep me\n' >>"$DESKTOP"
79cp "$DESKTOP" "$TMP/custom.desktop"
80before="$(stat -c %i "$DESKTOP")"
81"$APPDIR/AppRun" >/dev/null
82cmp -s "$DESKTOP" "$TMP/custom.desktop" || fail "customized launcher overwritten"
83[ "$before" = "$(stat -c %i "$DESKTOP")" ] || fail "custom launcher rewritten although unchanged"
84mv "$APPIMAGE" "$TMP/new version.AppImage"
85export APPIMAGE="$TMP/new version.AppImage"
86"$APPDIR/AppRun" >/dev/null
87grep -Fxq "Exec=env WAYLAND_DISPLAY= \"$APPIMAGE\" --custom" "$DESKTOP" || fail "custom Exec not relocated"
88grep -Fxq 'Name=My Teams' "$DESKTOP" || fail "custom Name lost"
89grep -Fxq 'X-User-Setting=keep me' "$DESKTOP" || fail "custom key lost"
90
91# Packaged updates apply only to untouched keys; user deletions stay deleted.
92sed -i '/^Comment=/d' "$DESKTOP"
93sed -i 's/^Name=.*/Name=Packaged update/; s/^Categories=.*/Categories=Graphics;/; s/^Comment=.*/Comment=Updated description/' "$APPDIR/usr/share/applications/$APP_ID.desktop"
94printf '\nX-New-Packaged-Key=added\n' >>"$APPDIR/usr/share/applications/$APP_ID.desktop"
95"$APPDIR/AppRun" >/dev/null
96grep -Fxq 'Name=My Teams' "$DESKTOP" || fail "packaged update erased custom Name"
97grep -Fxq 'Categories=Graphics;' "$DESKTOP" || fail "untouched metadata not updated"
98grep -q '^Comment=' "$DESKTOP" && fail "user deletion undone"
99grep -Fxq 'X-New-Packaged-Key=added' "$DESKTOP" || fail "new packaged key missing"
100if command -v desktop-file-validate >/dev/null; then
101 desktop-file-validate "$DESKTOP" || fail "customized entry is invalid"
102fi
103
104# A replaced executable may mention the old AppImage as an argument: leave it.
105sed -i "s|^Exec=.*|Exec=\"/custom/wrapper\" \"$APPIMAGE\"|" "$DESKTOP"
106expected_wrapper="$(grep '^Exec=' "$DESKTOP")"
107mv "$APPIMAGE" "$TMP/another version.AppImage"
108export APPIMAGE="$TMP/another version.AppImage"
109"$APPDIR/AppRun" >/dev/null
110grep -Fxq "$expected_wrapper" "$DESKTOP" || fail "wrapper argument mistaken for managed executable"
111
112# Existing launchers from before snapshots: bootstrap without losing edits.
113rm -f "$XDG_DATA_HOME/applications/.$APP_ID.generated"
114cp "$DESKTOP" "$TMP/legacy.desktop"
115"$APPDIR/AppRun" >/dev/null
116cmp -s "$DESKTOP" "$TMP/legacy.desktop" || fail "legacy custom launcher overwritten"
117rm -f "$XDG_DATA_HOME/applications/.$APP_ID.generated"
118sed -i 's|^Exec=.*|Exec="/custom/wrapper"|' "$DESKTOP"
119"$APPDIR/AppRun" >/dev/null
120grep -Fxq 'Exec="/custom/wrapper"' "$DESKTOP" || fail "legacy executable customization overwritten"
121
122
123# Empty or malformed snapshots must never resurrect user-deleted keys.
124for invalid in empty garbage missing-exec; do
125 baseline="$XDG_DATA_HOME/applications/.$APP_ID.generated"
126 case "$invalid" in
127 empty) : >"$baseline" ;;
128 garbage) printf 'not a desktop entry\n' >"$baseline" ;;
129 missing-exec) printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\n' >"$baseline" ;;
130 esac
131 sed -i '/^Comment=/d; /^StartupNotify=/d' "$DESKTOP"
132 cp "$DESKTOP" "$TMP/before-invalid.desktop"
133 "$APPDIR/AppRun" >/dev/null || fail "invalid baseline blocked launch"
134 cmp -s "$DESKTOP" "$TMP/before-invalid.desktop" || fail "$invalid baseline changed user launcher"
135done
136
137# External integration must preserve customized and unknown legacy entries.
138for baseline_kind in valid missing empty; do
139 baseline="$XDG_DATA_HOME/applications/.$APP_ID.generated"
140 case "$baseline_kind" in
141 missing) rm -f "$baseline" ;;
142 empty) : >"$baseline" ;;
143 esac
144 cp "$DESKTOP" "$TMP/before-external.desktop"
145 DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null
146 cmp -s "$DESKTOP" "$TMP/before-external.desktop" || fail "DESKTOPINTEGRATION changed $baseline_kind custom entry"
147 ext="$XDG_DATA_HOME/applications/external.desktop"
148 printf '[Desktop Entry]\nType=Application\nName=External\nExec="%s"\n' "$APPIMAGE" >"$ext"
149 "$APPDIR/AppRun" >/dev/null
150 cmp -s "$DESKTOP" "$TMP/before-external.desktop" || fail "external desktop removed $baseline_kind custom entry"
151 rm -f "$ext"
152done
153
154# Linked launchers and snapshots are externally owned, even when their bytes
155# match a generated entry. Check both normal refresh and external deduplication.
156for integration in normal external; do
157 for linked in launcher dangling-launcher baseline dangling-baseline; do
158 rm -rf "$XDG_DATA_HOME"
159 "$APPDIR/AppRun" >/dev/null
160 baseline="$XDG_DATA_HOME/applications/.$APP_ID.generated"
161 target="$TMP/linked-target"
162 cp "$DESKTOP" "$target"
163 case "$linked" in
164 launcher|dangling-launcher) link="$DESKTOP" ;;
165 baseline|dangling-baseline) link="$baseline" ;;
166 esac
167 rm -f "$link"
168 case "$linked" in dangling-*) rm -f "$target" ;; esac
169 ln -s "$target" "$link"
170 [ ! -f "$target" ] || cp "$target" "$TMP/linked-target-before"
171 # A packaged metadata change would otherwise cause a symlink to be replaced.
172 template="$APPDIR/usr/share/applications/$APP_ID.desktop"
173 cp "$template" "$TMP/link-template-before"
174 printf '\nX-Link-Refresh=changed\n' >>"$template"
175 if [ "$integration" = external ]; then
176 ext="$XDG_DATA_HOME/applications/external.desktop"
177 printf '[Desktop Entry]\nType=Application\nName=External\nExec="%s"\n' "$APPIMAGE" >"$ext"
178 DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null
179 else
180 "$APPDIR/AppRun" >/dev/null
181 fi
182 [ -L "$link" ] || fail "$integration replaced or removed $linked"
183 [ "$(readlink "$link")" = "$target" ] || fail "$integration retargeted $linked"
184 case "$linked" in
185 dangling-*) [ ! -e "$target" ] || fail "$integration created dangling target" ;;
186 *) cmp -s "$target" "$TMP/linked-target-before" || fail "$integration changed linked target" ;;
187 esac
188 [ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ] || fail "link preservation skipped icons"
189 cp "$TMP/link-template-before" "$template"
190 done
191done
192
193# Reset the stub fixture so the duplicate-removal test starts with an untouched entry.
194rm -rf "$XDG_DATA_HOME"
195"$APPDIR/AppRun" >/dev/null
196
197# 6. External AppImage integrator: if another .desktop file in $XDG_DATA_HOME/applications
198# already launches this AppImage (e.g. AppImageLauncher's appimagekit-*.desktop), AppRun removes
199# its own duplicate .desktop entry while keeping the hicolor icons installed.
200ext_desktop="$XDG_DATA_HOME/applications/appimagekit-rusty-teams.desktop"
201printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\nExec="%s"\nIcon=%s\n' "$(readlink -f "$APPIMAGE")" "$APP_ID" >"$ext_desktop"
202"$APPDIR/AppRun" >/dev/null || fail "launch with external integrator desktop entry exited non-zero"
203[[ ! -e "$DESKTOP" ]] || fail "duplicate desktop entry kept alongside external integrator entry"
204[[ -f "$ext_desktop" ]] || fail "external integrator desktop entry removed"
205[[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing with external integrator"
206rm -f "$ext_desktop"
207
208# 7. AppImageLauncher exports DESKTOPINTEGRATION even after X-AppImage-Integrate=false
209# made it skip the AppImage. That is not an existing launcher, so AppRun still
210# writes its own entry and a later launch must not delete it.
211rm -rf "$XDG_DATA_HOME"
212DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null || fail "DESKTOPINTEGRATION launch exited non-zero"
213[[ -f "$DESKTOP" ]] || fail "DESKTOPINTEGRATION suppressed the desktop entry"
214grep -Fxq "Exec=\"$(readlink -f "$APPIMAGE")\"" "$DESKTOP" || fail "Exec missing under DESKTOPINTEGRATION"
215grep -Fxq "X-AppImage-Integrate=false" "$DESKTOP" || fail "X-AppImage-Integrate=false missing under DESKTOPINTEGRATION"
216[[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons not installed under DESKTOPINTEGRATION"
217before="$(stat -c %i "$DESKTOP")"
218DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null || fail "second DESKTOPINTEGRATION launch exited non-zero"
219[[ -f "$DESKTOP" ]] || fail "DESKTOPINTEGRATION removed the desktop entry on a later launch"
220[[ "$before" = "$(stat -c %i "$DESKTOP")" ]] || fail "desktop entry rewritten under DESKTOPINTEGRATION although unchanged"
221# A real integrator entry still wins, including when DESKTOPINTEGRATION is also set.
222ext_desktop="$XDG_DATA_HOME/applications/appimagekit-rusty-teams.desktop"
223printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\nExec="%s"\nIcon=%s\n' "$(readlink -f "$APPIMAGE")" "$APP_ID" >"$ext_desktop"
224DESKTOPINTEGRATION=AppImageLauncher "$APPDIR/AppRun" >/dev/null || fail "launch with integrator entry and DESKTOPINTEGRATION exited non-zero"
225[[ ! -e "$DESKTOP" ]] || fail "duplicate desktop entry kept when an integrator entry exists"
226[[ -f "$ext_desktop" ]] || fail "external integrator desktop entry removed"
227[[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing when DESKTOPINTEGRATION and an integrator entry coexist"
228rm -f "$ext_desktop"
229
230# 8. Opt-out installs nothing.
231rm -rf "$XDG_DATA_HOME"
232RUSTY_TEAMS_NO_DESKTOP_INTEGRATION=1 "$APPDIR/AppRun" >/dev/null || fail "opt-out launch exited non-zero"
233[[ ! -e "$XDG_DATA_HOME" ]] || fail "opt-out still integrated"
234
235# 9. An unwritable data dir never blocks the launch.
236mkdir -p "$TMP/ro" && chmod a-w "$TMP/ro"
237out="$(XDG_DATA_HOME="$TMP/ro/data" "$APPDIR/AppRun" out.txt)" || fail "launch blocked by unwritable data dir"
238[[ "$out" = "stub: out.txt" ]] || fail "stub not run against unwritable data dir: $out"
239chmod u+w "$TMP/ro"
240
241# 10. No $APPIMAGE (extracted AppDir): launch only, nothing installed.
242rm -rf "$XDG_DATA_HOME"
243env -u APPIMAGE "$APPDIR/AppRun" >/dev/null || fail "extracted-AppDir launch exited non-zero"
244[[ ! -e "$XDG_DATA_HOME" ]] || fail "integrated without $APPIMAGE"
245
246# 11. A path that would need Exec escaping (here a `$`): launch only, nothing installed.
247rm -rf "$XDG_DATA_HOME"
248odd="$TMP/odd\$(id).AppImage"
249: >"$odd"
250out="$(APPIMAGE="$odd" "$APPDIR/AppRun" x)" || fail "launch with an odd path exited non-zero"
251[[ "$out" = "stub: x" ]] || fail "odd path: $out"
252[[ ! -e "$XDG_DATA_HOME" ]] || fail "integrated an AppImage path that needs escaping"
253
254# 12. AM / AppMan: a rusty-teams-AM.desktop launcher in the user's applications
255# dir owns the menu entry. AppRun removes its own entry left from an earlier run,
256# writes no second one and still installs the icons.
257rm -rf "$XDG_DATA_HOME"
258"$APPDIR/AppRun" >/dev/null || fail "launch before AM install exited non-zero"
259[[ -f "$DESKTOP" ]] || fail "no desktop entry before AM install"
260am_desktop="$XDG_DATA_HOME/applications/rusty-teams-AM.desktop"
261printf '[Desktop Entry]
262Type=Application
263Name=Rusty Teams
264Exec=teams
265Icon=%s
266' "$APP_ID" >"$am_desktop"
267"$APPDIR/AppRun" >/dev/null || fail "launch with AM launcher exited non-zero"
268[[ ! -e "$DESKTOP" ]] || fail "duplicate desktop entry kept alongside AM launcher"
269[[ -f "$am_desktop" ]] || fail "AM launcher was removed"
270[[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing with AM launcher"
271
272# 13. Once AM removes its launcher, AppRun writes its own entry again.
273rm -f "$am_desktop"
274"$APPDIR/AppRun" >/dev/null || fail "launch after AM removal exited non-zero"
275[[ -f "$DESKTOP" ]] || fail "no desktop entry after the AM launcher was removed"
276
277# 14. The app's own install (Settings > General, ADR 0014) writes the same entry with
278# Exec pointing at ~/.local/share/rusty-teams/teams. AppRun keeps that Exec.
279rm -rf "$XDG_DATA_HOME"
280mkdir -p "$XDG_DATA_HOME/applications"
281self_installed="$XDG_DATA_HOME/rusty-teams/teams"
282printf '[Desktop Entry]\nType=Application\nName=Rusty Teams\nExec="%s"\nTryExec=%s\nIcon=%s\nStartupWMClass=%s\n' \
283 "$self_installed" "$self_installed" "$APP_ID" "$APP_ID" >"$DESKTOP"
284"$APPDIR/AppRun" >/dev/null || fail "launch beside a self-installed copy exited non-zero"
285grep -Fxq "Exec=\"$self_installed\"" "$DESKTOP" || fail "self-installed copy's Exec replaced: $(grep '^Exec=' "$DESKTOP")"
286grep -Fxq "TryExec=$self_installed" "$DESKTOP" || fail "self-installed copy's TryExec dropped"
287[[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ]] || fail "icons missing beside a self-installed copy"
288
289echo "AppRun desktop integration ok"
packaging/linux/flatpak-bundle.sh added +75 −0
@@ -0,0 +1,75 @@
1 #!/usr/bin/env bash
2 # Repackage a Rusty Teams Linux tarball as a single-file Flatpak bundle:
3 #
4 # $DIST/rusty-teams-<version>-linux-<arch>.flatpak
5 #
6 # BROKEN: the app cannot start the host's browser from inside the sandbox, so it cannot sign
7 # in (details in packaging/linux/flatpak/io.github.danieldaeschle.RustyTeams.yml). Not part of
8 # the release; kept to work on the sandbox support.
9 #
10 # Usage: packaging/linux/flatpak-bundle.sh [--no-test] [TARBALL]
11 #
12 # TARBALL defaults to $DIST/rusty-teams-<version>-linux-<arch>.tar.gz from package.sh. The bundle
13 # is built for the host architecture (x86_64 or aarch64), which must match the tarball's.
14 # Needs flatpak and flatpak-builder; the freedesktop runtime and SDK named in the manifest are
15 # installed per-user from Flathub. Unless --no-test, the bundle is then installed per-user and
16 # its files are listed inside the sandbox as a smoke test.
17 set -euo pipefail
18 umask 022
19 # shellcheck source=../env.sh
20 . "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
21 HERE="$ROOT/packaging/linux"
22 APP_ID=io.github.danieldaeschle.RustyTeams
23 FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo
24
25 TEST=1
26 TARBALL=""
27 while [[ $# -gt 0 ]]; do
28 case "$1" in
29 --no-test) TEST=0; shift ;;
30 -h | --help) sed -n '2,17p' "$0"; exit 0 ;;
31 -*) echo "unknown argument: $1" >&2; exit 2 ;;
32 *) TARBALL="$1"; shift ;;
33 esac
34 done
35
36 ARCH="$(uname -m)"
37 case "$ARCH" in
38 x86_64) ;;
39 aarch64 | arm64) ARCH=aarch64 ;;
40 *) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
41 esac
42 BASENAME="rusty-teams-$VERSION-linux-$ARCH"
43 TARBALL="${TARBALL:-$DIST/$BASENAME.tar.gz}"
44 [[ -f "$TARBALL" ]] || { echo "error: $TARBALL not found (run packaging/linux/package.sh --formats tar first)" >&2; exit 1; }
45 for tool in flatpak flatpak-builder; do
46 command -v "$tool" >/dev/null || { echo "error: $tool not found (apt install flatpak flatpak-builder)" >&2; exit 1; }
47 done
48
49 warn "the Flatpak is known broken: the app cannot start the host's browser from the sandbox"
50 echo "==> Rusty Teams $VERSION Flatpak bundle for $ARCH from $(basename "$TARBALL")"
51
52 WORK="$CARGO_TARGET_DIR/flatpak-bundle"
53 rm -rf "$WORK"
54 mkdir -p "$WORK/stage"
55 tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1
56 [[ -x "$WORK/stage/bin/teams" ]] || { echo "error: $TARBALL has no bin/teams" >&2; exit 1; }
57 cp "$HERE/flatpak/$APP_ID.yml" "$WORK/$APP_ID.yml"
58
59 flatpak remote-add --user --if-not-exists flathub "$FLATHUB"
60 # --disable-rofiles-fuse: no FUSE in containers and CI runners.
61 flatpak-builder --user --install-deps-from=flathub --disable-rofiles-fuse --force-clean \
62 --default-branch=stable --repo="$WORK/repo" --state-dir="$WORK/state" "$WORK/build" "$WORK/$APP_ID.yml"
63
64 OUT="$DIST/$BASENAME.flatpak"
65 # --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing.
66 flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable
67 echo "wrote $OUT"
68
69 if [[ "$TEST" = 1 ]]; then
70 flatpak install --user -y --noninteractive --reinstall "$OUT"
71 flatpak info --user "$APP_ID"
72 flatpak run --command=sh "$APP_ID" -c 'test -x /app/bin/teams && ls /app/share/applications /app/share/metainfo /app/share/icons/hicolor/256x256/apps'
73 fi
74 echo "==> done"
75 ls -lh "$OUT"
@@ -0,0 +1,75 @@
1#!/usr/bin/env bash
2# Repackage a Rusty Teams Linux tarball as a single-file Flatpak bundle:
3#
4# $DIST/rusty-teams-<version>-linux-<arch>.flatpak
5#
6# BROKEN: the app cannot start the host's browser from inside the sandbox, so it cannot sign
7# in (details in packaging/linux/flatpak/io.github.danieldaeschle.RustyTeams.yml). Not part of
8# the release; kept to work on the sandbox support.
9#
10# Usage: packaging/linux/flatpak-bundle.sh [--no-test] [TARBALL]
11#
12# TARBALL defaults to $DIST/rusty-teams-<version>-linux-<arch>.tar.gz from package.sh. The bundle
13# is built for the host architecture (x86_64 or aarch64), which must match the tarball's.
14# Needs flatpak and flatpak-builder; the freedesktop runtime and SDK named in the manifest are
15# installed per-user from Flathub. Unless --no-test, the bundle is then installed per-user and
16# its files are listed inside the sandbox as a smoke test.
17set -euo pipefail
18umask 022
19# shellcheck source=../env.sh
20. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
21HERE="$ROOT/packaging/linux"
22APP_ID=io.github.danieldaeschle.RustyTeams
23FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo
24
25TEST=1
26TARBALL=""
27while [[ $# -gt 0 ]]; do
28 case "$1" in
29 --no-test) TEST=0; shift ;;
30 -h | --help) sed -n '2,17p' "$0"; exit 0 ;;
31 -*) echo "unknown argument: $1" >&2; exit 2 ;;
32 *) TARBALL="$1"; shift ;;
33 esac
34done
35
36ARCH="$(uname -m)"
37case "$ARCH" in
38 x86_64) ;;
39 aarch64 | arm64) ARCH=aarch64 ;;
40 *) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
41esac
42BASENAME="rusty-teams-$VERSION-linux-$ARCH"
43TARBALL="${TARBALL:-$DIST/$BASENAME.tar.gz}"
44[[ -f "$TARBALL" ]] || { echo "error: $TARBALL not found (run packaging/linux/package.sh --formats tar first)" >&2; exit 1; }
45for tool in flatpak flatpak-builder; do
46 command -v "$tool" >/dev/null || { echo "error: $tool not found (apt install flatpak flatpak-builder)" >&2; exit 1; }
47done
48
49warn "the Flatpak is known broken: the app cannot start the host's browser from the sandbox"
50echo "==> Rusty Teams $VERSION Flatpak bundle for $ARCH from $(basename "$TARBALL")"
51
52WORK="$CARGO_TARGET_DIR/flatpak-bundle"
53rm -rf "$WORK"
54mkdir -p "$WORK/stage"
55tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1
56[[ -x "$WORK/stage/bin/teams" ]] || { echo "error: $TARBALL has no bin/teams" >&2; exit 1; }
57cp "$HERE/flatpak/$APP_ID.yml" "$WORK/$APP_ID.yml"
58
59flatpak remote-add --user --if-not-exists flathub "$FLATHUB"
60# --disable-rofiles-fuse: no FUSE in containers and CI runners.
61flatpak-builder --user --install-deps-from=flathub --disable-rofiles-fuse --force-clean \
62 --default-branch=stable --repo="$WORK/repo" --state-dir="$WORK/state" "$WORK/build" "$WORK/$APP_ID.yml"
63
64OUT="$DIST/$BASENAME.flatpak"
65# --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing.
66flatpak build-bundle --runtime-repo="$FLATHUB" "$WORK/repo" "$OUT" "$APP_ID" stable
67echo "wrote $OUT"
68
69if [[ "$TEST" = 1 ]]; then
70 flatpak install --user -y --noninteractive --reinstall "$OUT"
71 flatpak info --user "$APP_ID"
72 flatpak run --command=sh "$APP_ID" -c 'test -x /app/bin/teams && ls /app/share/applications /app/share/metainfo /app/share/icons/hicolor/256x256/apps'
73fi
74echo "==> done"
75ls -lh "$OUT"
packaging/linux/flatpak/io.github.danieldaeschle.RustyTeams.yml added +60 −0
@@ -0,0 +1,60 @@
1 # Flatpak manifest for Rusty Teams. BROKEN, see below: kept so the packaging matches the
2 # other Craft apps and so the sandbox work has a starting point. Not attached to releases.
3 #
4 # It repackages the prebuilt binary from package.sh's tarball (packaging/linux/flatpak-bundle.sh):
5 # libwebrtc is downloaded during the cargo build, which flatpak-builder's offline build does not
6 # allow, so there is no build-from-source manifest.
7 #
8 # Why it is broken: the Teams session runs in the user's own Chromium- or Firefox-based browser,
9 # which the app finds on the host and starts with a debug port (crates/browser, ADR 0003). Inside
10 # the sandbox the host's browsers are not visible and cannot be started without
11 # `flatpak-spawn --host` (needs --talk-name=org.freedesktop.Flatpak, granted below, and app code
12 # that uses it). Until then the app starts but cannot sign in. `--endpoint` to a browser started
13 # by hand on the host (`chromium --remote-debugging-port=9222`) works, since the network is shared.
14 #
15 # The app id must be reverse-DNS, so the desktop file and icon are renamed to it; the window's
16 # Wayland app id stays rusty-teams (StartupWMClass in the desktop file pairs them on X11).
17 id: io.github.danieldaeschle.RustyTeams
18 runtime: org.freedesktop.Platform
19 runtime-version: '26.08'
20 sdk: org.freedesktop.Sdk
21 command: teams
22 rename-desktop-file: rusty-teams.desktop
23 rename-icon: rusty-teams
24 finish-args:
25 # Display: Wayland first; X11 only when no Wayland compositor is running.
26 - --socket=wayland
27 - --socket=fallback-x11
28 # X11 shared memory (MIT-SHM).
29 - --share=ipc
30 # Graph, the Teams services and the browser's debug port on 127.0.0.1.
31 - --share=network
32 # GPU for wgpu (Vulkan, or GL as a fallback) and cameras for video calls.
33 - --device=all
34 # Microphone and speakers for calls.
35 - --socket=pulseaudio
36 # Desktop toasts (ADR 0015) and the StatusNotifierItem tray icon.
37 - --talk-name=org.freedesktop.Notifications
38 - --talk-name=org.kde.StatusNotifierWatcher
39 # Starting the host's browser would go through flatpak-spawn --host (not implemented yet).
40 - --talk-name=org.freedesktop.Flatpak
41 # Downloaded files and attachments.
42 - --filesystem=xdg-download
43 build-options:
44 no-debuginfo: true
45 modules:
46 - name: rusty-teams
47 buildsystem: simple
48 build-commands:
49 - install -Dm755 bin/teams /app/bin/teams
50 - install -Dm644 share/applications/rusty-teams.desktop /app/share/applications/rusty-teams.desktop
51 # rename-desktop-file and rename-icon do not touch the metainfo: point it at the new names.
52 - >-
53 sed -e 's|<launchable type="desktop-id">rusty-teams.desktop<|<launchable type="desktop-id">io.github.danieldaeschle.RustyTeams.desktop<|'
54 -e 's|<icon type="stock">rusty-teams<|<icon type="stock">io.github.danieldaeschle.RustyTeams<|'
55 share/metainfo/io.github.danieldaeschle.RustyTeams.metainfo.xml
56 | install -Dm644 /dev/stdin /app/share/metainfo/io.github.danieldaeschle.RustyTeams.metainfo.xml
57 - mkdir -p /app/share/icons /app/share/doc && cp -R share/icons/hicolor /app/share/icons/ && cp -R share/doc/rusty-teams /app/share/doc/
58 sources:
59 - type: dir
60 path: stage
@@ -0,0 +1,60 @@
1# Flatpak manifest for Rusty Teams. BROKEN, see below: kept so the packaging matches the
2# other Craft apps and so the sandbox work has a starting point. Not attached to releases.
3#
4# It repackages the prebuilt binary from package.sh's tarball (packaging/linux/flatpak-bundle.sh):
5# libwebrtc is downloaded during the cargo build, which flatpak-builder's offline build does not
6# allow, so there is no build-from-source manifest.
7#
8# Why it is broken: the Teams session runs in the user's own Chromium- or Firefox-based browser,
9# which the app finds on the host and starts with a debug port (crates/browser, ADR 0003). Inside
10# the sandbox the host's browsers are not visible and cannot be started without
11# `flatpak-spawn --host` (needs --talk-name=org.freedesktop.Flatpak, granted below, and app code
12# that uses it). Until then the app starts but cannot sign in. `--endpoint` to a browser started
13# by hand on the host (`chromium --remote-debugging-port=9222`) works, since the network is shared.
14#
15# The app id must be reverse-DNS, so the desktop file and icon are renamed to it; the window's
16# Wayland app id stays rusty-teams (StartupWMClass in the desktop file pairs them on X11).
17id: io.github.danieldaeschle.RustyTeams
18runtime: org.freedesktop.Platform
19runtime-version: '26.08'
20sdk: org.freedesktop.Sdk
21command: teams
22rename-desktop-file: rusty-teams.desktop
23rename-icon: rusty-teams
24finish-args:
25 # Display: Wayland first; X11 only when no Wayland compositor is running.
26 - --socket=wayland
27 - --socket=fallback-x11
28 # X11 shared memory (MIT-SHM).
29 - --share=ipc
30 # Graph, the Teams services and the browser's debug port on 127.0.0.1.
31 - --share=network
32 # GPU for wgpu (Vulkan, or GL as a fallback) and cameras for video calls.
33 - --device=all
34 # Microphone and speakers for calls.
35 - --socket=pulseaudio
36 # Desktop toasts (ADR 0015) and the StatusNotifierItem tray icon.
37 - --talk-name=org.freedesktop.Notifications
38 - --talk-name=org.kde.StatusNotifierWatcher
39 # Starting the host's browser would go through flatpak-spawn --host (not implemented yet).
40 - --talk-name=org.freedesktop.Flatpak
41 # Downloaded files and attachments.
42 - --filesystem=xdg-download
43build-options:
44 no-debuginfo: true
45modules:
46 - name: rusty-teams
47 buildsystem: simple
48 build-commands:
49 - install -Dm755 bin/teams /app/bin/teams
50 - install -Dm644 share/applications/rusty-teams.desktop /app/share/applications/rusty-teams.desktop
51 # rename-desktop-file and rename-icon do not touch the metainfo: point it at the new names.
52 - >-
53 sed -e 's|<launchable type="desktop-id">rusty-teams.desktop<|<launchable type="desktop-id">io.github.danieldaeschle.RustyTeams.desktop<|'
54 -e 's|<icon type="stock">rusty-teams<|<icon type="stock">io.github.danieldaeschle.RustyTeams<|'
55 share/metainfo/io.github.danieldaeschle.RustyTeams.metainfo.xml
56 | install -Dm644 /dev/stdin /app/share/metainfo/io.github.danieldaeschle.RustyTeams.metainfo.xml
57 - mkdir -p /app/share/icons /app/share/doc && cp -R share/icons/hicolor /app/share/icons/ && cp -R share/doc/rusty-teams /app/share/doc/
58 sources:
59 - type: dir
60 path: stage
packaging/linux/hicolor/128x128/apps/rusty-teams.png added Binary file +0 −0

The contents of this binary file are not shown.

packaging/linux/hicolor/16x16/apps/rusty-teams.png added Binary file +0 −0

The contents of this binary file are not shown.

packaging/linux/hicolor/24x24/apps/rusty-teams.png added Binary file +0 −0

The contents of this binary file are not shown.

packaging/linux/hicolor/256x256/apps/rusty-teams.png added Binary file +0 −0

The contents of this binary file are not shown.

packaging/linux/hicolor/32x32/apps/rusty-teams.png added Binary file +0 −0

The contents of this binary file are not shown.

packaging/linux/hicolor/48x48/apps/rusty-teams.png added Binary file +0 −0

The contents of this binary file are not shown.

packaging/linux/hicolor/64x64/apps/rusty-teams.png added Binary file +0 −0

The contents of this binary file are not shown.

packaging/linux/icons.sh added +27 −0
@@ -0,0 +1,27 @@
1 #!/usr/bin/env bash
2 # Regenerate the Linux hicolor theme icons in packaging/linux/hicolor from the app icon
3 # (crates/app/assets/icon/teams-fast-256.png, the one the app writes when it installs
4 # itself, see AppIcon::RustyTeams in crates/app-base/src/appearance.rs).
5 #
6 # Needs ImageMagick (magick or convert). The outputs are committed, so packaging never
7 # needs it.
8 #
9 # packaging/linux/icons.sh
10 set -euo pipefail
11 ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
12 SRC="$ROOT/crates/app/assets/icon/teams-fast-256.png"
13 OUT="$ROOT/packaging/linux/hicolor"
14 NAME=rusty-teams
15
16 if command -v magick >/dev/null; then IM=(magick); elif command -v convert >/dev/null; then IM=(convert); else
17 echo "error: ImageMagick not found (apt install imagemagick)" >&2
18 exit 1
19 fi
20
21 rm -rf "$OUT"
22 for s in 16 24 32 48 64 128 256; do
23 mkdir -p "$OUT/${s}x${s}/apps"
24 # -strip drops timestamps and profiles, so a rerun on the same source is byte-identical.
25 "${IM[@]}" "$SRC" -filter Lanczos -resize "${s}x${s}" -strip "PNG32:$OUT/${s}x${s}/apps/$NAME.png"
26 done
27 echo "icons written to $OUT"
@@ -0,0 +1,27 @@
1#!/usr/bin/env bash
2# Regenerate the Linux hicolor theme icons in packaging/linux/hicolor from the app icon
3# (crates/app/assets/icon/teams-fast-256.png, the one the app writes when it installs
4# itself, see AppIcon::RustyTeams in crates/app-base/src/appearance.rs).
5#
6# Needs ImageMagick (magick or convert). The outputs are committed, so packaging never
7# needs it.
8#
9# packaging/linux/icons.sh
10set -euo pipefail
11ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
12SRC="$ROOT/crates/app/assets/icon/teams-fast-256.png"
13OUT="$ROOT/packaging/linux/hicolor"
14NAME=rusty-teams
15
16if command -v magick >/dev/null; then IM=(magick); elif command -v convert >/dev/null; then IM=(convert); else
17 echo "error: ImageMagick not found (apt install imagemagick)" >&2
18 exit 1
19fi
20
21rm -rf "$OUT"
22for s in 16 24 32 48 64 128 256; do
23 mkdir -p "$OUT/${s}x${s}/apps"
24 # -strip drops timestamps and profiles, so a rerun on the same source is byte-identical.
25 "${IM[@]}" "$SRC" -filter Lanczos -resize "${s}x${s}" -strip "PNG32:$OUT/${s}x${s}/apps/$NAME.png"
26done
27echo "icons written to $OUT"
packaging/linux/nfpm.yaml added +106 −0
@@ -0,0 +1,106 @@
1 # .deb and .rpm packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
2 # the file tree, substitutes its path for ${STAGE} and the binary's glibc floor for ${GLIBC_MIN}
3 # (nfpm doesn't expand env vars in `src` or `depends`) and exports VERSION, NFPM_ARCH and
4 # RUSTY_TEAMS_MAINTAINER.
5 #
6 # packaging/linux/package.sh --formats "deb rpm"
7 name: rusty-teams
8 arch: ${NFPM_ARCH}
9 platform: linux
10 version: ${VERSION}
11 # semver: 0.5.0-rc.1 becomes 0.5.0~rc.1 in deb/rpm, so pre-releases sort before the release.
12 version_schema: semver
13 release: 1
14 section: net
15 priority: optional
16 maintainer: ${RUSTY_TEAMS_MAINTAINER}
17 homepage: https://github.com/danieldaeschle/rusty-teams
18 license: MIT
19 description: |-
20 A fast, native Microsoft Teams chat client.
21 Chats, channels, meetings and calls with video and screen sharing, desktop
22 notifications and a tray icon. Signs in through a Teams web page in a
23 Chromium- or Firefox-based browser and never sees the password.
24
25 # Microsoft's discontinued Linux client (package `teams`) also installed /usr/bin/teams.
26 conflicts:
27 - teams
28
29 # Linked directly (ELF NEEDED): glibc, libstdc++, libgcc_s, glib/gio/gobject, ALSA, fontconfig,
30 # freetype, xcb, xkbcommon and xkbcommon-x11. Loaded at runtime with dlopen, so the package
31 # tools can't see them: Wayland (libwayland-client) and X11 (libX11) for the window, Vulkan or
32 # EGL for wgpu. libwebrtc dlopens the rest only for calls (PulseAudio, PipeWire for Wayland
33 # screen sharing, VA-API/GBM/DRM for hardware video, the X11 extensions for X11 screen
34 # capture), so those are recommended rather than required. The Teams session runs in the
35 # user's own browser, suggested below.
36 overrides:
37 deb:
38 depends:
39 - libc6 (>= ${GLIBC_MIN})
40 - libgcc-s1
41 - libstdc++6
42 - libglib2.0-0
43 - libasound2
44 - libfontconfig1
45 - libfreetype6
46 - libxcb1
47 - libxkbcommon0
48 - libxkbcommon-x11-0
49 - libwayland-client0
50 - libx11-6
51 - libvulkan1 | libegl1
52 recommends:
53 - mesa-vulkan-drivers
54 - libegl1
55 - libwayland-egl1
56 - libpulse0
57 - libpipewire-0.3-0
58 - libva2
59 - libva-drm2
60 - libdrm2
61 - libgbm1
62 - libxcomposite1
63 - libxdamage1
64 - libxext6
65 - libxfixes3
66 - libxrandr2
67 - xdg-desktop-portal
68 suggests:
69 - chromium | google-chrome-stable | firefox | firefox-esr
70 rpm:
71 # Soname provides rather than package names, so the same requirements resolve on Fedora/RHEL
72 # (libxkbcommon-x11, libX11, ...) and openSUSE (libxkbcommon-x11-0, libX11-6, ...).
73 depends:
74 - libc.so.6(GLIBC_${GLIBC_MIN})(64bit)
75 - libstdc++.so.6()(64bit)
76 - libglib-2.0.so.0()(64bit)
77 - libgio-2.0.so.0()(64bit)
78 - libgobject-2.0.so.0()(64bit)
79 - libasound.so.2()(64bit)
80 - libfontconfig.so.1()(64bit)
81 - libfreetype.so.6()(64bit)
82 - libxcb.so.1()(64bit)
83 - libxkbcommon.so.0()(64bit)
84 - libxkbcommon-x11.so.0()(64bit)
85 - libwayland-client.so.0()(64bit)
86 - libX11.so.6()(64bit)
87 - (libvulkan.so.1()(64bit) or libEGL.so.1()(64bit))
88 recommends:
89 - mesa-vulkan-drivers
90 - libpulse.so.0()(64bit)
91 - libpipewire-0.3.so.0()(64bit)
92 - libva.so.2()(64bit)
93 - libgbm.so.1()(64bit)
94 - xdg-desktop-portal
95
96 contents:
97 - src: ${STAGE}/usr/bin/teams
98 dst: /usr/bin/teams
99 file_info: { mode: 0755 }
100 - src: ${STAGE}/usr/share/
101 dst: /usr/share/
102 type: tree
103
104 scripts:
105 postinstall: packaging/linux/postinst.sh
106 postremove: packaging/linux/postinst.sh
@@ -0,0 +1,106 @@
1# .deb and .rpm packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
2# the file tree, substitutes its path for ${STAGE} and the binary's glibc floor for ${GLIBC_MIN}
3# (nfpm doesn't expand env vars in `src` or `depends`) and exports VERSION, NFPM_ARCH and
4# RUSTY_TEAMS_MAINTAINER.
5#
6# packaging/linux/package.sh --formats "deb rpm"
7name: rusty-teams
8arch: ${NFPM_ARCH}
9platform: linux
10version: ${VERSION}
11# semver: 0.5.0-rc.1 becomes 0.5.0~rc.1 in deb/rpm, so pre-releases sort before the release.
12version_schema: semver
13release: 1
14section: net
15priority: optional
16maintainer: ${RUSTY_TEAMS_MAINTAINER}
17homepage: https://github.com/danieldaeschle/rusty-teams
18license: MIT
19description: |-
20 A fast, native Microsoft Teams chat client.
21 Chats, channels, meetings and calls with video and screen sharing, desktop
22 notifications and a tray icon. Signs in through a Teams web page in a
23 Chromium- or Firefox-based browser and never sees the password.
24
25# Microsoft's discontinued Linux client (package `teams`) also installed /usr/bin/teams.
26conflicts:
27 - teams
28
29# Linked directly (ELF NEEDED): glibc, libstdc++, libgcc_s, glib/gio/gobject, ALSA, fontconfig,
30# freetype, xcb, xkbcommon and xkbcommon-x11. Loaded at runtime with dlopen, so the package
31# tools can't see them: Wayland (libwayland-client) and X11 (libX11) for the window, Vulkan or
32# EGL for wgpu. libwebrtc dlopens the rest only for calls (PulseAudio, PipeWire for Wayland
33# screen sharing, VA-API/GBM/DRM for hardware video, the X11 extensions for X11 screen
34# capture), so those are recommended rather than required. The Teams session runs in the
35# user's own browser, suggested below.
36overrides:
37 deb:
38 depends:
39 - libc6 (>= ${GLIBC_MIN})
40 - libgcc-s1
41 - libstdc++6
42 - libglib2.0-0
43 - libasound2
44 - libfontconfig1
45 - libfreetype6
46 - libxcb1
47 - libxkbcommon0
48 - libxkbcommon-x11-0
49 - libwayland-client0
50 - libx11-6
51 - libvulkan1 | libegl1
52 recommends:
53 - mesa-vulkan-drivers
54 - libegl1
55 - libwayland-egl1
56 - libpulse0
57 - libpipewire-0.3-0
58 - libva2
59 - libva-drm2
60 - libdrm2
61 - libgbm1
62 - libxcomposite1
63 - libxdamage1
64 - libxext6
65 - libxfixes3
66 - libxrandr2
67 - xdg-desktop-portal
68 suggests:
69 - chromium | google-chrome-stable | firefox | firefox-esr
70 rpm:
71 # Soname provides rather than package names, so the same requirements resolve on Fedora/RHEL
72 # (libxkbcommon-x11, libX11, ...) and openSUSE (libxkbcommon-x11-0, libX11-6, ...).
73 depends:
74 - libc.so.6(GLIBC_${GLIBC_MIN})(64bit)
75 - libstdc++.so.6()(64bit)
76 - libglib-2.0.so.0()(64bit)
77 - libgio-2.0.so.0()(64bit)
78 - libgobject-2.0.so.0()(64bit)
79 - libasound.so.2()(64bit)
80 - libfontconfig.so.1()(64bit)
81 - libfreetype.so.6()(64bit)
82 - libxcb.so.1()(64bit)
83 - libxkbcommon.so.0()(64bit)
84 - libxkbcommon-x11.so.0()(64bit)
85 - libwayland-client.so.0()(64bit)
86 - libX11.so.6()(64bit)
87 - (libvulkan.so.1()(64bit) or libEGL.so.1()(64bit))
88 recommends:
89 - mesa-vulkan-drivers
90 - libpulse.so.0()(64bit)
91 - libpipewire-0.3.so.0()(64bit)
92 - libva.so.2()(64bit)
93 - libgbm.so.1()(64bit)
94 - xdg-desktop-portal
95
96contents:
97 - src: ${STAGE}/usr/bin/teams
98 dst: /usr/bin/teams
99 file_info: { mode: 0755 }
100 - src: ${STAGE}/usr/share/
101 dst: /usr/share/
102 type: tree
103
104scripts:
105 postinstall: packaging/linux/postinst.sh
106 postremove: packaging/linux/postinst.sh
packaging/linux/package.sh added +180 −0
@@ -0,0 +1,180 @@
1 #!/usr/bin/env bash
2 # Build and package Rusty Teams for Linux (<arch> is x86_64 or aarch64):
3 #
4 # $DIST/rusty-teams-<version>-linux-<arch>.AppImage any distro with glibc >= the build host's
5 # $DIST/rusty-teams-<version>-linux-<arch>.AppImage.zsync delta updates (needs zsyncmake)
6 # $DIST/rusty-teams-<version>-linux-<arch>.deb Debian, Ubuntu, Mint, Pop!_OS, ...
7 # $DIST/rusty-teams-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...
8 # $DIST/rusty-teams-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)
9 #
10 # Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"]
11 #
12 # Needs: cargo and the Linux build setup from the README (clang 21+, mold); nfpm for deb/rpm
13 # (https://nfpm.goreleaser.com); objdump (binutils). AppImage tooling is downloaded at verified
14 # pins into $CARGO_TARGET_DIR. Build on an old distro (CI: Ubuntu 22.04, glibc 2.35) so the
15 # binary runs on newer ones. Optional: desktop-file-validate, appstreamcli, zsyncmake (the zsync
16 # package) for the AppImage's .zsync. --skip-build packages $CARGO_TARGET_DIR/release/teams as is.
17 set -euo pipefail
18 # Packaged files and directories get 644/755 whatever the caller's umask.
19 umask 022
20 # shellcheck source=../env.sh
21 . "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
22 HERE="$ROOT/packaging/linux"
23 # shellcheck source=verified-download.sh
24 . "$HERE/verified-download.sh"
25 # The window's app id, the .desktop file and the icon name (DESKTOP_ID in linux_desktop.rs).
26 DESKTOP_ID=rusty-teams
27 # The AppStream component id (packaging/linux/rusty-teams.metainfo.xml.in).
28 COMPONENT_ID=io.github.danieldaeschle.RustyTeams
29
30 SKIP_BUILD=0
31 FORMATS="appimage deb rpm tar"
32 while [[ $# -gt 0 ]]; do
33 case "$1" in
34 --skip-build) SKIP_BUILD=1; shift ;;
35 --formats) FORMATS="$2"; shift 2 ;;
36 -h | --help) sed -n '2,16p' "$0"; exit 0 ;;
37 *) echo "unknown argument: $1" >&2; exit 2 ;;
38 esac
39 done
40
41 ARCH="$(uname -m)"
42 case "$ARCH" in
43 x86_64) DEB_ARCH=amd64 ;;
44 aarch64 | arm64) ARCH=aarch64; DEB_ARCH=arm64 ;;
45 *) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
46 esac
47 export RUSTY_TEAMS_MAINTAINER="${RUSTY_TEAMS_MAINTAINER:-Daniel Däschle <30751516+danieldaeschle@users.noreply.github.com>}"
48 BASENAME="rusty-teams-$VERSION-linux-$ARCH"
49
50 echo "==> Rusty Teams $VERSION for Linux $ARCH ($FORMATS)"
51
52 if [[ "$SKIP_BUILD" = 0 ]]; then
53 (cd "$ROOT" && cargo build --release --locked -p app)
54 fi
55 BIN="$CARGO_TARGET_DIR/release"
56 [[ -x "$BIN/teams" ]] || { echo "error: $BIN/teams not found (build it or drop --skip-build)" >&2; exit 1; }
57 WORK="$CARGO_TARGET_DIR/linux-package"
58 STAGE="$WORK/root"
59 rm -rf "$WORK"
60
61 # ---- stage an FHS tree (shared by every format) -------------------------------------------------
62 install -Dm755 "$BIN/teams" "$STAGE/usr/bin/teams"
63 strip "$STAGE/usr/bin/teams" 2>/dev/null || true
64 install -Dm644 "$HERE/$DESKTOP_ID.desktop" "$STAGE/usr/share/applications/$DESKTOP_ID.desktop"
65 mkdir -p "$STAGE/usr/share/metainfo"
66 sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$BUILD_DATE/g" \
67 "$HERE/$DESKTOP_ID.metainfo.xml.in" >"$STAGE/usr/share/metainfo/$COMPONENT_ID.metainfo.xml"
68 mkdir -p "$STAGE/usr/share/icons"
69 cp -R "$HERE/hicolor" "$STAGE/usr/share/icons/"
70 mkdir -p "$STAGE/usr/share/doc/rusty-teams"
71 copy_docs "$STAGE/usr/share/doc/rusty-teams"
72
73 if command -v desktop-file-validate >/dev/null; then
74 desktop-file-validate "$STAGE/usr/share/applications/$DESKTOP_ID.desktop"
75 fi
76 if command -v appstreamcli >/dev/null; then
77 appstreamcli validate --no-net --explain "$STAGE/usr/share/metainfo/$COMPONENT_ID.metainfo.xml"
78 fi
79
80 # The newest glibc symbol version the binary needs: the deb/rpm depend on it, and it is the
81 # oldest distro the AppImage and tarball run on.
82 GLIBC_MIN="$(objdump -T "$STAGE/usr/bin/teams" | grep -o 'GLIBC_[0-9][0-9.]*' | sed 's/^GLIBC_//' | sort -uV | tail -n 1)"
83 [[ -n "$GLIBC_MIN" ]] || { echo "error: could not read the glibc version from $STAGE/usr/bin/teams" >&2; exit 1; }
84 echo "needs glibc >= $GLIBC_MIN"
85
86 has() { case " $FORMATS " in *" $1 "*) return 0 ;; *) return 1 ;; esac; }
87
88 # ---- .tar.gz ------------------------------------------------------------------------------------
89 if has tar; then
90 mkdir -p "$WORK/tar"
91 cp -R "$STAGE/usr" "$WORK/tar/$BASENAME"
92 tar -C "$WORK/tar" -czf "$DIST/$BASENAME.tar.gz" "$BASENAME"
93 echo "wrote $DIST/$BASENAME.tar.gz"
94 fi
95
96 # ---- .deb / .rpm --------------------------------------------------------------------------------
97 if has deb || has rpm; then
98 command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }
99 export VERSION
100 export NFPM_ARCH="$DEB_ARCH"
101 # nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src` or
102 # the dependency lists.
103 sed -e "s|\${STAGE}|$STAGE|g" -e "s|\${GLIBC_MIN}|$GLIBC_MIN|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
104 for fmt in deb rpm; do
105 if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
106 done
107 fi
108
109 # ---- AppImage -----------------------------------------------------------------------------------
110 if has appimage; then
111 APPDIR="$WORK/RustyTeams.AppDir"
112 cp -R "$STAGE" "$APPDIR"
113 # AppRun is a script, not a symlink: it installs the .desktop entry and icons into
114 # $XDG_DATA_HOME before launching, so Wayland compositors can resolve the window's
115 # app_id to our icon instead of the generic Wayland logo (opt-out env in the script
116 # header). Logic is covered by packaging/linux/apprun-test.sh.
117 install -Dm755 "$HERE/AppRun" "$APPDIR/AppRun"
118 cp "$HERE/$DESKTOP_ID.desktop" "$APPDIR/$DESKTOP_ID.desktop"
119 cp "$HERE/hicolor/256x256/apps/$DESKTOP_ID.png" "$APPDIR/$DESKTOP_ID.png"
120 ln -s "$DESKTOP_ID.png" "$APPDIR/.DirIcon"
121
122 # Digests from the official GitHub release asset metadata:
123 # https://github.com/AppImage/appimagetool/releases/tag/1.9.1
124 # https://github.com/AppImage/type2-runtime/releases/tag/20251108
125 # Keep both pins together:
126 # appimagetool otherwise downloads the mutable latest type2 runtime itself.
127 TOOL_VERSION=1.9.1
128 RUNTIME_VERSION=20251108
129 case "$ARCH" in
130 x86_64)
131 TOOL_SHA256=ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0
132 RUNTIME_SHA256=2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d
133 ;;
134 aarch64)
135 TOOL_SHA256=f0837e7448a0c1e4e650a93bb3e85802546e60654ef287576f46c71c126a9158
136 RUNTIME_SHA256=00cbdfcf917cc6c0ff6d3347d59e0ca1f7f45a6df1a428a0d6d8a78664d87444
137 ;;
138 esac
139 mkdir -p "$CARGO_TARGET_DIR"
140 TOOL="${APPIMAGETOOL:-$CARGO_TARGET_DIR/appimagetool-$TOOL_VERSION-$ARCH.AppImage}"
141 if [[ -n "${APPIMAGETOOL:-}" ]]; then
142 verify_appimagetool_override "$TOOL" "$TOOL_SHA256" "$TOOL_VERSION" "$ARCH"
143 else
144 download_verified \
145 "https://github.com/AppImage/appimagetool/releases/download/$TOOL_VERSION/appimagetool-$ARCH.AppImage" \
146 "$TOOL" "$TOOL_SHA256" true
147 fi
148 RUNTIME="$CARGO_TARGET_DIR/type2-runtime-$RUNTIME_VERSION-$ARCH"
149 download_verified \
150 "https://github.com/AppImage/type2-runtime/releases/download/$RUNTIME_VERSION/runtime-$ARCH" \
151 "$RUNTIME" "$RUNTIME_SHA256"
152 # Absolute, because appimagetool runs in $DIST below (CARGO_TARGET_DIR or APPIMAGETOOL may be
153 # relative).
154 OUT="$(cd "$DIST" && pwd)/$BASENAME.AppImage"
155 APPDIR="$(cd "$APPDIR" && pwd)"
156 TOOL="$(cd "$(dirname "$TOOL")" && pwd)/$(basename "$TOOL")"
157 RUNTIME="$(cd "$(dirname "$RUNTIME")" && pwd)/$(basename "$RUNTIME")"
158 # A .zsync left by an earlier run would hide a missing zsyncmake and describe another file.
159 rm -f "$OUT.zsync"
160 # Update information: AppImageUpdate, AppImageLauncher and the like read it from the file and
161 # fetch only the blocks that changed in a newer release, through the .zsync published next to
162 # each AppImage on GitHub Releases. `latest` is the newest published release that is not a
163 # pre-release. A fork's builds point at its own releases through GITHUB_REPOSITORY.
164 REPO="${GITHUB_REPOSITORY:-danieldaeschle/rusty-teams}"
165 UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest|rusty-teams-*-linux-$ARCH.AppImage.zsync"
166 # Extract-and-run: works without FUSE (containers, CI). The output embeds the static runtime,
167 # so users don't need libfuse2 either. With zsyncmake on the host appimagetool also writes the
168 # .zsync, into its working directory, hence the cd.
169 (cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream \
170 --runtime-file "$RUNTIME" -u "$UPDATE_INFO" "$APPDIR" "$OUT")
171 echo "wrote $OUT"
172 if [[ -s "$OUT.zsync" ]]; then
173 echo "wrote $OUT.zsync"
174 else
175 warn "zsyncmake not found, so $OUT.zsync was not written; AppImage delta updates need it"
176 fi
177 fi
178
179 echo "==> done"
180 ls -lh "$DIST"
@@ -0,0 +1,180 @@
1#!/usr/bin/env bash
2# Build and package Rusty Teams for Linux (<arch> is x86_64 or aarch64):
3#
4# $DIST/rusty-teams-<version>-linux-<arch>.AppImage any distro with glibc >= the build host's
5# $DIST/rusty-teams-<version>-linux-<arch>.AppImage.zsync delta updates (needs zsyncmake)
6# $DIST/rusty-teams-<version>-linux-<arch>.deb Debian, Ubuntu, Mint, Pop!_OS, ...
7# $DIST/rusty-teams-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...
8# $DIST/rusty-teams-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)
9#
10# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"]
11#
12# Needs: cargo and the Linux build setup from the README (clang 21+, mold); nfpm for deb/rpm
13# (https://nfpm.goreleaser.com); objdump (binutils). AppImage tooling is downloaded at verified
14# pins into $CARGO_TARGET_DIR. Build on an old distro (CI: Ubuntu 22.04, glibc 2.35) so the
15# binary runs on newer ones. Optional: desktop-file-validate, appstreamcli, zsyncmake (the zsync
16# package) for the AppImage's .zsync. --skip-build packages $CARGO_TARGET_DIR/release/teams as is.
17set -euo pipefail
18# Packaged files and directories get 644/755 whatever the caller's umask.
19umask 022
20# shellcheck source=../env.sh
21. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
22HERE="$ROOT/packaging/linux"
23# shellcheck source=verified-download.sh
24. "$HERE/verified-download.sh"
25# The window's app id, the .desktop file and the icon name (DESKTOP_ID in linux_desktop.rs).
26DESKTOP_ID=rusty-teams
27# The AppStream component id (packaging/linux/rusty-teams.metainfo.xml.in).
28COMPONENT_ID=io.github.danieldaeschle.RustyTeams
29
30SKIP_BUILD=0
31FORMATS="appimage deb rpm tar"
32while [[ $# -gt 0 ]]; do
33 case "$1" in
34 --skip-build) SKIP_BUILD=1; shift ;;
35 --formats) FORMATS="$2"; shift 2 ;;
36 -h | --help) sed -n '2,16p' "$0"; exit 0 ;;
37 *) echo "unknown argument: $1" >&2; exit 2 ;;
38 esac
39done
40
41ARCH="$(uname -m)"
42case "$ARCH" in
43 x86_64) DEB_ARCH=amd64 ;;
44 aarch64 | arm64) ARCH=aarch64; DEB_ARCH=arm64 ;;
45 *) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
46esac
47export RUSTY_TEAMS_MAINTAINER="${RUSTY_TEAMS_MAINTAINER:-Daniel Däschle <30751516+danieldaeschle@users.noreply.github.com>}"
48BASENAME="rusty-teams-$VERSION-linux-$ARCH"
49
50echo "==> Rusty Teams $VERSION for Linux $ARCH ($FORMATS)"
51
52if [[ "$SKIP_BUILD" = 0 ]]; then
53 (cd "$ROOT" && cargo build --release --locked -p app)
54fi
55BIN="$CARGO_TARGET_DIR/release"
56[[ -x "$BIN/teams" ]] || { echo "error: $BIN/teams not found (build it or drop --skip-build)" >&2; exit 1; }
57WORK="$CARGO_TARGET_DIR/linux-package"
58STAGE="$WORK/root"
59rm -rf "$WORK"
60
61# ---- stage an FHS tree (shared by every format) -------------------------------------------------
62install -Dm755 "$BIN/teams" "$STAGE/usr/bin/teams"
63strip "$STAGE/usr/bin/teams" 2>/dev/null || true
64install -Dm644 "$HERE/$DESKTOP_ID.desktop" "$STAGE/usr/share/applications/$DESKTOP_ID.desktop"
65mkdir -p "$STAGE/usr/share/metainfo"
66sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$BUILD_DATE/g" \
67 "$HERE/$DESKTOP_ID.metainfo.xml.in" >"$STAGE/usr/share/metainfo/$COMPONENT_ID.metainfo.xml"
68mkdir -p "$STAGE/usr/share/icons"
69cp -R "$HERE/hicolor" "$STAGE/usr/share/icons/"
70mkdir -p "$STAGE/usr/share/doc/rusty-teams"
71copy_docs "$STAGE/usr/share/doc/rusty-teams"
72
73if command -v desktop-file-validate >/dev/null; then
74 desktop-file-validate "$STAGE/usr/share/applications/$DESKTOP_ID.desktop"
75fi
76if command -v appstreamcli >/dev/null; then
77 appstreamcli validate --no-net --explain "$STAGE/usr/share/metainfo/$COMPONENT_ID.metainfo.xml"
78fi
79
80# The newest glibc symbol version the binary needs: the deb/rpm depend on it, and it is the
81# oldest distro the AppImage and tarball run on.
82GLIBC_MIN="$(objdump -T "$STAGE/usr/bin/teams" | grep -o 'GLIBC_[0-9][0-9.]*' | sed 's/^GLIBC_//' | sort -uV | tail -n 1)"
83[[ -n "$GLIBC_MIN" ]] || { echo "error: could not read the glibc version from $STAGE/usr/bin/teams" >&2; exit 1; }
84echo "needs glibc >= $GLIBC_MIN"
85
86has() { case " $FORMATS " in *" $1 "*) return 0 ;; *) return 1 ;; esac; }
87
88# ---- .tar.gz ------------------------------------------------------------------------------------
89if has tar; then
90 mkdir -p "$WORK/tar"
91 cp -R "$STAGE/usr" "$WORK/tar/$BASENAME"
92 tar -C "$WORK/tar" -czf "$DIST/$BASENAME.tar.gz" "$BASENAME"
93 echo "wrote $DIST/$BASENAME.tar.gz"
94fi
95
96# ---- .deb / .rpm --------------------------------------------------------------------------------
97if has deb || has rpm; then
98 command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }
99 export VERSION
100 export NFPM_ARCH="$DEB_ARCH"
101 # nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src` or
102 # the dependency lists.
103 sed -e "s|\${STAGE}|$STAGE|g" -e "s|\${GLIBC_MIN}|$GLIBC_MIN|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
104 for fmt in deb rpm; do
105 if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
106 done
107fi
108
109# ---- AppImage -----------------------------------------------------------------------------------
110if has appimage; then
111 APPDIR="$WORK/RustyTeams.AppDir"
112 cp -R "$STAGE" "$APPDIR"
113 # AppRun is a script, not a symlink: it installs the .desktop entry and icons into
114 # $XDG_DATA_HOME before launching, so Wayland compositors can resolve the window's
115 # app_id to our icon instead of the generic Wayland logo (opt-out env in the script
116 # header). Logic is covered by packaging/linux/apprun-test.sh.
117 install -Dm755 "$HERE/AppRun" "$APPDIR/AppRun"
118 cp "$HERE/$DESKTOP_ID.desktop" "$APPDIR/$DESKTOP_ID.desktop"
119 cp "$HERE/hicolor/256x256/apps/$DESKTOP_ID.png" "$APPDIR/$DESKTOP_ID.png"
120 ln -s "$DESKTOP_ID.png" "$APPDIR/.DirIcon"
121
122 # Digests from the official GitHub release asset metadata:
123 # https://github.com/AppImage/appimagetool/releases/tag/1.9.1
124 # https://github.com/AppImage/type2-runtime/releases/tag/20251108
125 # Keep both pins together:
126 # appimagetool otherwise downloads the mutable latest type2 runtime itself.
127 TOOL_VERSION=1.9.1
128 RUNTIME_VERSION=20251108
129 case "$ARCH" in
130 x86_64)
131 TOOL_SHA256=ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0
132 RUNTIME_SHA256=2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d
133 ;;
134 aarch64)
135 TOOL_SHA256=f0837e7448a0c1e4e650a93bb3e85802546e60654ef287576f46c71c126a9158
136 RUNTIME_SHA256=00cbdfcf917cc6c0ff6d3347d59e0ca1f7f45a6df1a428a0d6d8a78664d87444
137 ;;
138 esac
139 mkdir -p "$CARGO_TARGET_DIR"
140 TOOL="${APPIMAGETOOL:-$CARGO_TARGET_DIR/appimagetool-$TOOL_VERSION-$ARCH.AppImage}"
141 if [[ -n "${APPIMAGETOOL:-}" ]]; then
142 verify_appimagetool_override "$TOOL" "$TOOL_SHA256" "$TOOL_VERSION" "$ARCH"
143 else
144 download_verified \
145 "https://github.com/AppImage/appimagetool/releases/download/$TOOL_VERSION/appimagetool-$ARCH.AppImage" \
146 "$TOOL" "$TOOL_SHA256" true
147 fi
148 RUNTIME="$CARGO_TARGET_DIR/type2-runtime-$RUNTIME_VERSION-$ARCH"
149 download_verified \
150 "https://github.com/AppImage/type2-runtime/releases/download/$RUNTIME_VERSION/runtime-$ARCH" \
151 "$RUNTIME" "$RUNTIME_SHA256"
152 # Absolute, because appimagetool runs in $DIST below (CARGO_TARGET_DIR or APPIMAGETOOL may be
153 # relative).
154 OUT="$(cd "$DIST" && pwd)/$BASENAME.AppImage"
155 APPDIR="$(cd "$APPDIR" && pwd)"
156 TOOL="$(cd "$(dirname "$TOOL")" && pwd)/$(basename "$TOOL")"
157 RUNTIME="$(cd "$(dirname "$RUNTIME")" && pwd)/$(basename "$RUNTIME")"
158 # A .zsync left by an earlier run would hide a missing zsyncmake and describe another file.
159 rm -f "$OUT.zsync"
160 # Update information: AppImageUpdate, AppImageLauncher and the like read it from the file and
161 # fetch only the blocks that changed in a newer release, through the .zsync published next to
162 # each AppImage on GitHub Releases. `latest` is the newest published release that is not a
163 # pre-release. A fork's builds point at its own releases through GITHUB_REPOSITORY.
164 REPO="${GITHUB_REPOSITORY:-danieldaeschle/rusty-teams}"
165 UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest|rusty-teams-*-linux-$ARCH.AppImage.zsync"
166 # Extract-and-run: works without FUSE (containers, CI). The output embeds the static runtime,
167 # so users don't need libfuse2 either. With zsyncmake on the host appimagetool also writes the
168 # .zsync, into its working directory, hence the cd.
169 (cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream \
170 --runtime-file "$RUNTIME" -u "$UPDATE_INFO" "$APPDIR" "$OUT")
171 echo "wrote $OUT"
172 if [[ -s "$OUT.zsync" ]]; then
173 echo "wrote $OUT.zsync"
174 else
175 warn "zsyncmake not found, so $OUT.zsync was not written; AppImage delta updates need it"
176 fi
177fi
178
179echo "==> done"
180ls -lh "$DIST"
packaging/linux/postinst.sh added +10 −0
@@ -0,0 +1,10 @@
1 #!/bin/sh
2 # deb/rpm post-install and post-remove: refresh the desktop and icon caches.
3 # Every tool is optional; missing ones are skipped.
4 if command -v update-desktop-database >/dev/null 2>&1; then
5 update-desktop-database -q /usr/share/applications || true
6 fi
7 if command -v gtk-update-icon-cache >/dev/null 2>&1; then
8 gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor || true
9 fi
10 exit 0
@@ -0,0 +1,10 @@
1#!/bin/sh
2# deb/rpm post-install and post-remove: refresh the desktop and icon caches.
3# Every tool is optional; missing ones are skipped.
4if command -v update-desktop-database >/dev/null 2>&1; then
5 update-desktop-database -q /usr/share/applications || true
6fi
7if command -v gtk-update-icon-cache >/dev/null 2>&1; then
8 gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor || true
9fi
10exit 0
packaging/linux/rusty-teams.desktop added +17 −0
@@ -0,0 +1,17 @@
1 [Desktop Entry]
2 Type=Application
3 Name=Rusty Teams
4 GenericName=Microsoft Teams client
5 Comment=A fast, native Microsoft Teams chat client
6 Exec=teams
7 TryExec=teams
8 Icon=rusty-teams
9 # Matches the window's app id (LINUX_APP_ID in crates/app/src/main.rs), so docks pair the
10 # window with this entry; the app writes the same id when it installs itself (linux_desktop.rs).
11 StartupWMClass=rusty-teams
12 Terminal=false
13 Categories=Network;InstantMessaging;Chat;
14 Keywords=Teams;Chat;Microsoft;
15 # AppRun registers the desktop entry and icons itself; tell external AppImage
16 # integrators (AppImageLauncher, appimaged) not to add a duplicate.
17 X-AppImage-Integrate=false
@@ -0,0 +1,17 @@
1[Desktop Entry]
2Type=Application
3Name=Rusty Teams
4GenericName=Microsoft Teams client
5Comment=A fast, native Microsoft Teams chat client
6Exec=teams
7TryExec=teams
8Icon=rusty-teams
9# Matches the window's app id (LINUX_APP_ID in crates/app/src/main.rs), so docks pair the
10# window with this entry; the app writes the same id when it installs itself (linux_desktop.rs).
11StartupWMClass=rusty-teams
12Terminal=false
13Categories=Network;InstantMessaging;Chat;
14Keywords=Teams;Chat;Microsoft;
15# AppRun registers the desktop entry and icons itself; tell external AppImage
16# integrators (AppImageLauncher, appimaged) not to add a duplicate.
17X-AppImage-Integrate=false
packaging/linux/rusty-teams.metainfo.xml.in added +64 −0
@@ -0,0 +1,64 @@
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- AppStream metadata (software centres). Template: package.sh substitutes @VERSION@ and
3 @DATE@ from Cargo.toml and the build date. -->
4 <component type="desktop-application">
5 <id>io.github.danieldaeschle.RustyTeams</id>
6 <metadata_license>CC0-1.0</metadata_license>
7 <project_license>MIT</project_license>
8 <name>Rusty Teams</name>
9 <summary>A fast, native Microsoft Teams chat client</summary>
10 <developer id="io.github.danieldaeschle">
11 <name>Daniel Däschle</name>
12 </developer>
13 <description>
14 <p>
15 Rusty Teams is a native Microsoft Teams client written in Rust. It signs in through
16 a Teams web page in your own browser, never sees your password and keeps a local
17 cache, so chats open instantly and stay readable offline.
18 </p>
19 <ul>
20 <li>Chats, channels, meetings and calls with video and screen sharing</li>
21 <li>Desktop notifications and a tray icon</li>
22 <li>Needs a Chromium- or Firefox-based browser for the Teams session</li>
23 </ul>
24 </description>
25 <!-- The desktop id is the window's app id (rusty-teams), so docks pair the window with it. -->
26 <launchable type="desktop-id">rusty-teams.desktop</launchable>
27 <icon type="stock">rusty-teams</icon>
28 <!-- Only url types known to appstream 0.15 (Ubuntu 22.04, where CI validates): no vcs-browser. -->
29 <url type="homepage">https://github.com/danieldaeschle/rusty-teams</url>
30 <url type="bugtracker">https://github.com/danieldaeschle/rusty-teams/issues</url>
31 <categories>
32 <category>Network</category>
33 <category>InstantMessaging</category>
34 <category>Chat</category>
35 </categories>
36 <keywords>
37 <keyword>Teams</keyword>
38 <keyword>Chat</keyword>
39 <keyword>Microsoft</keyword>
40 </keywords>
41 <screenshots>
42 <screenshot type="default">
43 <caption>The chat view with demo data</caption>
44 <image>https://raw.githubusercontent.com/danieldaeschle/rusty-teams/main/.github/app-demo.png</image>
45 </screenshot>
46 </screenshots>
47 <requires>
48 <display_length compare="ge">640</display_length>
49 </requires>
50 <supports>
51 <control>keyboard</control>
52 <control>pointing</control>
53 </supports>
54 <provides>
55 <binary>teams</binary>
56 </provides>
57 <content_rating type="oars-1.1">
58 <content_attribute id="social-chat">intense</content_attribute>
59 <content_attribute id="social-audio">intense</content_attribute>
60 </content_rating>
61 <releases>
62 <release version="@VERSION@" date="@DATE@"/>
63 </releases>
64 </component>
@@ -0,0 +1,64 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- AppStream metadata (software centres). Template: package.sh substitutes @VERSION@ and
3 @DATE@ from Cargo.toml and the build date. -->
4<component type="desktop-application">
5 <id>io.github.danieldaeschle.RustyTeams</id>
6 <metadata_license>CC0-1.0</metadata_license>
7 <project_license>MIT</project_license>
8 <name>Rusty Teams</name>
9 <summary>A fast, native Microsoft Teams chat client</summary>
10 <developer id="io.github.danieldaeschle">
11 <name>Daniel Däschle</name>
12 </developer>
13 <description>
14 <p>
15 Rusty Teams is a native Microsoft Teams client written in Rust. It signs in through
16 a Teams web page in your own browser, never sees your password and keeps a local
17 cache, so chats open instantly and stay readable offline.
18 </p>
19 <ul>
20 <li>Chats, channels, meetings and calls with video and screen sharing</li>
21 <li>Desktop notifications and a tray icon</li>
22 <li>Needs a Chromium- or Firefox-based browser for the Teams session</li>
23 </ul>
24 </description>
25 <!-- The desktop id is the window's app id (rusty-teams), so docks pair the window with it. -->
26 <launchable type="desktop-id">rusty-teams.desktop</launchable>
27 <icon type="stock">rusty-teams</icon>
28 <!-- Only url types known to appstream 0.15 (Ubuntu 22.04, where CI validates): no vcs-browser. -->
29 <url type="homepage">https://github.com/danieldaeschle/rusty-teams</url>
30 <url type="bugtracker">https://github.com/danieldaeschle/rusty-teams/issues</url>
31 <categories>
32 <category>Network</category>
33 <category>InstantMessaging</category>
34 <category>Chat</category>
35 </categories>
36 <keywords>
37 <keyword>Teams</keyword>
38 <keyword>Chat</keyword>
39 <keyword>Microsoft</keyword>
40 </keywords>
41 <screenshots>
42 <screenshot type="default">
43 <caption>The chat view with demo data</caption>
44 <image>https://raw.githubusercontent.com/danieldaeschle/rusty-teams/main/.github/app-demo.png</image>
45 </screenshot>
46 </screenshots>
47 <requires>
48 <display_length compare="ge">640</display_length>
49 </requires>
50 <supports>
51 <control>keyboard</control>
52 <control>pointing</control>
53 </supports>
54 <provides>
55 <binary>teams</binary>
56 </provides>
57 <content_rating type="oars-1.1">
58 <content_attribute id="social-chat">intense</content_attribute>
59 <content_attribute id="social-audio">intense</content_attribute>
60 </content_rating>
61 <releases>
62 <release version="@VERSION@" date="@DATE@"/>
63 </releases>
64</component>
packaging/linux/verified-download-test.sh added +75 −0
@@ -0,0 +1,75 @@
1 #!/usr/bin/env bash
2 # Fast, network-free checks of the verified AppImage tooling cache and override.
3 set -euo pipefail
4 HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5 # shellcheck source=verified-download.sh
6 . "$HERE/verified-download.sh"
7
8 sha256() {
9 if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi
10 }
11 fail() { echo "FAIL: $*" >&2; exit 1; }
12
13 TMP="$(mktemp -d)"
14 trap 'rm -rf "$TMP"' EXIT
15 source_asset="$TMP/source.AppImage"
16 cache="$TMP/cached.AppImage"
17 printf '#!/bin/sh\nexit 0\n' >"$source_asset"
18 expected="$(sha256 "$source_asset")"
19 # Setup uses the external binary because failure-path tests below shadow the chmod function.
20
21 # Offline preseed: a valid 0644 cache must not try the unavailable URL and must become runnable.
22 cp "$source_asset" "$cache"
23 /bin/chmod 644 "$cache"
24 download_verified "file://$TMP/unavailable" "$cache" "$expected" true || fail "offline cache was not reused"
25 [[ -x "$cache" ]] || fail "valid preseed did not become executable"
26
27 # If a valid but non-executable cache cannot be chmod'd, fail here rather than at invocation.
28 /bin/chmod 644 "$cache"
29 chmod() { return 1; }
30 if err="$(download_verified "file://$TMP/unavailable" "$cache" "$expected" true 2>&1)"; then fail "unfixable cache was accepted"; fi
31 case "$err" in *"verified asset is not executable and cannot be chmod'd: $cache"*) ;; *) fail "wrong cache error: $err" ;; esac
32 unset -f chmod
33 /bin/chmod 755 "$cache"
34
35 # A verified, executable cache can be owned by another user; do not try to chmod it again.
36 chmod() { fail "chmod called for an already executable cache"; }
37 download_verified "file://$TMP/unavailable" "$cache" "$expected" true || fail "executable cache was not reused"
38 unset -f chmod
39
40 # The type2 runtime is read as data; a valid 0644 preseed must remain usable as-is.
41 runtime="$TMP/runtime"
42 cp "$source_asset" "$runtime"
43 /bin/chmod 644 "$runtime"
44 chmod() { fail "chmod called for a readable runtime cache"; }
45 download_verified "file://$TMP/unavailable" "$runtime" "$expected" || fail "readable runtime was not reused"
46 unset -f chmod
47 [[ ! -x "$runtime" ]] || fail "runtime was needlessly made executable"
48
49 # A fresh runtime download is verified, readable data rather than an executable program.
50 fresh_runtime="$TMP/fresh-runtime"
51 download_verified "file://$source_asset" "$fresh_runtime" "$expected" || fail "fresh runtime download failed"
52 cmp -s "$source_asset" "$fresh_runtime" || fail "fresh runtime differs from verified asset"
53 [[ -r "$fresh_runtime" ]] || fail "fresh runtime is not readable"
54 [[ ! -x "$fresh_runtime" ]] || fail "fresh runtime was made executable"
55 mode="$(stat -c %a "$fresh_runtime" 2>/dev/null || stat -f %Lp "$fresh_runtime")"
56 [[ "$mode" = 644 ]] || fail "fresh runtime mode is $mode, expected 644"
57
58 # A corrupt cache is replaced only by bytes with the pinned digest.
59 printf 'corrupt' >"$cache"
60 download_verified "file://$source_asset" "$cache" "$expected" true || fail "corrupt cache was not replaced"
61 cmp -s "$source_asset" "$cache" || fail "replacement differs from verified asset"
62 [[ -x "$cache" ]] || fail "replacement is not executable"
63
64 wrong_digest="$(printf '%064d' 0)"
65 bad="$TMP/bad.AppImage"
66 if download_verified "file://$source_asset" "$bad" "$wrong_digest" >/dev/null 2>&1; then fail "wrong digest accepted"; fi
67 [[ ! -e "$bad" ]] || fail "wrong-digest download left a cache entry"
68
69 verify_appimagetool_override "$cache" "$expected" 1.9.1 x86_64 || fail "valid override rejected"
70 /bin/chmod 644 "$cache"
71 if verify_appimagetool_override "$cache" "$expected" 1.9.1 x86_64 >/dev/null 2>&1; then fail "non-executable override accepted"; fi
72 /bin/chmod 755 "$cache"
73 if verify_appimagetool_override "$cache" "$wrong_digest" 1.9.1 x86_64 >/dev/null 2>&1; then fail "wrong-digest override accepted"; fi
74
75 echo "verified AppImage tooling ok"
@@ -0,0 +1,75 @@
1#!/usr/bin/env bash
2# Fast, network-free checks of the verified AppImage tooling cache and override.
3set -euo pipefail
4HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5# shellcheck source=verified-download.sh
6. "$HERE/verified-download.sh"
7
8sha256() {
9 if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi
10}
11fail() { echo "FAIL: $*" >&2; exit 1; }
12
13TMP="$(mktemp -d)"
14trap 'rm -rf "$TMP"' EXIT
15source_asset="$TMP/source.AppImage"
16cache="$TMP/cached.AppImage"
17printf '#!/bin/sh\nexit 0\n' >"$source_asset"
18expected="$(sha256 "$source_asset")"
19# Setup uses the external binary because failure-path tests below shadow the chmod function.
20
21# Offline preseed: a valid 0644 cache must not try the unavailable URL and must become runnable.
22cp "$source_asset" "$cache"
23/bin/chmod 644 "$cache"
24download_verified "file://$TMP/unavailable" "$cache" "$expected" true || fail "offline cache was not reused"
25[[ -x "$cache" ]] || fail "valid preseed did not become executable"
26
27# If a valid but non-executable cache cannot be chmod'd, fail here rather than at invocation.
28/bin/chmod 644 "$cache"
29chmod() { return 1; }
30if err="$(download_verified "file://$TMP/unavailable" "$cache" "$expected" true 2>&1)"; then fail "unfixable cache was accepted"; fi
31case "$err" in *"verified asset is not executable and cannot be chmod'd: $cache"*) ;; *) fail "wrong cache error: $err" ;; esac
32unset -f chmod
33/bin/chmod 755 "$cache"
34
35# A verified, executable cache can be owned by another user; do not try to chmod it again.
36chmod() { fail "chmod called for an already executable cache"; }
37download_verified "file://$TMP/unavailable" "$cache" "$expected" true || fail "executable cache was not reused"
38unset -f chmod
39
40# The type2 runtime is read as data; a valid 0644 preseed must remain usable as-is.
41runtime="$TMP/runtime"
42cp "$source_asset" "$runtime"
43/bin/chmod 644 "$runtime"
44chmod() { fail "chmod called for a readable runtime cache"; }
45download_verified "file://$TMP/unavailable" "$runtime" "$expected" || fail "readable runtime was not reused"
46unset -f chmod
47[[ ! -x "$runtime" ]] || fail "runtime was needlessly made executable"
48
49# A fresh runtime download is verified, readable data rather than an executable program.
50fresh_runtime="$TMP/fresh-runtime"
51download_verified "file://$source_asset" "$fresh_runtime" "$expected" || fail "fresh runtime download failed"
52cmp -s "$source_asset" "$fresh_runtime" || fail "fresh runtime differs from verified asset"
53[[ -r "$fresh_runtime" ]] || fail "fresh runtime is not readable"
54[[ ! -x "$fresh_runtime" ]] || fail "fresh runtime was made executable"
55mode="$(stat -c %a "$fresh_runtime" 2>/dev/null || stat -f %Lp "$fresh_runtime")"
56[[ "$mode" = 644 ]] || fail "fresh runtime mode is $mode, expected 644"
57
58# A corrupt cache is replaced only by bytes with the pinned digest.
59printf 'corrupt' >"$cache"
60download_verified "file://$source_asset" "$cache" "$expected" true || fail "corrupt cache was not replaced"
61cmp -s "$source_asset" "$cache" || fail "replacement differs from verified asset"
62[[ -x "$cache" ]] || fail "replacement is not executable"
63
64wrong_digest="$(printf '%064d' 0)"
65bad="$TMP/bad.AppImage"
66if download_verified "file://$source_asset" "$bad" "$wrong_digest" >/dev/null 2>&1; then fail "wrong digest accepted"; fi
67[[ ! -e "$bad" ]] || fail "wrong-digest download left a cache entry"
68
69verify_appimagetool_override "$cache" "$expected" 1.9.1 x86_64 || fail "valid override rejected"
70/bin/chmod 644 "$cache"
71if verify_appimagetool_override "$cache" "$expected" 1.9.1 x86_64 >/dev/null 2>&1; then fail "non-executable override accepted"; fi
72/bin/chmod 755 "$cache"
73if verify_appimagetool_override "$cache" "$wrong_digest" 1.9.1 x86_64 >/dev/null 2>&1; then fail "wrong-digest override accepted"; fi
74
75echo "verified AppImage tooling ok"
packaging/linux/verified-download.sh added +39 −0
@@ -0,0 +1,39 @@
1 #!/usr/bin/env bash
2 # Source after packaging/env.sh, which supplies sha256(). Keep the verified cache usable when
3 # an official asset was pre-seeded by a tool that created it without an execute bit.
4
5 download_verified() {
6 local url="$1" dest="$2" expected="$3" executable="${4:-false}" tmp
7 if [[ -f "$dest" ]] && [[ "$(sha256 "$dest")" = "$expected" ]]; then
8 if [[ "$executable" = true ]] && [[ ! -x "$dest" ]] && ! chmod 755 "$dest"; then
9 echo "error: verified asset is not executable and cannot be chmod'd: $dest" >&2
10 return 1
11 fi
12 return 0
13 fi
14 tmp="$(mktemp "$dest.XXXXXX")"
15 if ! curl -fsSL -o "$tmp" "$url"; then rm -f "$tmp"; return 1; fi
16 if [[ "$(sha256 "$tmp")" != "$expected" ]]; then
17 echo "error: SHA-256 mismatch for $url" >&2
18 rm -f "$tmp"
19 return 1
20 fi
21 if [[ "$executable" = true ]]; then
22 if ! chmod 755 "$tmp"; then rm -f "$tmp"; return 1; fi
23 else
24 if ! chmod 644 "$tmp"; then rm -f "$tmp"; return 1; fi
25 fi
26 if ! mv -f "$tmp" "$dest"; then rm -f "$tmp"; return 1; fi
27 }
28
29 verify_appimagetool_override() {
30 local tool="$1" expected="$2" version="$3" arch="$4"
31 if [[ ! -f "$tool" ]] || [[ "$(sha256 "$tool")" != "$expected" ]]; then
32 echo "error: APPIMAGETOOL must be the verified $version $arch release asset" >&2
33 return 1
34 fi
35 if [[ ! -x "$tool" ]]; then
36 echo "error: APPIMAGETOOL must be executable (chmod +x $tool)" >&2
37 return 1
38 fi
39 }
@@ -0,0 +1,39 @@
1#!/usr/bin/env bash
2# Source after packaging/env.sh, which supplies sha256(). Keep the verified cache usable when
3# an official asset was pre-seeded by a tool that created it without an execute bit.
4
5download_verified() {
6 local url="$1" dest="$2" expected="$3" executable="${4:-false}" tmp
7 if [[ -f "$dest" ]] && [[ "$(sha256 "$dest")" = "$expected" ]]; then
8 if [[ "$executable" = true ]] && [[ ! -x "$dest" ]] && ! chmod 755 "$dest"; then
9 echo "error: verified asset is not executable and cannot be chmod'd: $dest" >&2
10 return 1
11 fi
12 return 0
13 fi
14 tmp="$(mktemp "$dest.XXXXXX")"
15 if ! curl -fsSL -o "$tmp" "$url"; then rm -f "$tmp"; return 1; fi
16 if [[ "$(sha256 "$tmp")" != "$expected" ]]; then
17 echo "error: SHA-256 mismatch for $url" >&2
18 rm -f "$tmp"
19 return 1
20 fi
21 if [[ "$executable" = true ]]; then
22 if ! chmod 755 "$tmp"; then rm -f "$tmp"; return 1; fi
23 else
24 if ! chmod 644 "$tmp"; then rm -f "$tmp"; return 1; fi
25 fi
26 if ! mv -f "$tmp" "$dest"; then rm -f "$tmp"; return 1; fi
27}
28
29verify_appimagetool_override() {
30 local tool="$1" expected="$2" version="$3" arch="$4"
31 if [[ ! -f "$tool" ]] || [[ "$(sha256 "$tool")" != "$expected" ]]; then
32 echo "error: APPIMAGETOOL must be the verified $version $arch release asset" >&2
33 return 1
34 fi
35 if [[ ! -x "$tool" ]]; then
36 echo "error: APPIMAGETOOL must be executable (chmod +x $tool)" >&2
37 return 1
38 fi
39}