openclaw-droid 3.0.5 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of openclaw-droid might be problematic. Click here for more details.

package/LICENSE CHANGED
@@ -1,21 +1,19 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Mithun Gowda B
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md CHANGED
@@ -10,6 +10,7 @@ Turn your Android device into a 24/7 AI Gateway using OpenClaw with proot-distro
10
10
  - **Full Linux Environment**: Complete Ubuntu container with Node.js 22
11
11
  - **24/7 Operation**: Optimized for long-running background sessions
12
12
  - **Easy Installation**: One-command installer with automatic setup
13
+ - **Bionic Bypass**: Automatically patches Android network restrictions
13
14
 
14
15
  ## Prerequisites
15
16
 
@@ -29,13 +30,11 @@ curl -fsSL https://raw.githubusercontent.com/NosytLabs/openclaw-droid/main/insta
29
30
 
30
31
  This will:
31
32
  1. Update Termux packages
32
- 2. Install proot-distro
33
- 3. Set up Ubuntu container
34
- 4. Configure auto-login to Ubuntu
35
- 5. Install Node.js 22
36
- 6. Install OpenClaw globally
37
- 7. Apply network interface patch
38
- 8. Run onboarding wizard
33
+ 2. Install proot-distro and Ubuntu
34
+ 3. Configure auto-login
35
+ 4. Install Node.js 22 and OpenClaw
36
+ 5. Apply network patch
37
+ 6. Run onboarding wizard
39
38
 
40
39
  ### Manual Install
41
40
 
@@ -65,21 +64,22 @@ proot-distro login ubuntu
65
64
  **Step 5: Update Ubuntu and install Node.js 22**
66
65
  ```bash
67
66
  apt update && apt upgrade -y
67
+ apt install curl git build-essential -y
68
68
  curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
69
69
  apt install -y nodejs
70
70
  ```
71
71
 
72
72
  **Step 6: Install OpenClaw**
73
73
  ```bash
74
- npm install -g openclaw
74
+ npm install -g openclaw@latest
75
75
  ```
76
76
 
77
- **Step 7: Create network interface patch**
77
+ **Step 7: Create network interface patch (Bionic Bypass)**
78
78
  ```bash
79
- cat << 'EOF' > /root/hijack.js
79
+ cat << 'JS' > /root/hijack.js
80
80
  const os = require('os');
81
81
  os.networkInterfaces = () => ({});
82
- EOF
82
+ JS
83
83
  ```
84
84
 
85
85
  **Step 8: Configure environment**
@@ -130,43 +130,91 @@ Once the gateway is running, open your browser to:
130
130
  http://127.0.0.1:18789
131
131
  ```
132
132
 
133
- ## Troubleshooting
133
+ **Note**: To use the Web Gateway chat, copy the `token` from `~/.openclaw/openclaw.json` and paste it in the dashboard under **Overview -> Gateway Access**.
134
+ You can also fetch the token with `openclaw config get gateway.auth.token`.
134
135
 
135
- ### Gateway not starting
136
- - Ensure Ubuntu container is running: `proot-distro login ubuntu`
137
- - Check Node.js version: `node -v` (should be v22.x)
138
- - Verify network patch is applied: `ls /root/hijack.js`
136
+ ## Verifying Installation
139
137
 
140
- ### Network interface errors
141
- - The hijack.js file fixes Android network restrictions
142
- - Make sure `NODE_OPTIONS` is set: `echo $NODE_OPTIONS`
143
- - Reapply the patch if needed
138
+ After installation completes, you can verify everything is working by running:
144
139
 
145
- ### Termux crashes or kills process
146
- - Disable battery optimization for Termux in Android settings
147
- - Keep Termux notification active
148
- - Consider using tmux for persistent sessions: `pkg install tmux -y`
140
+ ```bash
141
+ # From Termux (outside Ubuntu)
142
+ bash verify.sh
143
+ ```
149
144
 
150
- ### Ubuntu container issues
151
- - Reinstall container: `proot-distro remove ubuntu && proot-distro install ubuntu`
152
- - Check disk space: `df -h`
145
+ This will check:
146
+ - Termux/Ubuntu environment
147
+ - proot-distro and Ubuntu container
148
+ - Node.js and npm installation
149
+ - OpenClaw global package
150
+ - Termux shortcut and Ubuntu command
151
+ - Network bypass script
152
+ - Environment configuration
153
153
 
154
- ## Advanced Usage
154
+ If all checks pass, you're ready to use OpenClaw!
155
155
 
156
- ### 24/7 Mode with tmux
156
+ ### Quick Test Commands
157
+
158
+ **From Termux (after reopening):**
157
159
  ```bash
158
- pkg install tmux -y
159
- tmux new -s openclaw
160
- proot-distro login ubuntu
161
- openclaw gateway --verbose
160
+ openclaw --help
162
161
  ```
163
162
 
164
- Detach with `Ctrl+b` then `d`. Reattach with `tmux attach -t openclaw`.
163
+ **From inside Ubuntu:**
164
+ ```bash
165
+ openclaw --help
166
+ ```
167
+
168
+ Both should show the OpenClaw help menu.
169
+
170
+ ## Troubleshooting
171
+
172
+ ### "openclaw: command not found"
173
+ If you see this error after installation:
174
+ 1. Ensure you are inside Ubuntu (`proot-distro login ubuntu`)
175
+ 2. Run `source ~/.bashrc` to reload your path
176
+ 3. If that fails, run `npm install -g openclaw@latest` again inside Ubuntu
165
177
 
166
- ### Update OpenClaw
178
+ ### Gateway not starting / System Error 13
179
+ This usually means the network patch isn't applied.
180
+ 1. Check if patch exists: `ls /root/hijack.js`
181
+ 2. Check if NODE_OPTIONS is set: `echo $NODE_OPTIONS`
182
+ 3. It should print `--require /root/hijack.js`. If empty, run `export NODE_OPTIONS="--require /root/hijack.js"`
183
+
184
+ ### Termux crashes or kills process
185
+ Android kills background apps to save battery.
186
+ 1. **Disable Battery Optimization**: Go to Android Settings -> Apps -> Termux -> Battery -> Unrestricted
187
+ 2. **Acquire Wake Lock**: Run `termux-wake-lock` in a separate Termux session
188
+ 3. **Use tmux**: `pkg install tmux -y` then run `tmux` before logging into Ubuntu. This keeps your session alive even if the app closes.
189
+
190
+ ## Pro Tips
191
+
192
+ - **Keep it Alive**: Android will kill Termux in the background. Run `termux-wake-lock` in a separate Termux session and disable "Battery Optimization" for Termux.
193
+ - **The UI**: Access your dashboard by going to `http://127.0.0.1:18789` in your phone's browser. Get your token using `openclaw config get gateway.auth.token`.
194
+ - **Security**: Never show your full API keys or Gateway tokens in videos. Revoke keys if exposed.
195
+ - **Remote Access**: Install `openssh` in Termux to SSH into your phone from your PC.
196
+ - **Reset**: If things get messy, you can reinstall Ubuntu: `proot-distro remove ubuntu && proot-distro install ubuntu`
197
+
198
+ ## Verified Commands
199
+
200
+ Once the gateway is live, use these chat commands in your linked WhatsApp/Telegram:
201
+
202
+ - `/status` — Check the health of your pocket agent
203
+ - `/think high` — Put the bot in "deep reasoning" mode
204
+ - `/reset` — Clear the current session memory
205
+
206
+ ## Additional Resources
207
+
208
+ ### Access the Web Gateway
209
+ To chat using the web gateway, copy the `token` value from `~/.openclaw/openclaw.json` and paste it at:
210
+ ```
211
+ http://127.0.0.1:18789
212
+ ```
213
+ Navigate to **Overview → Gateway Access → Gateway Token**.
214
+
215
+ ### Get Gateway Token
167
216
  ```bash
168
- proot-distro login ubuntu
169
- npm update -g openclaw
217
+ openclaw config get gateway.auth.token
170
218
  ```
