-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtsocks.rb
34 lines (26 loc) · 1.02 KB
/
tsocks.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'formula'
class Tsocks < Formula
# The original is http://tsocks.sourceforge.net/
# This GitHub repo is a maintained fork with OSX support
homepage 'http://github.com/pc/tsocks'
head 'https://github.com/pc/tsocks.git'
depends_on 'autoconf' => :build if MacOS::Xcode.version.to_f >= 4.3
def install
system "autoconf", "-v"
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking", "--with-conf=#{config_file}"
inreplace("tsocks") { |bin| bin.change_make_var! "LIBDIR", lib }
system "make"
system "make install"
etc.install "tsocks.conf.simple.example" => "tsocks.conf" unless config_file.exist?
end
def test
puts 'Your current public ip is:'
ohai `curl -sS ifconfig.me 2>&1`.chomp
puts "If your correctly configured #{config_file}, this should show the ip you have trough the proxy"
puts 'Your ip through the proxy is:'
ohai `tsocks curl -sS ifconfig.me 2>&1`.chomp
end
def config_file
etc / 'tsocks.conf'
end
end