-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·51 lines (40 loc) · 1.01 KB
/
install.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.01 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
#!/bin/bash
set -e
REPO="https://github.com/ruilisi/lingti-code.git"
INSTALL_DIR="$HOME/.lingti"
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
BOLD='\033[1m'
RESET='\033[0m'
info() { echo -e "${BLUE}==>${RESET} ${BOLD}$1${RESET}"; }
success() { echo -e "${GREEN}==>${RESET} ${BOLD}$1${RESET}"; }
command_exists() { command -v "$1" &>/dev/null; }
install_pkg() {
local pkg="$1" cmd="${2:-$1}"
if ! command_exists "$cmd"; then
info "Installing $pkg..."
if [ "$(uname)" = "Darwin" ]; then
brew install "$pkg"
else
sudo apt install -y "$pkg"
fi
fi
}
# --- Main ---
if [ -d "$INSTALL_DIR" ]; then
echo "Lingti is already installed at $INSTALL_DIR"
exit 0
fi
info "Installing dependencies..."
install_pkg fontconfig fc-cache
for tool in zsh git rake tmux; do
install_pkg "$tool"
done
info "Cloning lingti-code..."
git clone --depth=1 "$REPO" "$INSTALL_DIR"
cd "$INSTALL_DIR"
[ "$1" = "ask" ] && export ASK="true"
rake install
success "Installation complete! Restarting shell..."
exec zsh