171
219
 
172
220
  ## Project Structure
@@ -174,9 +222,8 @@ npm update -g openclaw
174
222
  ```
175
223
  openclaw-droid/
176
224
  ├── install.sh # Main installer script
177
- ├── hijack.js # Network interface patch
225
+ ├── hijack.js # Network interface patch (reference)
178
226
  ├── README.md # This file
179
- ├── LICENSE # MIT License
180
227
  └── package.json # NPM package configuration
181
228
  ```
182
229
 
package/bin/openclaw ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ console.log("This package 'openclaw-droid' is an installer script.");
3
+ console.log("Please run the install.sh script to install the OpenClaw Android Gateway.");
4
+ console.log("Usage: curl -fsSL https://raw.githubusercontent.com/NosytLabs/openclaw-droid/main/install.sh | bash");
package/install.sh CHANGED
@@ -14,7 +14,319 @@ echo "║ NosytLabs ║"
14
14
  echo "╚═══════════════════════════════════════════╝"
15
15
  echo -e "${NC}"
16
16
 
17
+ write_internal_script() {
18
+ local target="$1"
19
+ cat << 'EOF' > "$target"
20
+ #!/bin/bash
21
+ set -e
22
+
23
+ GREEN='\033[0;32m'
24
+ BLUE='\033[0;34m'
25
+ YELLOW='\033[1;33m'
26
+ RED='\033[0;31m'
27
+ NC='\033[0m'
28
+
29
+ echo -e "\n${BLUE}[Internal]${NC} Configuring OpenClaw environment..."
30
+
31
+ # 1. System Updates
32
+ echo -e "${YELLOW}Updating system packages...${NC}"
33
+ export DEBIAN_FRONTEND=noninteractive
34
+ rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock
35
+ dpkg --configure -a || true
36
+ apt update -y || true
37
+ apt upgrade -y -o Dpkg::Options::="--force-confnew" || true
38
+
39
+ # 2. Dependencies
40
+ echo -e "${YELLOW}Installing dependencies...${NC}"
41
+ apt install curl git build-essential -y
42
+
43
+ # 3. Node.js 22
44
+ echo -e "${YELLOW}Checking Node.js...${NC}"
45
+ if ! command -v node &> /dev/null; then
46
+ echo -e "${YELLOW}Installing Node.js 22...${NC}"
47
+ curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
48
+ apt install -y nodejs
49
+ if ! command -v node &> /dev/null; then
50
+ echo -e "${RED}Error:${NC} Node.js installation failed."
51
+ echo -e "${YELLOW}Node binary not found after installation attempt.${NC}"
52
+ exit 1
53
+ fi
54
+ else
55
+ NODE_VERSION=$(node -v)
56
+ echo -e " ${GREEN}✓${NC} Node.js $NODE_VERSION is installed."
57
+ fi
58
+
59
+ echo -e "${YELLOW}Checking npm...${NC}"
60
+ if ! command -v npm &> /dev/null; then
61
+ echo -e "${RED}Error:${NC} npm is not installed or not in PATH."
62
+ exit 1
63
+ fi
64
+ NPM_VERSION=$(npm -v)
65
+ echo -e " ${GREEN}✓${NC} npm $NPM_VERSION is installed."
66
+
67
+ # 4. OpenClaw Global Install
68
+ echo -e "${YELLOW}Installing OpenClaw...${NC}"
69
+ echo -e "${YELLOW}This may take a few minutes...${NC}"
70
+
71
+ # Check and fix npm prefix
72
+ echo -e "${YELLOW}Checking npm configuration...${NC}"
73
+ NPM_PREFIX=$(npm config get prefix)
74
+ echo -e " npm prefix: $NPM_PREFIX"
75
+
76
+ # Fix npm prefix if it's pointing to root home instead of system
77
+ if [ "$NPM_PREFIX" = "/root" ] || [ "$NPM_PREFIX" = "/root/.npm-global" ]; then
78
+ echo -e "${YELLOW}Fixing npm prefix to /usr/local...${NC}"
79
+ mkdir -p /usr/local/lib
80
+ mkdir -p /usr/local/bin
81
+ npm config set prefix /usr/local
82
+ NPM_PREFIX=$(npm config get prefix)
83
+ echo -e " ${GREEN}✓${NC} Updated npm prefix: $NPM_PREFIX"
84
+ fi
85
+
86
+ npm uninstall -g openclaw 2>/dev/null || true
87
+ echo -e "${YELLOW}Downloading and installing OpenClaw package...${NC}"
88
+ echo -e "${YELLOW}Running: npm install -g openclaw@latest --unsafe-perm=true --force${NC}"
89
+
90
+ # Run npm install with full output
91
+ if ! npm install -g openclaw@latest --unsafe-perm=true --force; then
92
+ echo -e "${RED}Error:${NC} OpenClaw installation failed with --force flag."
93
+ echo -e "${YELLOW}Attempting to install without force flag...${NC}"
94
+ if ! npm install -g openclaw@latest --unsafe-perm=true; then
95
+ echo -e "${RED}Error:${NC} OpenClaw installation failed completely."
96
+ echo -e "${YELLOW}Diagnostic information:${NC}"
97
+ echo " Node version: $(node -v)"
98
+ echo " npm version: $(npm -v)"
99
+ echo " npm config prefix: $(npm config get prefix)"
100
+ echo " npm config cache: $(npm config get cache)"
101
+ echo " Disk space: $(df -h / | tail -1 | awk '{print $4}') available"
102
+ echo " npm bin -g: $(npm bin -g 2>/dev/null || echo 'failed')"
103
+
104
+ echo -e "${YELLOW}Attempting alternative installation method...${NC}"
105
+ echo -e "${YELLOW}Cleaning npm cache...${NC}"
106
+ npm cache clean --force || true
107
+
108
+ echo -e "${YELLOW}Installing with legacy behavior...${NC}"
109
+ if ! npm install -g openclaw@latest --legacy-peer-deps --unsafe-perm=true; then
110
+ echo -e "${RED}Error:${NC} All installation methods failed."
111
+ echo -e "${YELLOW}Please try manually: npm install -g openclaw@latest${NC}"
112
+ exit 1
113
+ fi
114
+ fi
115
+ fi
116
+
117
+ echo -e "${YELLOW}Verifying OpenClaw installation...${NC}"
118
+ echo -e "${YELLOW}Checking global package list...${NC}"
119
+ if ! npm ls -g --depth=0 2>&1 | grep -q "openclaw"; then
120
+ echo -e "${RED}Error:${NC} OpenClaw is not in npm global package list."
121
+ echo -e "${YELLOW}Installed global packages:${NC}"
122
+ npm ls -g --depth=0 2>&1 || true
123
+ exit 1
124
+ fi
125
+ echo -e " ${GREEN}✓${NC} OpenClaw found in global package list"
126
+
127
+ NPM_BIN=$(npm bin -g 2>/dev/null || echo "/usr/local/bin")
128
+ echo -e " ${GREEN}✓${NC} NPM_BIN: $NPM_BIN"
129
+
130
+ if [ ! -d "$NPM_BIN" ]; then
131
+ echo -e "${RED}Error:${NC} NPM_BIN directory does not exist: $NPM_BIN"
132
+ echo -e "${YELLOW}Creating NPM_BIN directory...${NC}"
133
+ mkdir -p "$NPM_BIN" || {
134
+ echo -e "${RED}Error:${NC} Failed to create NPM_BIN directory"
135
+ exit 1
136
+ }
137
+ fi
138
+
139
+ echo -e "${YELLOW}Checking for OpenClaw binary...${NC}"
140
+ if [ -x "$NPM_BIN/openclaw" ]; then
141
+ echo -e " ${GREEN}✓${NC} Found openclaw binary at: $NPM_BIN/openclaw"
142
+ ls -lh "$NPM_BIN/openclaw"
143
+ elif [ -f "$NPM_BIN/openclaw" ]; then
144
+ echo -e "${YELLOW}Warning:${NC} openclaw exists but is not executable. Fixing permissions..."
145
+ chmod +x "$NPM_BIN/openclaw"
146
+ echo -e " ${GREEN}✓${NC} Made executable: $NPM_BIN/openclaw"
147
+ else
148
+ echo -e "${RED}Error:${NC} openclaw binary not found at: $NPM_BIN/openclaw"
149
+ echo -e "${YELLOW}Contents of NPM_BIN directory:${NC}"
150
+ ls -la "$NPM_BIN" 2>/dev/null || echo "Directory empty or inaccessible"
151
+ echo -e "${YELLOW}Searching for openclaw in system...${NC}"
152
+ find /usr -name "openclaw" -type f 2>/dev/null | head -5
153
+ exit 1
154
+ fi
155
+
156
+ export PATH="$NPM_BIN:$PATH"
157
+ echo -e " ${GREEN}✓${NC} PATH updated with NPM_BIN"
158
+ echo -e " ${GREEN}✓${NC} OpenClaw installed successfully."
159
+
160
+ # 5. Bionic Bypass (Hijack Script)
161
+ echo -e "${YELLOW}Creating network bypass (hijack.js)...${NC}"
162
+ mkdir -p /root
163
+ cat << 'JS' > /root/hijack.js
164
+ const os = require('os');
165
+ os.networkInterfaces = () => ({});
166
+ JS
167
+
168
+ # 6. Robust Command Setup
169
+ echo -e "${YELLOW}Configuring 'openclaw' command...${NC}"
170
+
171
+ NPM_PREFIX=$(npm prefix -g 2>/dev/null || echo "/usr")
172
+ NPM_ROOT=$(npm root -g 2>/dev/null || echo "/usr/lib/node_modules")
173
+ NPM_BIN=${NPM_BIN:-$(npm bin -g 2>/dev/null || echo "/usr/local/bin")}
174
+ OPENCLAW_BIN=""
175
+ REAL_BIN=""
176
+
177
+ echo -e "${YELLOW}Searching for OpenClaw binary...${NC}"
178
+ echo -e " NPM_PREFIX: $NPM_PREFIX"
179
+ echo -e " NPM_ROOT: $NPM_ROOT"
180
+ echo -e " NPM_BIN: $NPM_BIN"
181
+
182
+ if [ -x "$NPM_BIN/openclaw" ]; then
183
+ OPENCLAW_BIN="$NPM_BIN/openclaw"
184
+ echo -e " ${GREEN}✓${NC} Found binary at: $OPENCLAW_BIN"
185
+ ls -lh "$OPENCLAW_BIN"
186
+ fi
187
+
188
+ if [ -z "$OPENCLAW_BIN" ] && [ -f "$NPM_ROOT/openclaw/bin/openclaw.js" ]; then
189
+ REAL_BIN="$NPM_ROOT/openclaw/bin/openclaw.js"
190
+ echo -e " ${GREEN}✓${NC} Found JS binary at: $REAL_BIN"
191
+ ls -lh "$REAL_BIN"
192
+ elif [ -z "$OPENCLAW_BIN" ] && [ -z "$REAL_BIN" ] && [ -f "$NPM_PREFIX/lib/node_modules/openclaw/bin/openclaw.js" ]; then
193
+ REAL_BIN="$NPM_PREFIX/lib/node_modules/openclaw/bin/openclaw.js"
194
+ echo -e " ${GREEN}✓${NC} Found JS binary at: $REAL_BIN"
195
+ ls -lh "$REAL_BIN"
196
+ elif [ -z "$OPENCLAW_BIN" ] && [ -z "$REAL_BIN" ] && [ -f "/usr/lib/node_modules/openclaw/bin/openclaw.js" ]; then
197
+ REAL_BIN="/usr/lib/node_modules/openclaw/bin/openclaw.js"
198
+ echo -e " ${GREEN}✓${NC} Found JS binary at: $REAL_BIN"
199
+ ls -lh "$REAL_BIN"
200
+ elif [ -z "$OPENCLAW_BIN" ] && [ -z "$REAL_BIN" ]; then
201
+ REAL_BIN=$(find /usr -name openclaw.js 2>/dev/null | grep "/bin/openclaw.js" | head -n 1)
202
+ if [ -n "$REAL_BIN" ]; then
203
+ echo -e " ${GREEN}✓${NC} Found JS binary via find at: $REAL_BIN"
204
+ ls -lh "$REAL_BIN"
205
+ fi
206
+ fi
207
+
208
+ if [ -z "$OPENCLAW_BIN" ] && [ -z "$REAL_BIN" ]; then
209
+ echo -e "${RED}Error:${NC} Could not locate OpenClaw binary after install."
210
+ echo -e "${YELLOW}Searching for all node_modules...${NC}"
211
+ find /usr -type d -name "node_modules" 2>/dev/null | head -5
212
+ echo -e "${YELLOW}Searching for openclaw files in system...${NC}"
213
+ find /usr -name "*openclaw*" 2>/dev/null | head -10
214
+ exit 1
215
+ fi
216
+
217
+ if [ -n "$OPENCLAW_BIN" ]; then
218
+ cat << WRAPPER > /usr/bin/openclaw
219
+ #!/bin/bash
220
+ export PATH="$NPM_BIN:\$PATH"
221
+ export NODE_OPTIONS="-r /root/hijack.js"
222
+ exec "$OPENCLAW_BIN" "\$@"
223
+ WRAPPER
224
+ else
225
+ cat << WRAPPER > /usr/bin/openclaw
226
+ #!/bin/bash
227
+ export PATH="$NPM_BIN:\$PATH"
228
+ export NODE_OPTIONS="-r /root/hijack.js"
229
+ exec node "$REAL_BIN" "\$@"
230
+ WRAPPER
231
+ fi
232
+
233
+ chmod +x /usr/bin/openclaw
234
+ echo -e "${GREEN}✓${NC} Created wrapper at /usr/bin/openclaw"
235
+ ln -sf /usr/bin/openclaw /bin/openclaw 2>/dev/null || true
236
+ ln -sf /usr/bin/openclaw /usr/local/bin/openclaw 2>/dev/null || true
237
+
238
+ echo -e "${YELLOW}Testing OpenClaw wrapper...${NC}"
239
+ echo -e "${YELLOW}Wrapper content:${NC}"
240
+ cat /usr/bin/openclaw
241
+ echo -e "${YELLOW}Attempting to run: /usr/bin/openclaw --help${NC}"
242
+
243
+ export PATH="/usr/bin:/usr/local/bin:/bin:$NPM_BIN:$PATH"
244
+ if ! /usr/bin/openclaw --help >/dev/null 2>&1; then
245
+ echo -e "${RED}Error:${NC} OpenClaw wrapper failed to run."
246
+ echo -e "${YELLOW}Debug info:${NC}"
247
+ echo " Wrapper exists: $(ls -l /usr/bin/openclaw 2>/dev/null || echo 'no')"
248
+ echo " NPM_BIN: $NPM_BIN"
249
+ echo " OPENCLAW_BIN: ${OPENCLAW_BIN:-'not set'}"
250
+ echo " REAL_BIN: ${REAL_BIN:-'not set'}"
251
+ echo " PATH: $PATH"
252
+ echo " Testing direct execution:"
253
+ if [ -n "$OPENCLAW_BIN" ]; then
254
+ "$OPENCLAW_BIN" --help 2>&1 | head -5 || echo "Binary execution failed"
255
+ else
256
+ node "$REAL_BIN" --help 2>&1 | head -5 || echo "JS execution failed"
257
+ fi
258
+ exit 1
259
+ fi
260
+ echo -e " ${GREEN}✓${NC} OpenClaw wrapper working correctly."
261
+
262
+ # 7. Environment Persistence
263
+ echo -e "${YELLOW}Persisting environment variables...${NC}"
264
+
265
+ sed -i '/hijack.js/d' /root/.bashrc
266
+ sed -i '/npm prefix/d' /root/.bashrc
267
+ sed -i '/hijack.js/d' /root/.profile
268
+ sed -i '/npm prefix/d' /root/.profile
269
+ sed -i '/hijack.js/d' /etc/profile
270
+ sed -i '/npm prefix/d' /etc/profile
271
+ sed -i '/hijack.js/d' /etc/bash.bashrc
272
+ sed -i '/npm prefix/d' /etc/bash.bashrc
273
+
274
+ echo 'export NODE_OPTIONS="-r /root/hijack.js"' >> /root/.bashrc
275
+ echo 'export PATH="/usr/bin:/usr/local/bin:/bin:$PATH"' >> /root/.bashrc
276
+
277
+ echo 'export NODE_OPTIONS="-r /root/hijack.js"' >> /root/.profile
278
+ echo 'export PATH="/usr/bin:/usr/local/bin:/bin:$PATH"' >> /root/.profile
279
+ echo 'export NODE_OPTIONS="-r /root/hijack.js"' >> /etc/profile
280
+ echo 'export PATH="/usr/bin:/usr/local/bin:/bin:$PATH"' >> /etc/profile
281
+ echo 'export NODE_OPTIONS="-r /root/hijack.js"' >> /etc/bash.bashrc
282
+ echo 'export PATH="/usr/bin:/usr/local/bin:/bin:$PATH"' >> /etc/bash.bashrc
283
+
284
+ export NODE_OPTIONS="-r /root/hijack.js"
285
+ export PATH="/usr/bin:/usr/local/bin:/bin:$PATH"
286
+
287
+ # 8. Onboarding
288
+ echo -e "\n${GREEN}Starting OpenClaw Onboarding...${NC}"
289
+ echo -e "${RED}IMPORTANT: Select 'Loopback (127.0.0.1)' for Gateway Bind!${NC}"
290
+ echo -e "${RED}Choosing LAN/0.0.0.0 will trigger a crash on non-rooted Android devices.${NC}"
291
+
292
+ echo -e "${YELLOW}Checking if openclaw command is available...${NC}"
293
+ if ! command -v openclaw &> /dev/null; then
294
+ echo -e "${YELLOW}Warning: 'openclaw' command not found in PATH.${NC}"
295
+ echo -e "${YELLOW}Debug information:${NC}"
296
+ echo " PATH: $PATH"
297
+ echo " /usr/bin/openclaw exists: $(ls -l /usr/bin/openclaw 2>/dev/null || echo 'no')"
298
+ echo " Command -v openclaw result: $(command -v openclaw 2>&1 || echo 'not found')"
299
+ echo -e "${YELLOW}Skipping onboarding. You can run 'openclaw onboard' later after fixing the command.${NC}"
300
+ echo -e "${YELLOW}To fix: Try running 'source ~/.bashrc' or check the wrapper at /usr/bin/openclaw${NC}"
301
+ else
302
+ echo -e " ${GREEN}✓${NC} 'openclaw' command is available globally."
303
+ echo -e "${YELLOW}Running onboarding wizard...${NC}"
304
+ if openclaw onboard; then
305
+ echo -e "${GREEN}Onboarding completed.${NC}"
306
+ else
307
+ echo -e "${YELLOW}Onboarding skipped or failed (you can run 'openclaw onboard' later).${NC}"
308
+ fi
309
+ fi
310
+
311
+ echo -e "\n${GREEN}╔═══════════════════════════════════════════╗${NC}"
312
+ echo -e "${GREEN}║ INSTALLATION COMPLETE! ║${NC}"
313
+ echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
314
+ if [ "${OPENCLAW_INSTALL_CONTEXT:-termux}" = "termux" ]; then
315
+ echo -e "You are now being logged into Ubuntu."
316
+ fi
317
+ echo -e "Just type ${BLUE}openclaw gateway${NC} to start."
318
+ EOF
319
+ chmod +x "$target"
320
+ }
321
+
17
322
  if [ -z "$TERMUX_VERSION" ]; then
