-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·103 lines (85 loc) · 4.27 KB
/
install.sh
File metadata and controls
executable file
·103 lines (85 loc) · 4.27 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env bash
set -euo pipefail
# install.sh - Install mistserver-bootstrap CLI tools
# Creates symlinks in /usr/local/bin and sets up config directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
log() { printf '[install] %s\n' "$*"; }
warn() { printf '[install][warn] %s\n' "$*" >&2; }
fail() { printf '[install][error] %s\n' "$*" >&2; exit 1; }
# ─────────────────────────────────────────────────────────────────────────────
# Configuration
# ─────────────────────────────────────────────────────────────────────────────
INSTALL_PREFIX="${INSTALL_PREFIX:-/usr/local}"
CONFIG_DIR="${CONFIG_DIR:-/etc/mistserver}"
# ─────────────────────────────────────────────────────────────────────────────
# Check requirements
# ─────────────────────────────────────────────────────────────────────────────
if [ "$(id -u)" -ne 0 ]; then
log "Running with sudo..."
exec sudo "$0" "$@"
fi
# ─────────────────────────────────────────────────────────────────────────────
# Install
# ─────────────────────────────────────────────────────────────────────────────
log "Installing mistserver-bootstrap tools..."
log "Source: ${SCRIPT_DIR}"
log "Install prefix: ${INSTALL_PREFIX}"
log "Config dir: ${CONFIG_DIR}"
echo ""
# Create config directory
mkdir -p "${CONFIG_DIR}"
# Create symlinks for bin scripts
log "Creating symlinks in ${INSTALL_PREFIX}/bin..."
mkdir -p "${INSTALL_PREFIX}/bin"
for script in "${SCRIPT_DIR}/bin/"*; do
if [ -f "${script}" ] && [ -x "${script}" ]; then
name="$(basename "${script}")"
target="${INSTALL_PREFIX}/bin/${name}"
if [ -L "${target}" ]; then
rm "${target}"
elif [ -e "${target}" ]; then
warn "Skipping ${name}: file exists and is not a symlink"
continue
fi
ln -s "${script}" "${target}"
log " ${name} -> ${script}"
fi
done
# Also symlink videogen.sh as mist-videogen if not already done
if [ -f "${SCRIPT_DIR}/scripts/videogen.sh" ]; then
if [ ! -e "${INSTALL_PREFIX}/bin/videogen" ]; then
ln -s "${SCRIPT_DIR}/bin/mist-videogen" "${INSTALL_PREFIX}/bin/videogen"
log " videogen -> ${SCRIPT_DIR}/bin/mist-videogen"
fi
fi
# Create default environment file if it doesn't exist
if [ ! -f "${CONFIG_DIR}/bootstrap.env" ]; then
if [ -f "${SCRIPT_DIR}/env.example" ]; then
cp "${SCRIPT_DIR}/env.example" "${CONFIG_DIR}/bootstrap.env"
log "Created ${CONFIG_DIR}/bootstrap.env"
fi
fi
# Store the bootstrap root location
cat > "${CONFIG_DIR}/bootstrap-root" <<EOF
${SCRIPT_DIR}
EOF
log "Stored bootstrap root in ${CONFIG_DIR}/bootstrap-root"
echo ""
log "Installation complete!"
echo ""
echo "Available commands:"
echo " mist-install Install MistServer (build from source or download binary)"
echo " mist-passwd Change MistServer admin password"
echo " mist-https Enable/disable HTTPS reverse proxy"
echo " mist-monitoring Enable/disable Prometheus + Grafana"
echo " mist-status Show MistServer status"
echo " mist-videogen Generate test video stream"
echo ""
echo "Configuration:"
echo " Edit ${CONFIG_DIR}/bootstrap.env to customize settings"
echo ""
echo "Quick start (native installation):"
echo " mist-install # Build from source with AV support"
echo " mist-install --binary # Or download pre-built binary"
echo " mist-monitoring enable # Enable Prometheus + Grafana"
echo " mist-https enable --domain ... # Enable HTTPS reverse proxy"