From 0242376a65238a8412bf86104a68b1719f32255a Mon Sep 17 00:00:00 2001 From: AB-UK Date: Fri, 13 Mar 2026 15:52:17 +0000 Subject: [PATCH] Added deb build --- .github/workflows/deb-publish.yml | 63 +++++++++++++++++++++++++++++++ furumi-mount-linux/Cargo.toml | 11 ++++++ furumi-mount-linux/src/main.rs | 9 ++++- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deb-publish.yml diff --git a/.github/workflows/deb-publish.yml b/.github/workflows/deb-publish.yml new file mode 100644 index 0000000..0e26a8e --- /dev/null +++ b/.github/workflows/deb-publish.yml @@ -0,0 +1,63 @@ +name: Build and Publish Deb Package + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build-deb: + runs-on: self-hosted + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Enable universe and install dependencies + run: | + sudo add-apt-repository universe -y + sudo apt-get update + sudo apt-get install -y fuse3 libfuse3-dev pkg-config protobuf-compiler cmake + + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Install cargo-deb + run: cargo install cargo-deb --locked + + - name: Extract version from tag + id: version + run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + + - name: Build deb package + run: | + cargo deb -p furumi-mount-linux \ + --deb-version ${{ steps.version.outputs.version }} + + - name: Locate deb file + id: deb + run: | + DEB=$(ls target/debian/furumi-mount-linux_*.deb | head -1) + echo "path=$DEB" >> "$GITHUB_OUTPUT" + echo "name=$(basename $DEB)" >> "$GITHUB_OUTPUT" + + - name: Publish to Gitea APT registry + run: | + curl --fail-with-body \ + -X PUT \ + -H "Authorization: token ${{ secrets.PKG_TOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --upload-file "${{ steps.deb.outputs.path }}" \ + "${{ secrets.PKG_REGISTRY_URL }}/api/packages/${{ secrets.PKG_OWNER }}/debian/pool/noble/main" diff --git a/furumi-mount-linux/Cargo.toml b/furumi-mount-linux/Cargo.toml index ddd5fd0..1524fd8 100644 --- a/furumi-mount-linux/Cargo.toml +++ b/furumi-mount-linux/Cargo.toml @@ -15,3 +15,14 @@ tracing-subscriber = { version = "0.3.22", features = ["env-filter"] } tokio = { version = "1.50.0", features = ["full"] } tokio-stream = "0.1.18" ctrlc = "3.5.2" + +[package.metadata.deb] +maintainer = "Furumi" +copyright = "Furumi contributors" +extended-description = "Furumi-ng: mount remote filesystem via encrypted gRPC + FUSE" +depends = "fuse3" +section = "utils" +priority = "optional" +assets = [ + { source = "target/release/furumi-mount-linux", dest = "usr/bin/furumi-mount-linux", mode = "755" }, +] diff --git a/furumi-mount-linux/src/main.rs b/furumi-mount-linux/src/main.rs index cfe4e12..d3c844c 100644 --- a/furumi-mount-linux/src/main.rs +++ b/furumi-mount-linux/src/main.rs @@ -57,7 +57,14 @@ fn main() -> Result<(), Box> { }; let client = rt.block_on(async { - FurumiClient::connect(&full_addr, &args.token).await + let c = FurumiClient::connect(&full_addr, &args.token).await?; + + // Ping the server to verify connection and authentication token + if let Err(e) = c.get_attr("/").await { + return Err(format!("Failed to authenticate or connect to server: {}", e).into()); + } + + Ok::<_, Box>(c) })?; let fuse_fs = fs::FurumiFuse::new(client, rt.handle().clone());