mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-26 06:52:57 +08:00
119 lines
4.4 KiB
Ruby
119 lines
4.4 KiB
Ruby
# This file is generated by tasks/scripts/homebrew/update_formulae.py.
|
|
|
|
class OpenshellDev < Formula
|
|
desc "Development build of the safe private runtime for autonomous AI agents"
|
|
homepage "https://github.com/NVIDIA/OpenShell"
|
|
version "0.0.0-dev.24724742a89d.vm.20ffc7253b6e"
|
|
license "Apache-2.0"
|
|
|
|
on_macos do
|
|
depends_on arch: :arm64
|
|
|
|
on_arm do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/dev/openshell-aarch64-apple-darwin.tar.gz"
|
|
sha256 "5a01a8137ee6dc5d12a22d090747d3d760ad9bba174d958d876a1b0dcea72abd"
|
|
|
|
resource "openshell-gateway" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/dev/openshell-gateway-aarch64-apple-darwin.tar.gz"
|
|
sha256 "f32b2fc805f036f7ccdc21cdabfe9a190d4660b22d388d44bfb9e09fd9061be3"
|
|
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/dev/openshell-x86_64-unknown-linux-musl.tar.gz"
|
|
sha256 "3e3ab88059f2d63a088d0be9df92b9efeb2630ac6e0cc6a0bcf2bddaa9a338c2"
|
|
|
|
resource "openshell-gateway" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/dev/openshell-gateway-x86_64-unknown-linux-gnu.tar.gz"
|
|
sha256 "1afb277bd8ccd5dedfa2f8992550e65fd717ae417b39479a89d4874a1e5ed2be"
|
|
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/dev/openshell-aarch64-unknown-linux-musl.tar.gz"
|
|
sha256 "9959ed0e0552ee91e36aa6da8a7b18a42832d61475a0a87f4c5da8f46ebdb990"
|
|
|
|
resource "openshell-gateway" do
|
|
url "https://github.com/NVIDIA/OpenShell/releases/download/dev/openshell-gateway-aarch64-unknown-linux-gnu.tar.gz"
|
|
sha256 "00f972ff27e5ba0e1a78337dcabf84c4d21a77d9d865880b76c63f13279ed4c6"
|
|
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", 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
|