From 1eee971fbda703551cd42e475dd4fd71d500ee1b Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 19 Mar 2017 20:34:20 +0200 Subject: [PATCH] sshconfigfs: import from homebrew/fuse. --- Formula/sshconfigfs.rb | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Formula/sshconfigfs.rb diff --git a/Formula/sshconfigfs.rb b/Formula/sshconfigfs.rb new file mode 100644 index 0000000000..97ed642fc6 --- /dev/null +++ b/Formula/sshconfigfs.rb @@ -0,0 +1,60 @@ +class Sshconfigfs < Formula + desc "FUSE filesystem to dynamically build SSH config" + homepage "https://github.com/markhellewell/sshconfigfs" + url "https://github.com/markhellewell/sshconfigfs/archive/0.3.tar.gz" + sha256 "b52612b2211ca06642cee6a1abef41a53f0361ed16908372329fa464caedb74a" + head "https://github.com/markhellewell/sshconfigfs.git" + + depends_on :python if MacOS.version <= :snow_leopard + depends_on :osxfuse + + resource "fusepy" do + url "https://github.com/terencehonles/fusepy/archive/v2.0.2.tar.gz" + sha256 "31fe3f8731d33200fea2f97ab64a1b8e68dae0b48c5c1bd9e7485a9905636bc6" + end + + def install + ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages" + + resource("fusepy").stage do + system "python", *Language::Python.setup_install_args(libexec/"vendor") + end + + bin.install "sshconfigfs.py" => "sshconfigfs" + bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) + end + + plist_options :manual => "sshconfigfs" + + def plist; <<-EOS.undent + + + + + Label + #{plist_name} + ProgramArguments + + #{opt_bin}/sshconfigfs + + RunAtLoad + + KeepAlive + + + + EOS + end + + test do + # We start `sshconfigfs` in the background and kill it after a + # single second. This should give us enough time to catch the + # "INFO starting" message. Actually `sshconfigfs` will die by + # itself just after printing the starting message because OSXFUSE + # cannot run inside the test sandbox (`deny + # forbidden-exec-sugid`). + (testpath/".ssh/config.d").mkpath + output = pipe_output("(#{bin}/sshconfigfs & PID=$! && sleep 1 ; kill $PID) 2>&1") + assert_match "INFO starting", output + end +end