openclaw-droid 3.0.2 → 3.0.4

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.

Files changed (2) hide show
  1. package/install.sh +71 -38
  2. package/package.json +1 -1
package/install.sh CHANGED
@@ -21,13 +21,11 @@ if [ -z "$TERMUX_VERSION" ]; then
21
21
  fi
22
22
 
23
23
  echo -e "\n${BLUE}[1/6]${NC} Updating Termux packages..."
24
- # Set non-interactive mode to avoid prompts
25
24
  export DEBIAN_FRONTEND=noninteractive
26
25
 
27
- # Attempt update, but don't exit if it fails (common due to repo mirrors or dependency conflicts)
28
26
  if ! pkg update -y -o Dpkg::Options::="--force-confnew" || ! pkg upgrade -y -o Dpkg::Options::="--force-confnew"; then
29
27
  echo -e "${YELLOW}Warning: Termux package update had issues.${NC}"
30
- echo -e "Attempting to proceed. If installation fails, try running 'pkg remove nodejs' manually."
28
+ echo -e "Attempting to proceed..."
31
29
  fi
32
30
 
33
31
  echo -e "\n${BLUE}[2/6]${NC} Installing proot-distro..."
@@ -36,13 +34,11 @@ if command -v proot-distro &> /dev/null; then
36
34
  else
37
35
  if ! pkg install proot-distro -y; then
38
36
  echo -e "${RED}Error:${NC} Failed to install proot-distro."
39
- echo -e "${YELLOW}Tip:${NC} Try running 'pkg remove nodejs' if you have dependency conflicts."
40
37
  exit 1
41
38
  fi
42
39
  fi
43
40
 
44
41
  echo -e "\n${BLUE}[3/6]${NC} Checking Ubuntu container..."
45
- # We don't skip the setup if it exists; we just ensure it's installed.
46
42
  if proot-distro list | grep -q "ubuntu (installed)"; then
47
43
  echo -e " ${GREEN}✓${NC} Ubuntu container found. Proceeding to configuration..."
48
44
  else
@@ -54,7 +50,6 @@ else
54
50
  fi
55
51
 
56
52
  echo -e "\n${BLUE}[4/6]${NC} Configuring auto-login (optional)..."
57
- # We won't force auto-login if the user doesn't want it, but we'll add it if missing to match user request
58
53
  if ! grep -q "proot-distro login ubuntu" ~/.bashrc; then
59
54
  echo "proot-distro login ubuntu" >> ~/.bashrc
60
55
  echo -e " ${GREEN}✓${NC} Auto-login configured."
@@ -66,33 +61,37 @@ echo -e "\n${BLUE}[5/6]${NC} Creating internal setup script..."
66
61
  TERMUX_HOME="$HOME"
67
62
  INTERNAL_SCRIPT="$TERMUX_HOME/openclaw_internal_setup.sh"
68
63
 
69
- # Create the internal script that runs INSIDE Ubuntu
70
64
  cat << 'EOF' > "$INTERNAL_SCRIPT"
71
65
  #!/bin/bash
66
+ # We use set -e to stop on errors, but we will catch them where possible
72
67
  set -e
73
68
 
74
69
  GREEN='\033[0;32m'
75
70
  BLUE='\033[0;34m'
76
71
  YELLOW='\033[1;33m'
72
+ RED='\033[0;31m'
77
73
  NC='\033[0m'
78
74
 
79
75
  echo -e "\n${BLUE}[Internal]${NC} Configuring OpenClaw environment..."
80
76
 
81
- # 1. Fix Package Manager
82
- echo -e "${YELLOW}Updating Ubuntu repositories...${NC}"
77
+ # 1. Fix Package Manager & Clean Environment
78
+ echo -e "${YELLOW}Updating Ubuntu repositories & cleaning up...${NC}"
83
79
  export DEBIAN_FRONTEND=noninteractive
84
80
  rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock
85
81
  dpkg --configure -a || true
