This commit is contained in:
v-chojas 2019-08-01 14:30:12 -07:00
Родитель c6004e8c67
Коммит 0897bc3099
6 изменённых файлов: 148 добавлений и 6 удалений

1
Aliases/msodbcsql17@17.4 Normal file
Просмотреть файл

@ -0,0 +1 @@
../Formula/msodbcsql17.rb

1
Aliases/mssql-tools@17.4 Normal file
Просмотреть файл

@ -0,0 +1 @@
../Formula/mssql-tools.rb

Просмотреть файл

@ -1,9 +1,9 @@
class Msodbcsql17 < Formula
desc "ODBC Driver for Microsoft(R) SQL Server(R)"
homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx"
url "https://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.3.1.1.tar.gz"
version "17.3.1.1"
sha256 "a34ff2c4842b7cacb6b246d55955563f9c27b7bcef28fa3e422e50a60b4c0c37"
url "https://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.4.1.1.tar.gz"
version "17.4.1.1"
sha256 "0bfa5c3d2599e6a284add3d1d49b713e1fe2637433403135a7e931518201fbb5"
option "without-registration", "Don't register the driver in odbcinst.ini"

Просмотреть файл

@ -0,0 +1,78 @@
class Msodbcsql17AT17411 < Formula
desc "ODBC Driver for Microsoft(R) SQL Server(R)"
homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx"
url "https://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.4.1.1.tar.gz"
version "17.4.1.1"
sha256 "0bfa5c3d2599e6a284add3d1d49b713e1fe2637433403135a7e931518201fbb5"
option "without-registration", "Don't register the driver in odbcinst.ini"
keg_only :versioned_formula
depends_on "unixodbc"
depends_on "openssl"
def check_eula_acceptance?
if ENV["ACCEPT_EULA"] != "y" && ENV["ACCEPT_EULA"] != "Y"
puts "The license terms for this product can be downloaded from"
puts "https://aka.ms/odbc17eula and found in"
puts "/usr/local/share/doc/msodbcsql17/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
if accept_eula.casecmp("YES").zero?
break
elsif 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 "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, "lib/libmsodbcsql.17.dylib"
chmod 0444, "share/msodbcsql17/resources/en_US/msodbcsqlr17.rll"
chmod 0644, "include/msodbcsql17/msodbcsql.h"
chmod 0644, "odbcinst.ini"
chmod 0644, "share/doc/msodbcsql17/LICENSE.txt"
chmod 0644, "share/doc/msodbcsql17/RELEASE_NOTES"
cp_r ".", prefix.to_s
if build.with? "registration"
system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 17 for SQL Server\""
system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini"
end
end
def caveats; <<~EOS
If you installed this formula with the registration option (default), you'll
need to manually remove [ODBC Driver 17 for SQL Server] section from
odbcinst.ini after the formula is uninstalled. This can be done by executing
the following command:
odbcinst -u -d -n "ODBC Driver 17 for SQL Server"
EOS
end
test do
if build.with? "registration"
out = shell_output("#{Formula["unixodbc"].opt_bin}/odbcinst -q -d")
assert_match "ODBC Driver 17 for SQL Server", out
end
end
end

Просмотреть файл

@ -1,9 +1,9 @@
class MssqlTools < Formula
desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)"
homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx"
url "https://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.3.1.1.tar.gz"
version "17.3.1.1"
sha256 "b0da6bc6f81d58b33e06d03873e9de44f847f159bf90134197d9ef8af70b3ddb"
url "https://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.4.1.1.tar.gz"
version "17.4.1.1"
sha256 "1d9b7b3c0aa601e395cfb66d1cd97e2c9c8acfd03cf407b4d81acbff9f7e3931"
depends_on "unixodbc"
depends_on "openssl"

Просмотреть файл

@ -0,0 +1,62 @@
class MssqlToolsAT17411 < Formula
desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)"
homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx"
url "https://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.4.1.1.tar.gz"
version "17.4.1.1"
sha256 "1d9b7b3c0aa601e395cfb66d1cd97e2c9c8acfd03cf407b4d81acbff9f7e3931"
depends_on "unixodbc"
depends_on "openssl"
depends_on "msodbcsql17"
def check_eula_acceptance?
if ENV["ACCEPT_EULA"] != "y" && ENV["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 "/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"
puts "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-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