2020-02-05 18:52:07 +03:00
|
|
|
class MssqlToolsAT17512 < Formula
|
2020-01-31 21:58:28 +03:00
|
|
|
desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)"
|
|
|
|
homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx"
|
2020-02-05 18:52:07 +03:00
|
|
|
url "https://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.5.1.2.tar.gz"
|
|
|
|
version "17.5.1.2"
|
|
|
|
sha256 "0bb947f4eae4cf103bc716b713e4a7eddba7fe28baad1acc241349ba11fc434e"
|
2020-01-31 21:58:28 +03:00
|
|
|
|
|
|
|
depends_on "unixodbc"
|
|
|
|
depends_on "openssl"
|
|
|
|
depends_on "msodbcsql17"
|
|
|
|
|
|
|
|
def check_eula_acceptance?
|
2022-09-21 01:37:12 +03:00
|
|
|
if ENV["HOMEBREW_ACCEPT_EULA"] != "y" && ENV["HOMEBREW_ACCEPT_EULA"] != "Y"
|
2020-01-31 21:58:28 +03:00
|
|
|
puts "The license terms for this product can be downloaded from"
|
|
|
|
puts "http://go.microsoft.com/fwlink/?LinkId=746949 and found in"
|
|
|
|
puts "/usr/local/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',"
|
|
|
|
puts "you indicate that you accept the license terms."
|
|
|
|
puts ""
|
|
|
|
loop do
|
|
|
|
puts "Do you accept the license terms? (Enter YES or NO)"
|
|
|
|
accept_eula = STDIN.gets.chomp
|
|
|
|
if accept_eula
|
|
|
|
break if accept_eula.casecmp("YES").zero?
|
|
|
|
if accept_eula.casecmp("NO").zero?
|
|
|
|
puts "Installation terminated: License terms not accepted."
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
puts "Please enter YES or NO"
|
|
|
|
end
|
|
|
|
else
|
|
|
|
puts "Installation terminated: Could not prompt for license acceptance."
|
|
|
|
puts "If you are performing an unattended installation, you may set"
|
2022-09-21 01:37:12 +03:00
|
|
|
puts "HOMEBREW_ACCEPT_EULA to Y to indicate your acceptance of the license terms."
|
2020-01-31 21:58:28 +03:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
return false unless check_eula_acceptance?
|
|
|
|
|
|
|
|
chmod 0444, "bin/sqlcmd"
|
|
|
|
chmod 0444, "bin/bcp"
|
|
|
|
chmod 0444, "share/resources/en_US/BatchParserGrammar.dfa"
|
|
|
|
chmod 0444, "share/resources/en_US/BatchParserGrammar.llr"
|
|
|
|
chmod 0444, "share/resources/en_US/bcp.rll"
|
|
|
|
chmod 0444, "share/resources/en_US/SQLCMD.rll"
|
|
|
|
chmod 0644, "usr/share/doc/mssql-tools/LICENSE.txt"
|
|
|
|
chmod 0644, "usr/share/doc/mssql-tools/THIRDPARTYNOTICES.txt"
|
|
|
|
|
|
|
|
cp_r ".", prefix.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
out = shell_output("#{bin}/sqlcmd -?")
|
|
|
|
assert_match "Microsoft (R) SQL Server Command Line Tool", out
|
|
|
|
out = shell_output("#{bin}/bcp -v")
|
|
|
|
assert_match "BCP - Bulk Copy Program for Microsoft SQL Server", out
|
|
|
|
end
|
|
|
|
end
|