-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·75 lines (64 loc) · 2.64 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·75 lines (64 loc) · 2.64 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
# =============================================================================
# Meridian — Compatibility shim
#
# This script installs the `meridian` CLI and guides users to the new interface.
# The old `curl setup.sh | bash` pattern is replaced by:
#
# curl -sSf https://getmeridian.org/install.sh | bash
# meridian setup 1.2.3.4
#
# For backward compatibility, this script still works:
# curl -sS https://getmeridian.org/setup.sh | bash
# =============================================================================
set -euo pipefail
R='\033[0m' B='\033[1m' D='\033[2m'
G='\033[32m' C='\033[36m' Y='\033[33m'
printf "\n"
printf " ${B}Meridian${R}\n"
printf "\n"
printf " ${Y}!${R} setup.sh has been replaced by the ${B}meridian${R} CLI.\n"
printf "\n"
# Check if meridian is already installed (and not the old bash version)
if command -v meridian &>/dev/null; then
MERIDIAN_PATH=$(command -v meridian)
if ! grep -q 'MERIDIAN_VERSION=' "$MERIDIAN_PATH" 2>/dev/null; then
# It's the new Python CLI
printf " ${G}✓${R} meridian CLI is already installed.\n\n"
printf " Usage:\n"
printf " ${C}meridian setup${R} ${D}# interactive wizard${R}\n"
printf " ${C}meridian setup 1.2.3.4${R} ${D}# deploy to server${R}\n"
printf " ${C}meridian client add alice${R} ${D}# share access${R}\n"
printf " ${C}meridian help${R} ${D}# all commands${R}\n"
printf "\n"
# If arguments were passed, forward them to meridian
if [[ $# -gt 0 ]]; then
printf " ${C}→${R} Running: meridian setup %s\n\n" "$*"
exec meridian setup "$@"
fi
exit 0
fi
fi
# Install meridian CLI (handles old bash CLI migration automatically)
printf " Installing meridian CLI...\n\n"
INSTALL_URL="https://getmeridian.org/install.sh"
FALLBACK_URL="https://raw.githubusercontent.com/uburuntu/meridian/main/install.sh"
INSTALLER=""
if command -v curl &>/dev/null; then
INSTALLER=$(curl -sSf "$INSTALL_URL" </dev/null 2>/dev/null) || \
INSTALLER=$(curl -sSf "$FALLBACK_URL" </dev/null 2>/dev/null) || true
elif command -v wget &>/dev/null; then
INSTALLER=$(wget -qO- "$INSTALL_URL" </dev/null 2>/dev/null) || \
INSTALLER=$(wget -qO- "$FALLBACK_URL" </dev/null 2>/dev/null) || true
fi
if [[ -z "$INSTALLER" ]]; then
printf " Failed to download installer.\n"
printf " Manual install: https://github.com/uburuntu/meridian#install\n\n"
exit 1
fi
bash -c "$INSTALLER" </dev/null
# If arguments were passed, forward them to meridian
if [[ $# -gt 0 ]] && command -v meridian &>/dev/null; then
printf "\n ${C}→${R} Running: meridian setup %s\n\n" "$*"
exec meridian setup "$@"
fi