323
+ if [ -f /etc/os-release ] && grep -qi "ubuntu" /etc/os-release; then
324
+ echo -e "${YELLOW}Detected Ubuntu shell. Running internal setup only...${NC}"
325
+ INTERNAL_SCRIPT="/tmp/openclaw_internal_setup.sh"
326
+ write_internal_script "$INTERNAL_SCRIPT"
327
+ OPENCLAW_INSTALL_CONTEXT=ubuntu bash "$INTERNAL_SCRIPT"
328
+ exit $?
329
+ fi
18
330
  echo -e "${RED}Error:${NC} This script must be run inside Termux."
19
331
  echo -e "Install Termux from F-Droid: ${BLUE}https://f-droid.org/packages/com.termux/${NC}"
20
332
  exit 1
@@ -23,10 +335,9 @@ fi
23
335
  echo -e "\n${BLUE}[1/6]${NC} Updating Termux packages..."
24
336
  export DEBIAN_FRONTEND=noninteractive
25
337
 
26
- if ! pkg update -y -o Dpkg::Options::="--force-confnew" || ! pkg upgrade -y -o Dpkg::Options::="--force-confnew"; then
27
- echo -e "${YELLOW}Warning: Termux package update had issues.${NC}"
28
- echo -e "Attempting to proceed..."
29
- fi
338
+ # Attempt update, but don't fail script if mirrors are flaky
339
+ pkg update -y -o Dpkg::Options::="--force-confnew" || echo -e "${YELLOW}Warning: pkg update had issues, continuing...${NC}"
340
+ pkg upgrade -y -o Dpkg::Options::="--force-confnew" || echo -e "${YELLOW}Warning: pkg upgrade had issues, continuing...${NC}"
30
341
 
