-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·61 lines (50 loc) · 1.84 KB
/
install.sh
File metadata and controls
executable file
·61 lines (50 loc) · 1.84 KB
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
54
55
56
57
58
59
60
61
#!/bin/sh
# Install `pad` — the nano-class terminal editor with Etherpad collab.
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/ether/pad/main/install.sh | sh
#
# POSIX sh — works under dash (Debian/Ubuntu default for /bin/sh), bash,
# zsh, busybox sh. We deliberately do NOT use `pipefail` since dash
# doesn't support it.
#
# Picks the fastest path that works on the system:
# 1. If `cargo` is on PATH, install via
# `cargo install --locked --git https://github.com/ether/pad pad`.
# 2. Else, ask the user to install Rust (we don't want to silently
# rustup-init their shell).
set -eu
bold() { printf '\033[1m%s\033[0m\n' "$*"; }
warn() { printf '\033[33m%s\033[0m\n' "$*"; }
err() { printf '\033[31m%s\033[0m\n' "$*" >&2; }
REPO="https://github.com/ether/pad"
if ! command -v cargo >/dev/null 2>&1; then
err "cargo not found."
cat >&2 <<EOF
pad is distributed via Cargo. Install Rust first, then re-run this
script:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Or with your system package manager (apt install rustup, brew install
rustup-init, etc.) and then run \`rustup default stable\`.
EOF
exit 1
fi
bold "Installing pad from $REPO …"
echo " (this calls 'cargo install --locked --git' — first run takes a"
echo " few minutes while Cargo pulls and compiles dependencies)"
echo
cargo install --locked --git "$REPO" pad
CARGO_BIN="${CARGO_HOME:-$HOME/.cargo}/bin"
if [ -x "$CARGO_BIN/pad" ]; then
echo
bold "Installed: $CARGO_BIN/pad"
if [ -n "${PATH:-}" ] && ! echo ":$PATH:" | grep -q ":$CARGO_BIN:"; then
warn "Note: $CARGO_BIN isn't on your PATH — add it to your shell rc."
else
echo "Try it:"
echo " pad ~/notes.md"
echo " pad https://pad-dev.etherpad.org/p/hello"
fi
else
warn "Build finished but pad isn't in $CARGO_BIN — check 'cargo install --root' output above."
fi