mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-26 06:52:57 +08:00
118 lines
4.3 KiB
Ruby
118 lines
4.3 KiB
Ruby
# This file is generated by tasks/scripts/homebrew/update_formulae.py.
|
|
|
|
class Openshell < Formula
|
|
desc "Safe private runtime for autonomous AI agents"
|
|
homepage "https://github.com/NVIDIA/OpenShell"
|
|
license "Apache-2.0"
|
|
|
|
on_macos do
|
|
depends_on arch: :arm64
|
|
|
|
on_arm do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/v0.0.36/openshell-aarch64-apple-darwin.tar.gz"
|
|
sha256 "4d18ab9b966fcd68cdfc08c1189856ff9fff3734222f35fed038ddca9cd291c3"
|
|
|
|
resource "openshell-gateway" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/v0.0.36/openshell-gateway-aarch64-apple-darwin.tar.gz"
|
|
sha256 "34871f5415b3469c4490b728f2a1853c62d58279724ef8f9fe266f2433dd6ae6"
|
|
end
|
|
|
|
resource "openshell-driver-vm" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/vm-dev/openshell-driver-vm-aarch64-apple-darwin.tar.gz"
|
|
sha256 "29cea5657875848c2f8242388ca050d6a94bf0229435ea62f960154d392fade1"
|
|
end
|
|
end
|
|
end
|
|
|
|
on_linux do
|
|
on_intel do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/v0.0.36/openshell-x86_64-unknown-linux-musl.tar.gz"
|
|
sha256 "cd309b2b750b83b6d4699697071d647109a3212645d0c69de89164b650c6ec00"
|
|
|
|
resource "openshell-gateway" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/v0.0.36/openshell-gateway-x86_64-unknown-linux-gnu.tar.gz"
|
|
sha256 "8a4b12dd5d66fcb116e4eb562541b9dbf2825ad03b5cb681413de2e5b563e9bb"
|
|
end
|
|
|
|
resource "openshell-driver-vm" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/vm-dev/openshell-driver-vm-x86_64-unknown-linux-gnu.tar.gz"
|
|
sha256 "8d02f4ec0c7517f62119cd92c764c8b3f04647b8a8bd4b1fae2a23f3581cd488"
|
|
end
|
|
end
|
|
|
|
on_arm do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/v0.0.36/openshell-aarch64-unknown-linux-musl.tar.gz"
|
|
sha256 "6fae1119b5cf4e718c96ee5874ada6ab5e35c016aba6e1e0adb5d93e6ab63bc0"
|
|
|
|
resource "openshell-gateway" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/v0.0.36/openshell-gateway-aarch64-unknown-linux-gnu.tar.gz"
|
|
sha256 "62531994c3d966f0e985f45ceb06dd1c8c8a6b068e2779cadfcc1e20d7cac152"
|
|
end
|
|
|
|
resource "openshell-driver-vm" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/vm-dev/openshell-driver-vm-aarch64-unknown-linux-gnu.tar.gz"
|
|
sha256 "0e6d16d642a65b57c81be7e83b07a06725dd3f4edd1762f67ac2d5248b550652"
|
|
end
|
|
end
|
|
end
|
|
|
|
conflicts_with "openshell-dev", because: "both install OpenShell command names"
|
|
|
|
def install
|
|
bin.install "openshell"
|
|
|
|
resource("openshell-gateway").stage do
|
|
libexec.install "openshell-gateway"
|
|
end
|
|
|
|
driver_dir = libexec/"openshell"
|
|
driver_dir.mkpath
|
|
resource("openshell-driver-vm").stage do
|
|
driver_dir.install "openshell-driver-vm"
|
|
end
|
|
|
|
if OS.mac?
|
|
entitlements = buildpath/"openshell-driver-vm-entitlements.plist"
|
|
entitlements.write <<~XML
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>com.apple.security.hypervisor</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
XML
|
|
system "codesign", "--entitlements", entitlements, "--force", "-s", "-", driver_dir/"openshell-driver-vm"
|
|
end
|
|
|
|
gateway_wrapper = bin/"openshell-gateway"
|
|
gateway_wrapper.write <<~SH
|
|
#!/bin/sh
|
|
export OPENSHELL_DRIVER_DIR="#{opt_libexec}/openshell"
|
|
exec "#{opt_libexec}/openshell-gateway" "$@"
|
|
SH
|
|
chmod 0555, gateway_wrapper
|
|
|
|
ln_s "../libexec/openshell/openshell-driver-vm", bin/"openshell-driver-vm"
|
|
end
|
|
|
|
test do
|
|
assert_match(/^openshell \S+/, shell_output("#{bin}/openshell --version"))
|
|
assert_match(/^openshell-gateway \S+/, shell_output("#{bin}/openshell-gateway --version"))
|
|
assert_match(/^openshell-driver-vm \S+/, shell_output("#{bin}/openshell-driver-vm --version"))
|
|
|
|
driver = libexec/"openshell/openshell-driver-vm"
|
|
assert_path_exists driver
|
|
assert_match(
|
|
"OPENSHELL_DRIVER_DIR=\"#{opt_libexec}/openshell\"",
|
|
(bin/"openshell-gateway").read,
|
|
)
|
|
|
|
if OS.mac?
|
|
entitlements = shell_output("codesign -d --entitlements :- #{driver} 2>&1")
|
|
assert_match "com.apple.security.hypervisor", entitlements
|
|
end
|
|
end
|
|
end
|