-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·71 lines (58 loc) · 1.88 KB
/
install.sh
File metadata and controls
executable file
·71 lines (58 loc) · 1.88 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
#!/bin/bash
set -e
REPO_URL="https://github.com/waveplate/kibash.git"
INSTALL_DIR="$HOME/.kibash"
BASHRC="$HOME/.bashrc"
echo "Installing kibash..."
# Check if we are installing from the local source directory
if [ -f "init.sh" ] && [ -f "kiba.sh" ] && [ -f "README.md" ]; then
IS_LOCAL_INSTALL=true
else
IS_LOCAL_INSTALL=false
fi
if [ "$IS_LOCAL_INSTALL" = false ]; then
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "Error: git is not installed."
exit 1
fi
# Clone or update the repository
if [ -d "$INSTALL_DIR" ]; then
echo "Updating existing installation in $INSTALL_DIR..."
cd "$INSTALL_DIR"
git pull
else
echo "Cloning kibash to $INSTALL_DIR..."
git clone "$REPO_URL" "$INSTALL_DIR"
fi
else
# Local install: copy files to INSTALL_DIR
echo "Installing from local directory to $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
cp -r . "$INSTALL_DIR"
fi
# Initialize env directory with defaults if they don't exist
ENV_DIR="$INSTALL_DIR/env"
mkdir -p "$ENV_DIR"
if [ ! -f "$ENV_DIR/KIBASH_PROVIDER" ]; then
echo "groq" > "$ENV_DIR/KIBASH_PROVIDER"
fi
if [ ! -f "$ENV_DIR/KIBASH_MODEL" ]; then
echo "gpt-oss-20b" > "$ENV_DIR/KIBASH_MODEL"
fi
if [ ! -f "$ENV_DIR/KIBASH_SYSTEM" ]; then
echo "Output a valid linux shell command which matches the user description. Output only JSON, do not use codeblocks" > "$ENV_DIR/KIBASH_SYSTEM"
fi
# Add source line to .bashrc if not present
INIT_SCRIPT="$INSTALL_DIR/init.sh"
SOURCE_LINE=". $INIT_SCRIPT"
if grep -Fxq "$SOURCE_LINE" "$BASHRC"; then
echo "kibash is already sourced in $BASHRC"
else
echo "Adding source line to $BASHRC..."
echo "" >> "$BASHRC"
echo "# kibash" >> "$BASHRC"
echo "$SOURCE_LINE" >> "$BASHRC"
fi
echo "Installation complete!"
echo "Please restart your terminal or run: source $BASHRC"