From 2d8d3eb756bf3b2c0474668123bc641cf35ab375 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sat, 5 Mar 2022 17:55:12 -0500 Subject: [PATCH 1/5] boringtun 0.4.0 Signed-off-by: Rui Chen --- Formula/boringtun.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Formula/boringtun.rb b/Formula/boringtun.rb index 16561fe41d373..7dc533d6071e0 100644 --- a/Formula/boringtun.rb +++ b/Formula/boringtun.rb @@ -1,11 +1,16 @@ class Boringtun < Formula desc "Userspace WireGuard implementation in Rust" homepage "https://github.com/cloudflare/boringtun" - url "https://github.com/cloudflare/boringtun/archive/v0.3.0.tar.gz" - sha256 "1107b0170a33769db36876334261924edc71dfc1eb00f9b464c7d2ad6d5743d3" + url "https://static.crates.io/crates/boringtun/boringtun-0.4.0.crate" + sha256 "bcaf3e6d388237249ec234ec6890bfc68634043f9b048011de8d0fc0025c3698" license "BSD-3-Clause" head "https://github.com/cloudflare/boringtun.git", branch: "master" + livecheck do + url "https://crates.io/api/v1/crates/boringtun/versions" + regex(/"num":\s*"(\d+(?:\.\d+)+)"/i) + end + bottle do sha256 cellar: :any_skip_relocation, monterey: "97dc60eaf03ff668094d700af5ef656c7033e0fe6b6e7cacf287ebaddf8c5b46" sha256 cellar: :any_skip_relocation, big_sur: "0de06cdb03839450dbe101b3f1042820f82aee7eda323039be0f48a0b2baf3e9" @@ -18,6 +23,7 @@ class Boringtun < Formula depends_on "rust" => :build def install + system "tar", "--strip-components", "1", "-xzvf", "boringtun-#{version}.crate" system "cargo", "install", *std_cargo_args end From 96b6d77778267aff744983ef399ff2c1c3cde1a5 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sat, 5 Mar 2022 18:03:15 -0500 Subject: [PATCH 2/5] boringtun: update test and caveats Signed-off-by: Rui Chen --- Formula/boringtun.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Formula/boringtun.rb b/Formula/boringtun.rb index 7dc533d6071e0..5cb3e05204407 100644 --- a/Formula/boringtun.rb +++ b/Formula/boringtun.rb @@ -27,12 +27,20 @@ def install system "cargo", "install", *std_cargo_args end + def caveats + <<~EOS + boringtun requires root privileges so you will need to run `sudo boringtun utun`. + You should be certain that you trust any software you grant root privileges. + EOS + end + test do system "#{bin}/boringtun", "--help" assert_match "boringtun " + version.to_s, shell_output("#{bin}/boringtun -V").chomp - shell_output("#{bin}/boringtun utun -v --log #{testpath}/boringtun.log", 1) + + output = shell_output("#{bin}/boringtun utun -v --log #{testpath}/boringtun.log 2>&1", 1) assert_predicate testpath/"boringtun.log", :exist? - boringtun_log = File.read(testpath/"boringtun.log") - assert_match "Success, daemonized", boringtun_log.split("/n").first + # requires `sudo` to start + assert_match "BoringTun failed to start", output end end From b78d8b4d45217440612c5e274208a9ef77a979a9 Mon Sep 17 00:00:00 2001 From: rui Date: Mon, 7 Mar 2022 11:03:05 -0500 Subject: [PATCH 3/5] boringtun: improve test Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> --- Formula/boringtun.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/boringtun.rb b/Formula/boringtun.rb index 5cb3e05204407..0481e526c6e91 100644 --- a/Formula/boringtun.rb +++ b/Formula/boringtun.rb @@ -36,7 +36,7 @@ def caveats test do system "#{bin}/boringtun", "--help" - assert_match "boringtun " + version.to_s, shell_output("#{bin}/boringtun -V").chomp + assert_match "boringtun #{version}", shell_output("#{bin}/boringtun -V").chomp output = shell_output("#{bin}/boringtun utun -v --log #{testpath}/boringtun.log 2>&1", 1) assert_predicate testpath/"boringtun.log", :exist? From b402e05abbaa169867608fd5e89500cab29efc0b Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Mon, 7 Mar 2022 16:19:46 -0500 Subject: [PATCH 4/5] switch back to source tarball as upstream just made the release Signed-off-by: Rui Chen --- Formula/boringtun.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Formula/boringtun.rb b/Formula/boringtun.rb index 0481e526c6e91..d4c69a34c64e0 100644 --- a/Formula/boringtun.rb +++ b/Formula/boringtun.rb @@ -1,8 +1,8 @@ class Boringtun < Formula desc "Userspace WireGuard implementation in Rust" homepage "https://github.com/cloudflare/boringtun" - url "https://static.crates.io/crates/boringtun/boringtun-0.4.0.crate" - sha256 "bcaf3e6d388237249ec234ec6890bfc68634043f9b048011de8d0fc0025c3698" + url "https://github.com/cloudflare/boringtun/archive/v0.4.0.tar.gz" + sha256 "23a02ae0c01d194ce428c465de46538f683c696fa23a82cfc42d07d40e668e74" license "BSD-3-Clause" head "https://github.com/cloudflare/boringtun.git", branch: "master" @@ -23,7 +23,6 @@ class Boringtun < Formula depends_on "rust" => :build def install - system "tar", "--strip-components", "1", "-xzvf", "boringtun-#{version}.crate" system "cargo", "install", *std_cargo_args end From c0d03f4286ec1b050b41f222b7503726e2687929 Mon Sep 17 00:00:00 2001 From: rui Date: Mon, 7 Mar 2022 16:21:02 -0500 Subject: [PATCH 5/5] revert livecheck change --- Formula/boringtun.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Formula/boringtun.rb b/Formula/boringtun.rb index d4c69a34c64e0..34e7d2c9b7d9c 100644 --- a/Formula/boringtun.rb +++ b/Formula/boringtun.rb @@ -6,11 +6,6 @@ class Boringtun < Formula license "BSD-3-Clause" head "https://github.com/cloudflare/boringtun.git", branch: "master" - livecheck do - url "https://crates.io/api/v1/crates/boringtun/versions" - regex(/"num":\s*"(\d+(?:\.\d+)+)"/i) - end - bottle do sha256 cellar: :any_skip_relocation, monterey: "97dc60eaf03ff668094d700af5ef656c7033e0fe6b6e7cacf287ebaddf8c5b46" sha256 cellar: :any_skip_relocation, big_sur: "0de06cdb03839450dbe101b3f1042820f82aee7eda323039be0f48a0b2baf3e9"