31
342
  echo -e "\n${BLUE}[2/6]${NC} Installing proot-distro..."
32
343
  if command -v proot-distro &> /dev/null; then
@@ -39,16 +350,27 @@ else
39
350
  fi
40
351
 
41
352
  echo -e "\n${BLUE}[3/6]${NC} Checking Ubuntu container..."
42
- UBUNTU_INSTALLED="false"
43
- if proot-distro list 2>/dev/null | grep -qE '(^|[[:space:]])ubuntu([[:space:]]|$)'; then
44
- UBUNTU_INSTALLED="true"
45
- fi
46
353
 
47
- if [ "$UBUNTU_INSTALLED" = "true" ]; then
354
+ check_ubuntu_installed() {
355
+ if [ -d "$PREFIX/var/lib/proot-distro/installed-rootfs/ubuntu" ]; then return 0; fi
356
+ if proot-distro list 2>/dev/null | grep -q "ubuntu.*(installed)"; then return 0; fi
357
+ return 1
358
+ }
359
+
360
+ if check_ubuntu_installed; then
361
+ echo -e " ${GREEN}✓${NC} Ubuntu is already installed."
362
+ echo -e " ${YELLOW}Verifying installation...${NC}"
363
+
48
364
  if proot-distro login ubuntu -- true 2>/dev/null; then
