63 строки
2.6 KiB
Ruby
63 строки
2.6 KiB
Ruby
class MssqlTools18AT18211 < Formula
|
|
desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)"
|
|
homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx"
|
|
url Hardware::CPU.arch == :arm64 ? "https://download.microsoft.com/download/0/9/7/0976a30f-1710-4754-9445-bead058dd0c8/mssql-tools18-18.2.1.1-arm64.tar.gz" :
|
|
"https://download.microsoft.com/download/0/9/7/0976a30f-1710-4754-9445-bead058dd0c8/mssql-tools18-18.2.1.1-amd64.tar.gz"
|
|
version "18.2.1.1"
|
|
sha256 Hardware::CPU.arch == :arm64 ? "964113d5fab28bd13bdc658be9c8a6fcbcde04882a1f09c0e8f135ec70dc8f5c" :
|
|
"1a2917ae45366e028eb4f5ca7d2a2396cfc06d659ae7b1ddc1d0bbee45a0d5fb"
|
|
|
|
depends_on "msodbcsql18"
|
|
|
|
def check_eula_acceptance?
|
|
if ENV["HOMEBREW_ACCEPT_EULA"] != "y" && ENV["HOMEBREW_ACCEPT_EULA"] != "Y"
|
|
puts "The license terms for this product can be downloaded from"
|
|
puts "http://go.microsoft.com/fwlink/?LinkId=746949 and found in"
|
|
puts "#{prefix}/share/doc/mssql-tools18/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"
|
|
puts "HOMEBREW_ACCEPT_EULA to Y to indicate your acceptance of the license terms."
|
|
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-tools18/LICENSE.txt"
|
|
chmod 0644, "usr/share/doc/mssql-tools18/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
|