Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browserpass 2.0.8 (new formula) #21039

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 54 additions & 0 deletions Formula/browserpass.rb
@@ -0,0 +1,54 @@
class Browserpass < Formula
desc "Native component for Chrome & Firefox password management add-on"
homepage "https://github.com/dannyvankooten/browserpass"
url "https://github.com/dannyvankooten/browserpass/archive/2.0.8.tar.gz"
sha256 "1747fc24e51128811eb679b43ab23a8cce6ac566620112f0ca9fa129ace4a928"

depends_on "dep" => :build
depends_on "go" => :build
depends_on "node" => :build
depends_on "yarn" => :build

def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/dannyvankooten/browserpass").install buildpath.children
cd "src/github.com/dannyvankooten/browserpass" do
system "make", "deps"
system "make", "js"
system "make", "browserpass-darwinx64"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can combine all 3 goals in one system call, "make deps js browserpass-darwinx64"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't compile when I combine them. Go complains about not being able to find some packages (twofactor and go-zglob).

Copy link

@maximbaz maximbaz Nov 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, actually I forgot to tell you, you should download archive from a different link (click), that one already contains all the dependencies so that you don't need to do make deps and make js at all. Then you only need to do make browserpass-darwinx64. That will also allow you to remove dependencies on "dep", "yarn" and "node".

I made this custom tarball specifically for other package managers, to reduce dependencies and to simplify build instructions.

mkdir "out"
mkdir "out/bin"
mkdir "out/share"
cp "browserpass-darwinx64", "out/bin/browserpass"
cp "install.sh", "out/bin/browserpass-setup"
cp "firefox/host.json", "out/share/firefox-host.json"
cp "chrome/host.json", "out/share/chrome-host.json"
cp "chrome/policy.json", "out/share/chrome-policy.json"
dir = csh_quote(HOMEBREW_PREFIX)
inreplace "out/bin/browserpass-setup", /^(BIN_DIR=).*$/, "\\1\"#{dir}/bin\""
inreplace "out/bin/browserpass-setup", /^(JSON_DIR=).*$/, "\\1\"#{dir}/share/browserpass\""
bin.install Dir["out/bin/*"]
pkgshare.install Dir["out/share/*"]
ohai "#{Tty.magenta}** To complete installation of browserpass, do the following:#{Tty.reset}"
puts "(1) Install the browserpass-ce add-on in your browser."
puts " - Chrome: https://chrome.google.com/webstore/detail/browserpass-ce/naepdomgkenhinolocfifgehidddafch"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install.sh places the chrome-policy.json, which in turn forces Chrome to automatically download the browser extension. However I noticed that on linux this works only if you run install.sh as root.

No action needed, just wanted to let you know this, maybe check how install.sh behaves on Mac, if it automatically installs Chrome extension you can reduce the manual steps.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to happen in Chrome. Are there any docs about this behavior?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature is called ExtensionInstallForcelist, I think it is usually used by companies to enforce installation of a certain extension. When I have the chrome-policy.json stored in the following location on Linux, Chrome automatically installs the extension:

/etc/opt/chrome/policies/managed/com.dannyvankooten.browserpass.json

image

puts " - Firefox: https://addons.mozilla.org/en-US/firefox/addon/browserpass-ce/"
puts "(2) Run `browserpass-setup` to install browser-specific manifest files."
ohai "#{Tty.magenta}** The add-on will not work otherwise!#{Tty.reset}"
end
end

test do
mkdir "#{ENV["HOME"]}/.password-store"
json = { :action => "search", :domain => "test" }
msg = JSON.generate(json)
Open3.popen3("#{bin}/browserpass") do |stdin, stdout, _|
stdin.write([msg.bytesize].pack("L"))
stdin.write(msg)
stdin.close
len = stdout.read(4).unpack("L")[0]
result = JSON.parse(stdout.read(len))
assert_equal(result, [])
end
end
end