49
- echo -e " ${GREEN}✓${NC} Ubuntu is already installed and working. Skipping installation."
365
+ echo -e " ${GREEN}✓${NC} Container is healthy. Proceeding to update/repair..."
50
366
  else
51
- echo -e " ${YELLOW}Ubuntu is already installed but login failed. Continuing setup...${NC}"
367
+ echo -e " ${YELLOW}Warning: Ubuntu is installed but might be damaged.${NC}"
368
+ echo -e " ${YELLOW}Reinstalling Ubuntu...${NC}"
369
+ proot-distro remove ubuntu || true
370
+ if ! proot-distro install ubuntu; then
371
+ echo -e "${RED}Error:${NC} Failed to install Ubuntu container."
372
+ exit 1
373
+ fi
52
374
  fi
53
375
  else
54
376
  echo -e " ${YELLOW}Installing Ubuntu...${NC}"
@@ -56,9 +378,12 @@ else
56
378
  echo -e "${RED}Error:${NC} Failed to install Ubuntu container."
57
379
  exit 1
58
380
  fi
381
+ echo -e " ${GREEN}✓${NC} Ubuntu installation completed."
59
382
  fi
60
383
 
61
- echo -e "\n${BLUE}[4/6]${NC} Configuring auto-login (optional)..."
384
+ echo -e "${GREEN}✓${NC} Ubuntu setup complete. Continuing with OpenClaw installation..."
385
+
386
+ echo -e "\n${BLUE}[4/6]${NC} Configuring auto-login..."
62
387
  if ! grep -q "proot-distro login ubuntu" ~/.bashrc; then
63
388
  echo "proot-distro login ubuntu" >> ~/.bashrc
64
389
  echo -e " ${GREEN}✓${NC} Auto-login configured."
@@ -66,157 +391,77 @@ else
66
391
  echo -e " ${GREEN}✓${NC} Auto-login already configured."
67
392
  fi
68
393
 
394
+ echo -e "\n${BLUE}[4.5/6]${NC} Creating Termux shortcut..."
395
+ # Create a wrapper in Termux so users can run 'openclaw' even without logging in
396
+ cat << 'EOF' > "$PREFIX/bin/openclaw"
397
+ #!/bin/bash
398
+ proot-distro login ubuntu -- /usr/bin/openclaw "$@"
399
+ EOF
400
+ chmod +x "$PREFIX/bin/openclaw"
401
+ echo -e " ${GREEN}✓${NC} 'openclaw' command created in Termux."
402
+
69
403
  echo -e "\n${BLUE}[5/6]${NC} Creating internal setup script..."
70
404
  TERMUX_HOME="$HOME"
71
405
  INTERNAL_SCRIPT="$TERMUX_HOME/openclaw_internal_setup.sh"
406
+ write_internal_script "$INTERNAL_SCRIPT"
72
407
 
73
- cat << 'EOF' > "$INTERNAL_SCRIPT"
74
- #!/bin/bash
75
- # We use set -e to stop on errors, but we will catch them where possible
76
- set -e
77
-
78
- GREEN='\033[0;32m'
79
- BLUE='\033[0;34m'
80
- YELLOW='\033[1;33m'
81
- RED='\033[0;31m'
82
- NC='\033[0m'
83
-
84
- echo -e "\n${BLUE}[Internal]${NC} Configuring OpenClaw environment..."
85
-
86
- # 1. Fix Package Manager & Clean Environment
87
- echo -e "${YELLOW}Updating Ubuntu repositories & cleaning up...${NC}"
88
- export DEBIAN_FRONTEND=noninteractive
89
- rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock
90
- dpkg --configure -a || true
91
- # Allow apt update/upgrade to fail without killing the script (e.g. temporary network issues)
92
- apt update -y || echo -e "${YELLOW}Warning: 'apt update' returned error, proceeding anyway...${NC}"
93
- apt upgrade -y -o Dpkg::Options::="--force-confnew" || echo -e "${YELLOW}Warning: 'apt upgrade' returned error, proceeding anyway...${NC}"
94
-
95
- # 2. Install Dependencies
96
- echo -e "${YELLOW}Installing core dependencies...${NC}"
97
- apt install curl git build-essential -y || echo -e "${YELLOW}Warning: Dependencies install had issues...${NC}"
98
-
99
- # 3. Install Node.js 22
100
- echo -e "${YELLOW}Checking Node.js...${NC}"
101
- # Check if node exists and is recent enough?
102
- if ! command -v node &> /dev/null; then
103
- echo -e "${YELLOW}Installing Node.js 22...${NC}"
104
- curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
105
- apt install -y nodejs
106
- else
107
- echo -e " ${GREEN}✓${NC} Node.js $(node -v) is installed."
408
+ echo -e "\n${BLUE}[6/6]${NC} Entering Ubuntu to finalize setup..."
409
+ echo -e "${YELLOW}Running internal setup script inside Ubuntu...${NC}"
410
+
411
+ # Run the internal script
412
+ if ! proot-distro login ubuntu --bind "$TERMUX_HOME":/mnt/termux -- env OPENCLAW_INSTALL_CONTEXT=termux bash /mnt/termux/openclaw_internal_setup.sh; then
413
+ echo -e "${RED}Error:${NC} Internal setup failed with exit code $?"
414
+ echo -e "${YELLOW}Attempting cleanup...${NC}"
415
+ rm -f "$INTERNAL_SCRIPT"
416
+ echo -e "${YELLOW}You can manually login and run 'openclaw onboard' to complete setup.${NC}"
417
+ echo -e "${BLUE}Logging you into Ubuntu now for manual setup...${NC}"
418
+ exec proot-distro login ubuntu
108
419
  fi
