Something went wrong. Try again.
Homebrew tap for XR (VR/AR/MR) software.
Something went wrong. Try again.
2.4 kB · 91 lines
Shell
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192#!/usr/bin/bash# SPDX-License-Identifier: AGPL-3.0-only# Copyright (c) 2026 MatrixFurry <matrix@matrixfurry.com>
set -euo pipefail
TAP_NAME="matrixfurry.com/xr"TAP_URL="https://tangled.org/did:plc:tnpscg53k2nexylmouhv4b5e"
info() { printf '\e[0;34m[INFO]\e[0m %s\n' "$*"; }warn() { printf '\e[0;33m[WARNING]\e[0m %s\n' "$*"; }error() { printf '\e[0;31m[ERROR]\e[0m %s\n' "$*"; }fatal() { printf '\e[0;31m[FATAL]\e[0m %s\n' "$*"; exit 1; }success() { printf '\e[0;32m[SUCCESS]\e[0m %s\n' "$*"; }
check_cmd() { local cmd="$1"
if [[ -z "$cmd" ]]; then fatal "check_cmd requires a command to check (missing argument)" fi
command -v "$cmd" &>/dev/null}
brew_env() { eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc}
install_brew() { if ! check_cmd curl; then fatal "Curl is required to install Homebrew. Please install curl using your system package manager and try again." fi
info "Installing Homebrew" if ! /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; then fatal "Homebrew installation failed. See the output above for details." fi
info "Setting up homebrew environment" if ! brew_env; then fatal "Failed to set up Homebrew's environment. You may have to manually run the commands shown by the installer above." fi
if ! check_cmd brew; then fatal "Homebrew was installed but is not available on your PATH. You may need to restart your shell, or manually run the commands shown by the installer above." fi
success "Successfully installed Homebrew"}
add_tap() { info "Adding Linux VR Tap to Homebrew"
if ! brew tap $TAP_NAME $TAP_URL; then fatal "Failed to add Linux VR Tap. Try checking your internet connection first. See the output above for more details." fi
success "Successfully added Linux VR Tap"}
update_brew() { info "Updating Homebrew" if ! brew update; then warning "Homebrew update failed" fi}
main() { info "Setting up the Linux VR Homebrew Tap"
if check_cmd brew; then info "Homebrew is already installed" update_brew else info "Homebrew is not installed" install_brew fi
if brew tap | grep -qx "$TAP_NAME"; then info "The Homebrew Tap is already installed" update_brew else add_tap fi
success "Done!"}
main