Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-27T23:29:29.768Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

install.sh

162 lines · 4.9 KB · shellscript
1#!/usr/bin/env sh
2set -eu
3
4# Downloads a tarball from https://zed.dev/releases and unpacks it
5# into ~/.local/. If you'd prefer to do this manually, instructions are at
6# https://zed.dev/docs/linux.
7
8main() {
9    platform="$(uname -s)"
10    arch="$(uname -m)"
11    channel="${ZED_CHANNEL:-stable}"
12    ZED_VERSION="${ZED_VERSION:-latest}"
13    # Use TMPDIR if available (for environments with non-standard temp directories)
14    if [ -n "${TMPDIR:-}" ] && [ -d "${TMPDIR}" ]; then
15        temp="$(mktemp -d "$TMPDIR/zed-XXXXXX")"
16    else
17        temp="$(mktemp -d "/tmp/zed-XXXXXX")"
18    fi
19
20    if [ "$platform" = "Darwin" ]; then
21        platform="macos"
22    elif [ "$platform" = "Linux" ]; then
23        platform="linux"
24    else
25        echo "Unsupported platform $platform"
26        exit 1
27    fi
28
29    case "$platform-$arch" in
30        macos-arm64* | linux-arm64* | linux-armhf | linux-aarch64)
31            arch="aarch64"
32            ;;
33        macos-x86* | linux-x86* | linux-i686*)
34            arch="x86_64"
35            ;;
36        *)
37            echo "Unsupported platform or architecture"
38            exit 1
39            ;;
40    esac
41
42    if command -v curl >/dev/null 2>&1; then
43        curl () {
44            command curl -fL "$@"
45        }
46    elif command -v wget >/dev/null 2>&1; then
47        curl () {
48            wget -O- "$@"
49        }
50    else
51        echo "Could not find 'curl' or 'wget' in your path"
52        exit 1
53    fi
54
55    "$platform" "$@"
56
57    if [ "$(command -v zed)" = "$HOME/.local/bin/zed" ]; then
58        echo "Zed has been installed. Run with 'zed'"
59    else
60        echo "To run Zed from your terminal, you must add ~/.local/bin to your PATH"
61        echo "Run:"
62
63        case "$SHELL" in
64            *zsh)
65                echo "   echo 'export PATH=\$HOME/.local/bin:\$PATH' >> ~/.zshrc"
66                echo "   source ~/.zshrc"
67                ;;
68            *fish)
69                echo "   fish_add_path -U $HOME/.local/bin"
70                ;;
71            *)
72                echo "   echo 'export PATH=\$HOME/.local/bin:\$PATH' >> ~/.bashrc"
73                echo "   source ~/.bashrc"
74                ;;
75        esac
76
77        echo "To run Zed now, '~/.local/bin/zed'"
78    fi
79}
80
81linux() {
82    if [ -n "${ZED_BUNDLE_PATH:-}" ]; then
83        cp "$ZED_BUNDLE_PATH" "$temp/zed-linux-$arch.tar.gz"
84    else
85        echo "Downloading Zed version: $ZED_VERSION"
86        curl "https://cloud.zed.dev/releases/$channel/$ZED_VERSION/download?asset=zed&arch=$arch&os=linux&source=install.sh" > "$temp/zed-linux-$arch.tar.gz"
87    fi
88
89    suffix=""
90    if [ "$channel" != "stable" ]; then
91        suffix="-$channel"
92    fi
93
94    appid=""
95    case "$channel" in
96      stable)
97        appid="dev.zed.Zed"
98        ;;
99      nightly)
100        appid="dev.zed.Zed-Nightly"
101        ;;
102      preview)
103        appid="dev.zed.Zed-Preview"
104        ;;
105      dev)
106        appid="dev.zed.Zed-Dev"
107        ;;
108      *)
109        echo "Unknown release channel: ${channel}. Using stable app ID."
110        appid="dev.zed.Zed"
111        ;;
112    esac
113
114    # Unpack
115    rm -rf "$HOME/.local/zed$suffix.app"
116    mkdir -p "$HOME/.local/zed$suffix.app"
117    tar -xzf "$temp/zed-linux-$arch.tar.gz" -C "$HOME/.local/"
118
119    # Setup ~/.local directories
120    mkdir -p "$HOME/.local/bin" "$HOME/.local/share/applications"
121
122    # Link the binary
123    if [ -f "$HOME/.local/zed$suffix.app/bin/zed" ]; then
124        ln -sf "$HOME/.local/zed$suffix.app/bin/zed" "$HOME/.local/bin/zed"
125    else
126        # support for versions before 0.139.x.
127        ln -sf "$HOME/.local/zed$suffix.app/bin/cli" "$HOME/.local/bin/zed"
128    fi
129
130    # Copy .desktop file
131    desktop_file_path="$HOME/.local/share/applications/${appid}.desktop"
132    src_dir="$HOME/.local/zed$suffix.app/share/applications"
133    if [ -f "$src_dir/${appid}.desktop" ]; then
134        cp "$src_dir/${appid}.desktop" "${desktop_file_path}"
135    else
136        # Fallback for older tarballs
137        cp "$src_dir/zed$suffix.desktop" "${desktop_file_path}"
138    fi
139    sed -i "s|Icon=zed|Icon=$HOME/.local/zed$suffix.app/share/icons/hicolor/512x512/apps/zed.png|g" "${desktop_file_path}"
140    sed -i "s|Exec=zed|Exec=$HOME/.local/zed$suffix.app/bin/zed|g" "${desktop_file_path}"
141}
142
143macos() {
144    echo "Downloading Zed version: $ZED_VERSION"
145    curl "https://cloud.zed.dev/releases/$channel/$ZED_VERSION/download?asset=zed&os=macos&arch=$arch&source=install.sh" > "$temp/Zed-$arch.dmg"
146    hdiutil attach -quiet "$temp/Zed-$arch.dmg" -mountpoint "$temp/mount"
147    app="$(cd "$temp/mount/"; echo *.app)"
148    echo "Installing $app"
149    if [ -d "/Applications/$app" ]; then
150        echo "Removing existing $app"
151        rm -rf "/Applications/$app"
152    fi
153    ditto "$temp/mount/$app" "/Applications/$app"
154    hdiutil detach -quiet "$temp/mount"
155
156    mkdir -p "$HOME/.local/bin"
157    # Link the binary
158    ln -sf "/Applications/$app/Contents/MacOS/cli" "$HOME/.local/bin/zed"
159}
160
161main "$@"
162
Served at tenant.openagents/omega Member data and write actions are omitted.