109
420
 
110
- # 4. Install OpenClaw
111
- echo -e "${YELLOW}Installing/Updating OpenClaw global package...${NC}"
112
- # Use --force to ensure it overwrites if broken
113
- npm install -g openclaw@latest --force
114
-
115
- # 5. PATH FIXING
116
- echo -e "${YELLOW}Fixing 'openclaw' command visibility...${NC}"
421
+ echo -e "\n${GREEN}Cleaning up...${NC}"
422
+ rm -f "$INTERNAL_SCRIPT"
117
423
 
118
- # Determine where npm installs global binaries
119
- NPM_PREFIX=$(npm prefix -g 2>/dev/null || echo "/usr")
120
- NPM_BIN="$NPM_PREFIX/bin"
424
+ echo -e "\n${BLUE}[Final Verification]${NC} Verifying OpenClaw setup..."
121
425
 
122
- # Fallback check
123
- if [ ! -d "$NPM_BIN" ]; then
124
- # Try common locations
125
- if [ -d "/usr/lib/node_modules/.bin" ]; then
126
- NPM_BIN="/usr/lib/node_modules/.bin"
426
+ echo -e "${YELLOW}Testing Termux shortcut...${NC}"
427
+ if [ -x "$PREFIX/bin/openclaw" ]; then
428
+ echo -e " ${GREEN}✓${NC} Termux shortcut exists at: $PREFIX/bin/openclaw"
429
+ echo -e "${YELLOW}Testing shortcut execution...${NC}"
430
+ if proot-distro login ubuntu -- /usr/bin/openclaw --help 2>&1 | grep -q "Usage"; then
431
+ echo -e " ${GREEN}✓${NC} Termux shortcut working correctly."
432
+ else
433
+ echo -e "${YELLOW}Warning:${NC} Termux shortcut test failed (may work in actual use)."
127
434
  fi
128
- fi
129
-
130
- # Ensure it's in PATH
131
- if [ -d "$NPM_BIN" ] && [[ ":$PATH:" != *":$NPM_BIN:"* ]]; then
132
- echo "export PATH=\$PATH:$NPM_BIN" >> /root/.bashrc
133
- echo "export PATH=\$PATH:$NPM_BIN" >> /root/.profile
134
- fi
135
-
136
- # Symlink Creation
137
- BIN_LOCATIONS=("/usr/bin" "/bin" "/usr/local/bin")
138
- TARGET_BIN=""
139
-
140
- # Look for the binary
141
- if [ -f "$NPM_BIN/openclaw" ]; then
142
- TARGET_BIN="$NPM_BIN/openclaw"
143
- elif [ -f "$NPM_PREFIX/lib/node_modules/openclaw/bin/openclaw.js" ]; then
144
- TARGET_BIN="$NPM_PREFIX/lib/node_modules/openclaw/bin/openclaw.js"
145
- elif [ -f "/usr/lib/node_modules/openclaw/bin/openclaw.js" ]; then
146
- TARGET_BIN="/usr/lib/node_modules/openclaw/bin/openclaw.js"
147
- fi
148
-
149
- if [ -n "$TARGET_BIN" ] && [ -f "$TARGET_BIN" ]; then
150
- echo -e " Found binary at: $TARGET_BIN"
151
- chmod +x "$TARGET_BIN"
152
- for LOC in "${BIN_LOCATIONS[@]}"; do
153
- if [ -d "$LOC" ]; then
154
- # Remove existing symlink or file if it exists
155
- rm -f "$LOC/openclaw"
156
- ln -s "$TARGET_BIN" "$LOC/openclaw"
157
- echo -e " Linked to $LOC/openclaw"
158
- fi
159
- done
160
435
  else
161
- echo -e "${YELLOW}Warning: Could not locate 'openclaw' binary automatically.${NC}"
162
- echo -e "You may need to add npm bin to your PATH manually."
436
+ echo -e "${YELLOW}Warning:${NC} Termux shortcut not found at: $PREFIX/bin/openclaw"
163
437
  fi
164
438
 
165
- # 6. Create Bionic Bypass (Patch)
166
- echo -e "${YELLOW}Creating network interface patch (patch.js)...${NC}"
167
- cat << 'JS' > /root/patch.js
168
- const os = require('os');
169
- os.networkInterfaces = function() {
170
- return {
171
- "lo": [
172
- {
173
- "address": "127.0.0.1",
174
- "netmask": "255.0.0.0",
175
- "family": "IPv4",
176
- "mac": "00:00:00:00:00:00",
177
- "internal": true,
178
- "cidr": "127.0.0.1/8"
179
- }
180
- ]
181
- };
182
- };
183
- JS
184
-
185
- # 7. Configure Environment
186
- echo -e "${YELLOW}Configuring environment variables...${NC}"
187
- if ! grep -q "patch.js" /root/.bashrc; then
188
- echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.bashrc
189
- fi
190
- if ! grep -q "patch.js" /root/.profile; then
191
- echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.profile
439
+ echo -e "${YELLOW}Testing Ubuntu command...${NC}"
440
+ if proot-distro login ubuntu -- command -v openclaw 2>&1 | grep -q "openclaw"; then
441
+ echo -e " ${GREEN}✓${NC} Ubuntu 'openclaw' command is available."
442
+ else
443
+ echo -e "${YELLOW}Warning:${NC} Ubuntu 'openclaw' command not found in PATH."
444
+ echo -e "${YELLOW}You may need to run 'source ~/.bashrc' after logging in.${NC}"
192
445
  fi
193
- export NODE_OPTIONS="--require /root/patch.js"
194
-
195
- echo -e "\n${GREEN}Starting OpenClaw Onboarding...${NC}"
196
- echo -e "${YELLOW}IMPORTANT: Select 'Loopback (127.0.0.1)' for Gateway Bind!${NC}"
197
-
198
- # Run onboarding
199
- openclaw onboard || echo -e "${YELLOW}Onboarding finished or skipped.${NC}"
200
446
 