86
- apt update -y
87
- apt upgrade -y -o Dpkg::Options::="--force-confnew"
82
+ # Allow apt update/upgrade to fail without killing the script (e.g. temporary network issues)
83
+ apt update -y || echo -e "${YELLOW}Warning: 'apt update' returned error, proceeding anyway...${NC}"
84
+ apt upgrade -y -o Dpkg::Options::="--force-confnew" || echo -e "${YELLOW}Warning: 'apt upgrade' returned error, proceeding anyway...${NC}"
88
85
 
89
86
  # 2. Install Dependencies
90
87
  echo -e "${YELLOW}Installing core dependencies...${NC}"
91
- apt install curl git build-essential -y
88
+ apt install curl git build-essential -y || echo -e "${YELLOW}Warning: Dependencies install had issues...${NC}"
92
89
 
93
90
  # 3. Install Node.js 22
94
- echo -e "${YELLOW}Installing Node.js 22...${NC}"
91
+ echo -e "${YELLOW}Checking Node.js...${NC}"
92
+ # Check if node exists and is recent enough?
95
93
  if ! command -v node &> /dev/null; then
94
+ echo -e "${YELLOW}Installing Node.js 22...${NC}"
96
95
  curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
97
96
  apt install -y nodejs
98
97
  else
@@ -100,24 +99,61 @@ else
100
99
  fi
101
100
 
102
101
  # 4. Install OpenClaw
103
- echo -e "${YELLOW}Installing OpenClaw global package...${NC}"
104
- npm install -g openclaw@latest
105
-
106
- # Verify installation path
107
- if ! command -v openclaw &> /dev/null; then
108
- echo -e "${YELLOW}Warning: 'openclaw' command not found in PATH.${NC}"
109
- echo -e "Searching for binary..."
110
- POSSIBLE_PATH=$(find / -name openclaw -type l 2>/dev/null | head -n 1)
111
- if [ -n "$POSSIBLE_PATH" ]; then
112
- echo -e "Found at: $POSSIBLE_PATH"
113
- ln -sf "$POSSIBLE_PATH" /usr/bin/openclaw
114
- echo -e "${GREEN}✓${NC} Symlinked to /usr/bin/openclaw"
115
- else
116
- echo -e "${RED}Error:${NC} Could not find openclaw binary. Installation may have failed."
102
+ echo -e "${YELLOW}Installing/Updating OpenClaw global package...${NC}"
103
+ # Use --force to ensure it overwrites if broken
104
+ npm install -g openclaw@latest --force
105
+
106
+ # 5. PATH FIXING
107
+ echo -e "${YELLOW}Fixing 'openclaw' command visibility...${NC}"
108
+
109
+ # Determine where npm installs global binaries
110
+ NPM_PREFIX=$(npm prefix -g 2>/dev/null || echo "/usr")
111
+ NPM_BIN="$NPM_PREFIX/bin"
112
+
113
+ # Fallback check
114
+ if [ ! -d "$NPM_BIN" ]; then
115
+ # Try common locations
116
+ if [ -d "/usr/lib/node_modules/.bin" ]; then
117
+ NPM_BIN="/usr/lib/node_modules/.bin"
117
118
  fi
118
119
  fi
119
120
 
