diff options
| -rw-r--r-- | .tangled/workflows/build.yml | 26 | ||||
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | build.zig | 3 | ||||
| -rw-r--r-- | build.zig.zon | 2 | ||||
| -rw-r--r-- | src/main.zig | 8 |
5 files changed, 43 insertions, 3 deletions
diff --git a/.tangled/workflows/build.yml b/.tangled/workflows/build.yml new file mode 100644 index 0000000..1c1ccf8 --- /dev/null +++ b/.tangled/workflows/build.yml @@ -0,0 +1,26 @@ +when: + - event: ["push", "pull_request", "manual"] + branch: ["dev", "master"] + tag: ["v*"] + +engine: "nixery" + +dependencies: + nixpkgs: + - rclone + git+https://github.com/mitchellh/zig-overlay: + - master + +steps: + - name: "Build" + command: "zig build -Doptimize=ReleaseSmall -Dcpu=baseline" + - name: "Publish" + command: | + rclone sync ./zig-out \ + --webdav-url "$RELEASE_NEXTCLOUD_HOST/remote.php/dav/files/$RELEASE_NEXTCLOUD_USER/" \ + --webdav-user "$RELEASE_NEXTCLOUD_USER" \ + --webdav-pass "$RELEASE_NEXTCLOUD_PASS" \ + --webdav-vendor nextcloud \ + :webdav:"zaprus/zaprus-$TANGLED_REF_NAME" \ + -q + @@ -3,4 +3,9 @@ This is an implementation of the [Saprus protocol](https://gitlab.com/c2-games/red-team/saprus) in Zig. It is useful for developing clients either in Zig, or in any other language using the C bindings. -Binary releases can be downloaded [here](https://cloud.zambito.xyz/s/cNaLeDz38W5ZcZs). +Binary releases can be downloaded [here](https://cloud.zambito.xyz/s/7jJPTm68Zp3mN8F). + +The code for this can be found here: + +- https://tangled.org/zambyte.robbyzambito.me/zaprus +- https://git.robbyzambito.me/zaprus @@ -7,6 +7,9 @@ const std = @import("std"); // build runner to parallelize the build automatically (and the cache system to // know when a step doesn't need to be re-run). pub fn build(b: *std.Build) void { + // Ensure the license is included in the output directory + b.installFile("LICENSE.md", "LICENSE.md"); + b.installFile("README.md", "README.md"); // Standard target options allow the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options diff --git a/build.zig.zon b/build.zig.zon index 40886bf..e250888 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -10,7 +10,7 @@ // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. - .version = "0.2.0", + .version = "0.2.1", // Together with name, this represents a globally unique package // identifier. This field is generated by the Zig toolchain when the diff --git a/src/main.zig b/src/main.zig index 10dca33..c5e7b0a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -146,7 +146,13 @@ pub fn main(init: std.process.Init) !void { if (flags.connect != null) { reconnect: while (true) { - client = try .init(); + client = SaprusClient.init() catch |err| switch (err) { + error.NoInterfaceFound => { + try init.io.sleep(.fromMilliseconds(100), .boot); + continue :reconnect; + }, + else => |e| return e, + }; defer client.deinit(); log.debug("Starting connection", .{}); |