201
447
  echo -e "\n${GREEN}╔═══════════════════════════════════════════╗${NC}"
202
- echo -e "${GREEN}║ INSTALLATION COMPLETE! ║${NC}"
448
+ echo -e "${GREEN}║ SETUP COMPLETED SUCCESSFULLY! ║${NC}"
203
449
  echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
204
- echo -e "You are now being logged into Ubuntu."
205
- echo -e "Type ${BLUE}openclaw gateway${NC} to start."
206
- EOF
207
-
208
- chmod +x "$INTERNAL_SCRIPT"
209
-
210
- echo -e "\n${BLUE}[6/6]${NC} Entering Ubuntu to finalize setup..."
211
- echo -e "Please wait while we configure the container..."
212
-
213
- # Execute internal script
214
- if ! proot-distro login ubuntu --bind "$TERMUX_HOME":/mnt/termux -- bash /mnt/termux/openclaw_internal_setup.sh; then
215
- echo -e "${YELLOW}Setup script encountered errors but finished.${NC}"
216
- fi
217
-
218
- echo -e "\n${GREEN}Cleaning up...${NC}"
219
- rm -f "$INTERNAL_SCRIPT"
450
+ echo -e "${BLUE}╔═══════════════════════════════════════════╗${NC}"
451
+ echo -e "${BLUE}║ READY TO USE! ║${NC}"
452
+ echo -e "${BLUE}╚═══════════════════════════════════════════╝${NC}"
453
+ echo -e ""
454
+ echo -e "${YELLOW}You can now:${NC}"
455
+ echo -e " 1. ${GREEN}Close and reopen Termux${NC}"
456
+ echo -e " 2. ${GREEN}Run: termux-wake-lock${NC} (prevents background killing)"
457
+ echo -e " 3. ${GREEN}Type: openclaw gateway${NC} (to start the AI gateway)"
458
+ echo -e " 4. ${GREEN}Or type: openclaw --help${NC} (to see all commands)"
459
+ echo -e ""
460
+ echo -e "${YELLOW}From inside Ubuntu, you can also run:${NC}"
461
+ echo -e " - ${BLUE}openclaw onboard${NC} (to configure API keys)"
462
+ echo -e " - ${BLUE}openclaw gateway --verbose${NC} (to start with logs)"
463
+ echo -e ""
464
+ echo -e "${BLUE}Logging you into Ubuntu now...${NC}"
465
+ echo -e "${BLUE}Press Ctrl+D to exit Ubuntu and return to Termux.${NC}"
220
466
 
221
- echo -e "\n${BLUE}Logging you into Ubuntu now...${NC}"
222
467
  exec proot-distro login ubuntu
