-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·35 lines (29 loc) · 949 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·35 lines (29 loc) · 949 Bytes
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
#!/bin/bash
# Install bolt-viewer to ~/bin (or PREFIX/bin) so you can run it from anywhere.
# Usage: ./install.sh [PREFIX]
# PREFIX defaults to $HOME, so binary goes to $HOME/bin
# Use /usr/local for system-wide install (may need sudo)
set -e
cd "$(dirname "$0")"
PREFIX="${1:-$HOME}"
BINDIR="${PREFIX}/bin"
mkdir -p "$BINDIR"
# Install npm deps and build frontend
if [ ! -d web/node_modules ]; then
echo "Installing frontend dependencies..."
(cd web && npm install)
fi
echo "Building frontend..."
(cd web && npm run build)
# Build binary
echo "Building bolt-viewer..."
go build -o bolt-viewer .
# Install
cp bolt-viewer "$BINDIR/"
echo "Installed bolt-viewer to $BINDIR"
if [[ ":$PATH:" != *":$BINDIR:"* ]]; then
echo ""
echo "Note: Add $BINDIR to your PATH if it's not already:"
echo " echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.bashrc # bash"
echo " echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.zshrc # zsh"
fi