This commit is contained in:
v-chojas 2022-11-03 11:14:18 -07:00 коммит произвёл GitHub
Родитель f03c368c91
Коммит 842357c8a6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 84 добавлений и 5 удалений

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

@ -1,11 +1,11 @@
class Msodbcsql18 < Formula
desc "ODBC Driver for Microsoft(R) SQL Server(R)"
homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx"
url Hardware::CPU.arch == :arm64 ? "https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.1.1-arm64.tar.gz" :
"https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.1.1-amd64.tar.gz"
version "18.1.1.1"
sha256 Hardware::CPU.arch == :arm64 ? "bd48fb1d1985c0ef9d372714ce98474863ee92f4d5602b1159255f2532a2dd84" :
"cd482a9e15f56f436c9af62a52bea5f45641e465a9b26e3f7530fa60fd02c8ba"
url Hardware::CPU.arch == :arm64 ? "https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.2.1-arm64.tar.gz" :
"https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.2.1-amd64.tar.gz"
version "18.1.2.1"
sha256 Hardware::CPU.arch == :arm64 ? "97cfc9cb3e1922669acd8ade20471ce57eaa0e81edd98bf21afad2cd70edcd5d" :
"b81f3cf5abd4c339ea56e36564e1e40d02c13fbf62aa7091ba4f321d47aea910"
option "without-registration", "Don't register the driver in odbcinst.ini"

79
Formula/msodbcsql18@18.1.2.1.rb Executable file
Просмотреть файл

@ -0,0 +1,79 @@
class Msodbcsql18AT18121 < Formula
desc "ODBC Driver for Microsoft(R) SQL Server(R)"
homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx"
url Hardware::CPU.arch == :arm64 ? "https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.2.1-arm64.tar.gz" :
"https://download.microsoft.com/download/6/4/0/64006503-51e3-44f0-a6cd-a9b757d0d61b/msodbcsql18-18.1.2.1-amd64.tar.gz"
version "18.1.2.1"
sha256 Hardware::CPU.arch == :arm64 ? "97cfc9cb3e1922669acd8ade20471ce57eaa0e81edd98bf21afad2cd70edcd5d" :
"b81f3cf5abd4c339ea56e36564e1e40d02c13fbf62aa7091ba4f321d47aea910"
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["HOMEBREW_ACCEPT_EULA"] != "y" && ENV["HOMEBREW_ACCEPT_EULA"] != "Y"
puts "The license terms for this product can be downloaded from"
puts "https://aka.ms/odbc18eula and found in"
puts "#{prefix}/share/doc/msodbcsql18/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 "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, "lib/libmsodbcsql.18.dylib"
chmod 0444, "share/msodbcsql18/resources/en_US/msodbcsqlr18.rll"
chmod 0644, "include/msodbcsql18/msodbcsql.h"
chmod 0644, "odbcinst.ini"
chmod 0644, "share/doc/msodbcsql18/LICENSE.txt"
chmod 0644, "share/doc/msodbcsql18/RELEASE_NOTES"
cp_r ".", prefix.to_s
if build.with? "registration"
system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 18 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 18 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 18 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 18 for SQL Server", out
end
end
end