120
- # 5. Create Bionic Bypass (Patch)
121
+ # Ensure it's in PATH
122
+ if [ -d "$NPM_BIN" ] && [[ ":$PATH:" != *":$NPM_BIN:"* ]]; then
123
+ echo "export PATH=\$PATH:$NPM_BIN" >> /root/.bashrc
124
+ echo "export PATH=\$PATH:$NPM_BIN" >> /root/.profile
125
+ fi
126
+
127
+ # Symlink Creation
128
+ BIN_LOCATIONS=("/usr/bin" "/bin" "/usr/local/bin")
129
+ TARGET_BIN=""
130
+
131
+ # Look for the binary
132
+ if [ -f "$NPM_BIN/openclaw" ]; then
133
+ TARGET_BIN="$NPM_BIN/openclaw"
134
+ elif [ -f "$NPM_PREFIX/lib/node_modules/openclaw/bin/openclaw.js" ]; then
135
+ TARGET_BIN="$NPM_PREFIX/lib/node_modules/openclaw/bin/openclaw.js"
136
+ elif [ -f "/usr/lib/node_modules/openclaw/bin/openclaw.js" ]; then
137
+ TARGET_BIN="/usr/lib/node_modules/openclaw/bin/openclaw.js"
138
+ fi
139
+
140
+ if [ -n "$TARGET_BIN" ] && [ -f "$TARGET_BIN" ]; then
141
+ echo -e " Found binary at: $TARGET_BIN"
142
+ chmod +x "$TARGET_BIN"
143
+ for LOC in "${BIN_LOCATIONS[@]}"; do
144
+ if [ -d "$LOC" ]; then
145
+ # Remove existing symlink or file if it exists
146
+ rm -f "$LOC/openclaw"
147
+ ln -s "$TARGET_BIN" "$LOC/openclaw"
148
+ echo -e " Linked to $LOC/openclaw"
149
+ fi
150
+ done
151
+ else
152
+ echo -e "${YELLOW}Warning: Could not locate 'openclaw' binary automatically.${NC}"
153
+ echo -e "You may need to add npm bin to your PATH manually."
154
+ fi
155
+
156
+ # 6. Create Bionic Bypass (Patch)
121
157
  echo -e "${YELLOW}Creating network interface patch (patch.js)...${NC}"
122
158
  cat << 'JS' > /root/patch.js
123
159
  const os = require('os');
@@ -137,30 +173,26 @@ os.networkInterfaces = function() {
137
173
  };
138
174
  JS
139
175
 
140
- # 6. Configure Environment
176
+ # 7. Configure Environment
141
177
  echo -e "${YELLOW}Configuring environment variables...${NC}"
142
- # Add to .bashrc if not present
143
178
  if ! grep -q "patch.js" /root/.bashrc; then
144
179
  echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.bashrc
145
180
  fi
146
- # Add to .profile for good measure
147
181
  if ! grep -q "patch.js" /root/.profile; then
148
182
  echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.profile
149
183
  fi
150
-
151
- # Apply immediately for this session
152
184
  export NODE_OPTIONS="--require /root/patch.js"
153
185
 
154
186
  echo -e "\n${GREEN}Starting OpenClaw Onboarding...${NC}"
155
187
  echo -e "${YELLOW}IMPORTANT: Select 'Loopback (127.0.0.1)' for Gateway Bind!${NC}"
156
188
 
157
- # Run onboarding if user wants, or they can do it later.
158
- # We'll try running it. If it fails (e.g. user cancels), we don't want the script to exit with error.
189
+ # Run onboarding
159
190
  openclaw onboard || echo -e "${YELLOW}Onboarding finished or skipped.${NC}"
160
191
 
161
192
  echo -e "\n${GREEN}╔═══════════════════════════════════════════╗${NC}"
162
193
  echo -e "${GREEN}║ INSTALLATION COMPLETE! ║${NC}"
163
194
  echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
195
+ echo -e "You are now being logged into Ubuntu."
164
196
  echo -e "Type ${BLUE}openclaw gateway${NC} to start."
165
197
  EOF
166
198
 
@@ -169,9 +201,10 @@ chmod +x "$INTERNAL_SCRIPT"
169
201
  echo -e "\n${BLUE}[6/6]${NC} Entering Ubuntu to finalize setup..."
170
202
  echo -e "Please wait while we configure the container..."
171
203
 
172
- # Run the internal script inside Ubuntu
173
- # We bind the home directory to access the script
174
- proot-distro login ubuntu --bind "$TERMUX_HOME":/mnt/termux -- bash /mnt/termux/openclaw_internal_setup.sh
204
+ # Execute internal script
205
+ if ! proot-distro login ubuntu --bind "$TERMUX_HOME":/mnt/termux -- bash /mnt/termux/openclaw_internal_setup.sh; then
206
+ echo -e "${YELLOW}Setup script encountered errors but finished.${NC}"
207
+ fi
175
208
 
176
209
  echo -e "\n${GREEN}Cleaning up...${NC}"
177
210
  rm -f "$INTERNAL_SCRIPT"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-droid",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "OpenClaw Droid - Android AI Gateway Installer with proot-distro Ubuntu",
5
5
  "files": [
6
6
  "install.sh",