package/package.json CHANGED
@@ -1,34 +1,36 @@
1
- {
2
- "name": "openclaw-droid",
3
- "version": "3.0.5",
4
- "description": "OpenClaw Droid - Android AI Gateway Installer with proot-distro Ubuntu",
5
- "files": [
6
- "install.sh",
7
- "hijack.js",
8
- "README.md",
9
- "LICENSE"
10
- ],
11
- "keywords": [
12
- "openclaw",
13
- "termux",
14
- "android",
15
- "ai",
16
- "gateway",
17
- "openclaw-droid",
18
- "nosytlabs",
19
- "ai-gateway",
20
- "android-ai",
21
- "termux-ai",
22
- "proot-distro"
23
- ],
24
- "author": "NosytLabs",
25
- "license": "MIT",
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/NosytLabs/openclaw-droid.git"
29
- },
30
- "homepage": "https://github.com/NosytLabs/openclaw-droid#readme",
31
- "bugs": {
32
- "url": "https://github.com/NosytLabs/openclaw-droid/issues"
33
- }
34
- }
1
+ {
2
+ "name": "openclaw-droid",
3
+ "version": "3.15.0",
4
+ "description": "OpenClaw Droid - Android AI Gateway Installer with proot-distro Ubuntu",
5
+ "files": [
6
+ "bin",
7
+ "install.sh",
8
+ "verify.sh",
9
+ "hijack.js",
10
+ "README.md",
11
+ "LICENSE"
12
+ ],
13
+ "keywords": [
14
+ "openclaw",
15
+ "termux",
16
+ "android",
17
+ "ai",
18
+ "gateway",
19
+ "openclaw-droid",
20
+ "nosytlabs",
21
+ "ai-gateway",
22
+ "android-ai",
23
+ "termux-ai",
24
+ "proot-distro"
25
+ ],
26
+ "author": "NosytLabs",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/NosytLabs/openclaw-droid.git"
31
+ },
32
+ "homepage": "https://github.com/NosytLabs/openclaw-droid#readme",
33
+ "bugs": {
34
+ "url": "https://github.com/NosytLabs/openclaw-droid/issues"
35
+ }
36
+ }
package/verify.sh ADDED
@@ -0,0 +1,193 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ RED='\033[0;31m'
5
+ GREEN='\033[0;32m'
6
+ BLUE='\033[0;34m'
7
+ YELLOW='\033[1;33m'
8
+ NC='\033[0m'
9
+
10
+ echo -e "${BLUE}"
11
+ echo "╔═══════════════════════════════════════════╗"
12
+ echo "║ OPENCLAW VERIFICATION TOOL ║"
13
+ echo "║ NosytLabs ║"
14
+ echo "╚═══════════════════════════════════════════╝"
15
+ echo -e "${NC}"
16
+
17
+ if [ -z "$TERMUX_VERSION" ]; then
18
+ if [ -f /etc/os-release ] && grep -qi "ubuntu" /etc/os-release; then
19
+ echo -e "${YELLOW}Running in Ubuntu shell...${NC}"
20
+ else
21
+ echo -e "${RED}Error:${NC} This script must be run in Termux or Ubuntu."
22
+ exit 1
23
+ fi
24
+ else
25
+ echo -e "${YELLOW}Running in Termux shell...${NC}"
26
+ fi
27
+
28
+ TOTAL_CHECKS=0
29
+ PASSED_CHECKS=0
30
+
31
+ check_pass() {
32
+ echo -e " ${GREEN}✓${NC} $1"
33
+ ((PASSED_CHECKS++))
34
+ }
35
+
36
+ check_fail() {
37
+ echo -e " ${RED}✗${NC} $1"
38
+ }
39
+
40
+ check_warn() {
41
+ echo -e " ${YELLOW}⚠${NC} $1"
42
+ }
43
+
44
+ echo -e "\n${BLUE}[1/6]${NC} Checking Termux/Ubuntu environment..."
45
+ ((TOTAL_CHECKS++))
46
+ if [ -n "$TERMUX_VERSION" ]; then
47
+ check_pass "Termux version: $TERMUX_VERSION"
48
+ elif [ -f /etc/os-release ] && grep -qi "ubuntu" /etc/os-release; then
49
+ check_pass "Ubuntu environment detected"
50
+ else
51
+ check_fail "Not running in Termux or Ubuntu"
52
+ fi
53
+
54
+ echo -e "\n${BLUE}[1.5/6]${NC} Checking Termux API..."
55
+ if [ -n "$TERMUX_VERSION" ]; then
56
+ if command -v termux-wake-lock &> /dev/null; then
57
+ check_pass "termux-wake-lock available"
58
+ else
59
+ check_warn "termux-wake-lock not found (Install Termux:API)"
60
+ echo -e " ${YELLOW}Required for preventing background process killing${NC}"
61
+ fi
62
+ fi
63
+
64
+ echo -e "\n${BLUE}[2/6]${NC} Checking proot-distro..."
65
+ ((TOTAL_CHECKS++))
66
+ if [ -n "$TERMUX_VERSION" ]; then
67
+ if command -v proot-distro &> /dev/null; then
68
+ check_pass "proot-distro installed"
69
+ if proot-distro list 2>/dev/null | grep -q "ubuntu.*(installed)"; then
70
+ ((TOTAL_CHECKS++))
71
+ check_pass "Ubuntu container installed"
72
+ else
73
+ ((TOTAL_CHECKS++))
74
+ check_fail "Ubuntu container not installed"
75
+ fi
76
+ else
77
+ check_fail "proot-distro not installed"
78
+ fi
79
+ else
80
+ ((TOTAL_CHECKS++))
81
+ check_pass "Running in Ubuntu container"
82
+ fi
83
+
84
+ echo -e "\n${BLUE}[3/6]${NC} Checking Node.js and npm..."
85
+ ((TOTAL_CHECKS++))
86
+ if command -v node &> /dev/null; then
87
+ NODE_VERSION=$(node -v)
88
+ check_pass "Node.js $NODE_VERSION installed"
89
+ else
90
+ check_fail "Node.js not installed"
91
+ fi
92
+
93
+ ((TOTAL_CHECKS++))
94
+ if command -v npm &> /dev/null; then
95
+ NPM_VERSION=$(npm -v)
96
+ check_pass "npm $NPM_VERSION installed"
97
+ else
98
+ check_fail "npm not installed"
99
+ fi
100
+
101
+ echo -e "\n${BLUE}[4/6]${NC} Checking OpenClaw installation..."
102
+ ((TOTAL_CHECKS++))
103
+ if npm ls -g --depth=0 2>&1 | grep -q "openclaw"; then
104
+ check_pass "OpenClaw in global npm packages"
105
+ else
106
+ check_fail "OpenClaw not installed globally"
107
+ fi
108
+
109
+ ((TOTAL_CHECKS++))
110
+ if [ -n "$TERMUX_VERSION" ]; then
111
+ if [ -x "$PREFIX/bin/openclaw" ]; then
112
+ check_pass "Termux shortcut exists at $PREFIX/bin/openclaw"
113
+ if proot-distro login ubuntu -- /usr/bin/openclaw --help 2>&1 | grep -q "Usage"; then
114
+ ((TOTAL_CHECKS++))
115
+ check_pass "Termux shortcut working"
116
+ else
117
+ ((TOTAL_CHECKS++))
118
+ check_warn "Termux shortcut test inconclusive"
119
+ fi
120
+ else
121
+ check_fail "Termux shortcut not found"
122
+ ((TOTAL_CHECKS++))
123
+ check_fail "Cannot test Termux shortcut"
124
+ fi
125
+ else
126
+ if command -v openclaw &> /dev/null; then
127
+ check_pass "openclaw command available in Ubuntu"
128
+ if openclaw --help 2>&1 | grep -q "Usage"; then
129
+ ((TOTAL_CHECKS++))
130
+ check_pass "openclaw command working"
131
+ else
132
+ ((TOTAL_CHECKS++))
133
+ check_warn "openclaw command test inconclusive"
134
+ fi
135
+ else
136
+ check_fail "openclaw command not found in Ubuntu"
137
+ ((TOTAL_CHECKS++))
138
+ check_fail "Cannot test openclaw command"
139
+ fi
140
+ fi
141
+
142
+ echo -e "\n${BLUE}[5/6]${NC} Checking network bypass..."
143
+ ((TOTAL_CHECKS++))
144
+ if [ -f /root/hijack.js ]; then
145
+ check_pass "Network bypass script exists at /root/hijack.js"
146
+ else
147
+ check_fail "Network bypass script not found"
148
+ fi
149
+
150
+ echo -e "\n${BLUE}[6/6]${NC} Checking environment configuration..."
151
+ ((TOTAL_CHECKS++))
152
+ if [ -n "$TERMUX_VERSION" ]; then
153
+ if grep -q "proot-distro login ubuntu" ~/.bashrc; then
154
+ check_pass "Auto-login configured in ~/.bashrc"
155
+ else
156
+ check_fail "Auto-login not configured"
157
+ fi
158
+ else
159
+ if grep -q "hijack.js" /root/.bashrc; then
160
+ check_pass "NODE_OPTIONS configured in /root/.bashrc"
161
+ else
162
+ check_warn "NODE_OPTIONS not configured in /root/.bashrc"
163
+ fi
164
+ fi
165
+
166
+ echo -e "\n${BLUE}═══════════════════════════════════════════${NC}"
167
+ echo -e "${BLUE}VERIFICATION RESULTS:${NC} ${PASSED_CHECKS}/${TOTAL_CHECKS} checks passed"
168
+ echo -e "${BLUE}═══════════════════════════════════════════${NC}"
169
+
170
+ if [ $PASSED_CHECKS -eq $TOTAL_CHECKS ]; then
171
+ echo -e "\n${GREEN}╔═══════════════════════════════════════════╗${NC}"
172
+ echo -e "${GREEN}║ ALL CHECKS PASSED! OPENCLAW READY TO USE! ║${NC}"
173
+ echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
174
+ echo -e ""
175
+ echo -e "${YELLOW}You can now:${NC}"
176
+ if [ -n "$TERMUX_VERSION" ]; then
177
+ echo -e " ${GREEN}1.${NC} Close and reopen Termux"
178
+ echo -e " ${GREEN}2.${NC} Type: ${BLUE}openclaw${NC} (to use OpenClaw)"
179
+ else
180
+ echo -e " ${GREEN}1.${NC} Type: ${BLUE}openclaw gateway${NC} (to start AI gateway)"
181
+ echo -e " ${GREEN}2.${NC} Type: ${BLUE}openclaw --help${NC} (to see all commands)"
182
+ fi
183
+ echo -e ""
184
+ exit 0
185
+ else
186
+ echo -e "\n${YELLOW}Some checks failed. You may need to:${NC}"
187
+ echo -e " - Run ${BLUE}source ~/.bashrc${NC} to reload environment"
188
+ echo -e " - Run ${BLUE}npm install -g openclaw@latest${NC} to install OpenClaw"
189
+ echo -e " - Run ${BLUE}openclaw onboard${NC} to configure API keys"
190
+ echo -e ""
191
+ echo -e "${YELLOW}For detailed troubleshooting, see README.md${NC}"
192
+ exit 1
193
+ fi