GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tree/install.sh at main · kyle-meng/tree

Expand file tree

/

install.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
53 lines (46 loc) · 1.18 KB
/

install.sh

Copy path

File metadata and controls

53 lines (46 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
OS="$(uname -s | tr 'A-Z' 'a-z')"
ARCH="$(uname -m)"
VERSION="v0.2.1"
BASE_URL="https://github.com/kyle-meng/tree/releases/download/$VERSION"
case "$OS" in
linux)
if [ "$ARCH" = "x86_64" ]; then
BINARY="tree-x86_64-unknown-linux-musl"
elif [ "$ARCH" = "aarch64" ]; then
BINARY="tree-aarch64-unknown-linux-musl"
fi
;;
darwin)
if [ "$ARCH" = "arm64" ]; then
BINARY="tree-aarch64-apple-darwin"
fi
;;
msys*|mingw*|cygwin*)
BINARY="tree-x86_64-pc-windows-gnu.exe"
;;
esac
if [ -z "$BINARY" ]; then
echo "Unsupported OS or Architecture: $OS / $ARCH"
exit 1
fi
INSTALL_DIR="/usr/local/bin"
# 如果 /usr/local/bin 不存在,则使用 /usr/bin
if [ ! -d "$INSTALL_DIR" ]; then
INSTALL_DIR="/usr/bin"
fi
echo "Downloading $BINARY..."
curl -L "$BASE_URL/$BINARY" -o tree
chmod +x tree
if [ "$(id -u)" -eq 0 ]; then
mv tree "$INSTALL_DIR/"
else
if command -v sudo >/dev/null 2>&1; then
sudo mv tree "$INSTALL_DIR/"
else
echo "Error: Need root privileges to install to $INSTALL_DIR. Please run as root or install 'sudo'."
exit 1
fi
fi
echo "Installation complete! Binary installed to $INSTALL_DIR/tree"
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.