diff --git a/Aliases/msodbcsql17@17.0 b/Aliases/msodbcsql17@17.0 index 4a5e3b8..5caf199 120000 --- a/Aliases/msodbcsql17@17.0 +++ b/Aliases/msodbcsql17@17.0 @@ -1 +1 @@ -../Formula/msodbcsql17.rb \ No newline at end of file +../Formula/msodbcsql17@17.0.1.1.rb \ No newline at end of file diff --git a/Aliases/msodbcsql17@17.1 b/Aliases/msodbcsql17@17.1 new file mode 120000 index 0000000..bd54641 --- /dev/null +++ b/Aliases/msodbcsql17@17.1 @@ -0,0 +1 @@ +../Formula/msodbcsql17@17.1.0.1.rb \ No newline at end of file diff --git a/Aliases/msodbcsql17@17.2 b/Aliases/msodbcsql17@17.2 new file mode 120000 index 0000000..4a5e3b8 --- /dev/null +++ b/Aliases/msodbcsql17@17.2 @@ -0,0 +1 @@ +../Formula/msodbcsql17.rb \ No newline at end of file diff --git a/Aliases/mssql-tools@17.0 b/Aliases/mssql-tools@17.0 index 7c50107..03cb8ec 120000 --- a/Aliases/mssql-tools@17.0 +++ b/Aliases/mssql-tools@17.0 @@ -1 +1 @@ -../Formula/mssql-tools.rb \ No newline at end of file +../Formula/mssql-tools@17.0.1.1.rb \ No newline at end of file diff --git a/Aliases/mssql-tools@17.1 b/Aliases/mssql-tools@17.1 new file mode 120000 index 0000000..f1a4866 --- /dev/null +++ b/Aliases/mssql-tools@17.1 @@ -0,0 +1 @@ +../Formula/mssql-tools@17.1.0.1.rb \ No newline at end of file diff --git a/Aliases/mssql-tools@17.2 b/Aliases/mssql-tools@17.2 new file mode 120000 index 0000000..7c50107 --- /dev/null +++ b/Aliases/mssql-tools@17.2 @@ -0,0 +1 @@ +../Formula/mssql-tools.rb \ No newline at end of file diff --git a/Formula/msodbcsql17.rb b/Formula/msodbcsql17.rb index ffd04cf..ebb9893 100644 --- a/Formula/msodbcsql17.rb +++ b/Formula/msodbcsql17.rb @@ -1,10 +1,10 @@ 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.1.0.1.tar.gz" - version "17.1.0.1" - sha256 "9951b27ff2114df82f58a63095ac95da319359d525296ad25f6f020b0e3b69de" - + url "https://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.2.0.1.tar.gz" + version "17.2.0.1" + sha256 "62697b0e452cf26cd08475defed702a2c1ef303aa2fdcb049219a1c00cf11571" + option "without-registration", "Don't register the driver in odbcinst.ini" depends_on "unixodbc" @@ -13,7 +13,7 @@ class Msodbcsql17 < Formula 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/odbc170eula and found in" + puts "https://aka.ms/odbc172eula and found in" puts "/usr/local/share/doc/msodbcsql17/LICENSE.txt . By entering 'YES'," puts "you indicate that you accept the license terms." puts "" @@ -64,7 +64,7 @@ def caveats; <<~EOS 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 + EOS end test do diff --git a/Formula/msodbcsql17@17.0.1.1.rb b/Formula/msodbcsql17@17.0.1.1.rb index 9634490..263e063 100644 --- a/Formula/msodbcsql17@17.0.1.1.rb +++ b/Formula/msodbcsql17@17.0.1.1.rb @@ -66,7 +66,7 @@ def caveats; <<~EOS 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 + EOS end test do diff --git a/Formula/msodbcsql17@17.1.0.1.rb b/Formula/msodbcsql17@17.1.0.1.rb index be31337..731ecd5 100644 --- a/Formula/msodbcsql17@17.1.0.1.rb +++ b/Formula/msodbcsql17@17.1.0.1.rb @@ -66,7 +66,7 @@ def caveats; <<~EOS 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 + EOS end test do diff --git a/Formula/msodbcsql17@17.2.0.1.rb b/Formula/msodbcsql17@17.2.0.1.rb new file mode 100644 index 0000000..1cab3d9 --- /dev/null +++ b/Formula/msodbcsql17@17.2.0.1.rb @@ -0,0 +1,78 @@ +class Msodbcsql17AT17201 < 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.2.0.1.tar.gz" + version "17.2.0.1" + sha256 "62697b0e452cf26cd08475defed702a2c1ef303aa2fdcb049219a1c00cf11571" + + keg_only :versioned_formula + + option "without-registration", "Don't register the driver in odbcinst.ini" + + 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/odbc172eula 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 diff --git a/Formula/mssql-tools.rb b/Formula/mssql-tools.rb index f156548..cc1cd0e 100644 --- a/Formula/mssql-tools.rb +++ b/Formula/mssql-tools.rb @@ -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.1.0.1.tar.gz" - version "17.1.0.1" - sha256 "a6165c0289c043ac64fdb2861caf7981003957b5ef97369c8b3d3eaed41a3398" + url "https://sqlchoice.blob.core.windows.net/sqlchoice/17.2.0.1/macOS/mssql-tools-17.2.0.1.tar.gz" + version "17.2.0.1" + sha256 "4d0c30602d2207efde54ff77ebf17f71cd67735edba95f40be54a365db943819" depends_on "unixodbc" depends_on "openssl" diff --git a/Formula/mssql-tools@17.2.0.1.rb b/Formula/mssql-tools@17.2.0.1.rb new file mode 100644 index 0000000..d276e52 --- /dev/null +++ b/Formula/mssql-tools@17.2.0.1.rb @@ -0,0 +1,62 @@ +class MssqlToolsAT17201 < Formula + desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)" + homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx" + url "https://sqlchoice.blob.core.windows.net/sqlchoice/17.2.0.1/macOS/mssql-tools-17.2.0.1.tar.gz" + version "17.2.0.1" + sha256 "a6165c0289c043ac64fdb2861caf7981003957b5ef97369c8b3d3eaed41a3398" + + 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 == "YES" + if accept_eula == "NO" + 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