-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·197 lines (166 loc) · 7.39 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·197 lines (166 loc) · 7.39 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
set -e
echo ""
echo " installing soldier boy..."
echo ""
# ── Python Environment ────────────────────────────────────────
INSTALL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ ! -f "$INSTALL_DIR/config.yaml" ] && [ -f "$INSTALL_DIR/config.yaml.example" ]; then
echo " initializing config.yaml from config.yaml.example..."
cp "$INSTALL_DIR/config.yaml.example" "$INSTALL_DIR/config.yaml"
fi
if [ -n "$VIRTUAL_ENV" ]; then
echo " using active virtual environment: $VIRTUAL_ENV"
VENV_ACTIVATE="$VIRTUAL_ENV/bin/activate"
else
if [ -f "$INSTALL_DIR/soldier-env/bin/activate" ]; then
echo " using existing local virtual environment: soldier-env"
source "$INSTALL_DIR/soldier-env/bin/activate"
VENV_ACTIVATE="$INSTALL_DIR/soldier-env/bin/activate"
elif [ -f "$INSTALL_DIR/joe-env/bin/activate" ]; then
echo " using existing local virtual environment: joe-env"
source "$INSTALL_DIR/joe-env/bin/activate"
VENV_ACTIVATE="$INSTALL_DIR/joe-env/bin/activate"
elif [ -f "$INSTALL_DIR/venv/bin/activate" ]; then
echo " using existing local virtual environment: venv"
source "$INSTALL_DIR/venv/bin/activate"
VENV_ACTIVATE="$INSTALL_DIR/venv/bin/activate"
else
VENV_DIR="$INSTALL_DIR/soldier-env"
echo " setting up new virtual environment in $VENV_DIR..."
# Note: --system-site-packages is required so pywebview can inherit system-level GTK (gi/PyGObject) bindings
python3 -m venv --system-site-packages "$VENV_DIR"
source "$VENV_DIR/bin/activate"
VENV_ACTIVATE="$VENV_DIR/bin/activate"
fi
fi
VENV_BIN="$(dirname "$VENV_ACTIVATE")"
# ── Python deps ───────────────────────────────────────────────
"$VENV_BIN/python3" -m pip install -e .
"$VENV_BIN/python3" -m pip install sherlock-project maigret holehe
# ── Playwright (headless browser for verification) ────────────
echo " installing playwright chromium..."
"$VENV_BIN/python3" -m pip install playwright
"$VENV_BIN/python3" -m playwright install chromium 2>/dev/null || true
# ── Ollama Check (Optional — Local Fallback) ──────────────────
echo ""
echo " ─────────────────────────────────────────────────────────"
echo " Soldier Boy uses NVIDIA NIM or Gemini API for primary"
echo " inference. No local models are automatically downloaded."
echo " ─────────────────────────────────────────────────────────"
echo ""
if command -v ollama &> /dev/null; then
echo " ollama detected ✓ (Optional local fallback ready if models exist)"
else
echo " ollama not installed (Cloud APIs will be used for LLM features)"
fi
# ── System & User Commands ─────────────────────────────────────
echo " registering soldierboy command wrapper..."
# Clean up legacy joe wrappers if present
rm -f ~/.local/bin/joe 2>/dev/null || true
mkdir -p ~/.local/bin
cat > ~/.local/bin/soldierboy << WRAPPER
#!/bin/bash
source $VENV_ACTIVATE
cd $INSTALL_DIR
exec $VENV_BIN/python3 $INSTALL_DIR/soldierboy.py "\$@"
WRAPPER
chmod +x ~/.local/bin/soldierboy
if command -v sudo &>/dev/null && [ -w /usr/local/bin ]; then
sudo rm -f /usr/local/bin/joe 2>/dev/null || true
sudo bash -c "cat > /usr/local/bin/soldierboy << 'WRAPPER'
#!/bin/bash
source $VENV_ACTIVATE
cd $INSTALL_DIR
exec $VENV_BIN/python3 $INSTALL_DIR/soldierboy.py \"\$@\"
WRAPPER"
sudo chmod +x /usr/local/bin/soldierboy
fi
# ── Desktop entry ─────────────────────────────────────────────
echo " creating desktop entry..."
ICON_PATH="$INSTALL_DIR/frontend/soldierboy-icon.png"
if [ ! -f "$ICON_PATH" ]; then
ICON_PATH="$INSTALL_DIR/assets/logo.png"
fi
mkdir -p ~/.local/share/applications
rm -f ~/.local/share/applications/joe-goldberg.desktop
cat > ~/.local/share/applications/soldierboy.desktop << EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Soldier Boy
GenericName=OSINT Assistant
Comment=Autonomous OSINT Assistant — zero APIs, fully local
Exec=$VENV_BIN/python3 $INSTALL_DIR/soldierboy.py
Icon=$ICON_PATH
Terminal=false
Categories=Security;Network;
Keywords=osint;recon;investigation;security;pentest;soldier;
StartupNotify=true
StartupWMClass=SoldierBoy
EOF
chmod +x ~/.local/share/applications/soldierboy.desktop
# Refresh desktop application menu
if command -v update-desktop-database &> /dev/null; then
update-desktop-database ~/.local/share/applications/ 2>/dev/null
fi
# Try to refresh desktop shell if running
if command -v xdg-desktop-menu &> /dev/null; then
xdg-desktop-menu forceupdate 2>/dev/null
fi
# ── Ollama autostart on login ─────────────────────────────────
echo " configuring ollama autostart..."
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/ollama.service << EOF
[Unit]
Description=Ollama LLM Server
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/ollama serve
Restart=on-failure
RestartSec=3
[Install]
WantedBy=default.target
EOF
systemctl --user enable ollama.service 2>/dev/null
systemctl --user start ollama.service 2>/dev/null
# ── Done ──────────────────────────────────────────────────────
echo ""
echo " ✓ soldierboy installed"
echo " ✓ system command registered — run: soldierboy"
echo " ✓ desktop icon created — search 'Soldier Boy' in your application menu"
echo " ✓ ollama configured to start automatically on login"
echo ""
echo " ─────────────────────────────────────────────────────────"
echo " Gemini API key setup (free key at https://aistudio.google.com/apikey)"
echo " ─────────────────────────────────────────────────────────"
echo ""
# Detect the user's login shell and print the right config command
USER_SHELL="$(basename "$(getent passwd "$USER" | cut -d: -f7 2>/dev/null || echo "${SHELL:-bash}")")"
case "$USER_SHELL" in
zsh)
echo " Your shell: zsh"
echo ""
echo " echo 'export GEMINI_API_KEY=\"your_key_here\"' >> ~/.zshrc"
echo " source ~/.zshrc"
echo ""
echo " (if you see shopt errors, remove any 'source ~/.bashrc' line from ~/.zshrc)"
;;
fish)
echo " Your shell: fish"
echo ""
echo " set -Ux GEMINI_API_KEY \"your_key_here\""
;;
*)
echo " Your shell: bash / other"
echo ""
echo " echo 'export GEMINI_API_KEY=\"your_key_here\"' >> ~/.bashrc"
echo " source ~/.bashrc"
;;
esac
echo ""
echo " To make narration work from the desktop icon too, also set:"
echo " sudo nano /usr/local/bin/soldierboy"
echo " Add: export GEMINI_API_KEY=\"your_key_here\" (below the shebang)"
echo ""