openclaw-droid 3.0.2 → 3.0.5

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 +82 -40
  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,15 +34,22 @@ 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
- if proot-distro list | grep -q "ubuntu (installed)"; then
47
- echo -e " ${GREEN}✓${NC} Ubuntu container found. Proceeding to configuration..."
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
+
47
+ if [ "$UBUNTU_INSTALLED" = "true" ]; then
48
+ if proot-distro login ubuntu -- true 2>/dev/null; then
49
+ echo -e " ${GREEN}✓${NC} Ubuntu is already installed and working. Skipping installation."
50
+ else
51
+ echo -e " ${YELLOW}Ubuntu is already installed but login failed. Continuing setup...${NC}"
52
+ fi
48
53
  else
49
54
  echo -e " ${YELLOW}Installing Ubuntu...${NC}"
50
55
  if ! proot-distro install ubuntu; then
@@ -54,7 +59,6 @@ else
54
59
  fi
55
60
 
56
61
  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
62
  if ! grep -q "proot-distro login ubuntu" ~/.bashrc; then
59
63
  echo "proot-distro login ubuntu" >> ~/.bashrc
60
64
  echo -e " ${GREEN}✓${NC} Auto-login configured."
@@ -66,33 +70,37 @@ echo -e "\n${BLUE}[5/6]${NC} Creating internal setup script..."
66
70
  TERMUX_HOME="$HOME"
67
71
  INTERNAL_SCRIPT="$TERMUX_HOME/openclaw_internal_setup.sh"
68
72
 
69
- # Create the internal script that runs INSIDE Ubuntu
70
73
  cat << 'EOF' > "$INTERNAL_SCRIPT"
71
74
  #!/bin/bash
75
+ # We use set -e to stop on errors, but we will catch them where possible
72
76
  set -e
73
77
 
74
78
  GREEN='\033[0;32m'
75
79
  BLUE='\033[0;34m'
76
80
  YELLOW='\033[1;33m'
81
+ RED='\033[0;31m'
77
82
  NC='\033[0m'
78
83
 
79
84
  echo -e "\n${BLUE}[Internal]${NC} Configuring OpenClaw environment..."
80
85
 
81
- # 1. Fix Package Manager
82
- echo -e "${YELLOW}Updating Ubuntu repositories...${NC}"
86
+ # 1. Fix Package Manager & Clean Environment
87
+ echo -e "${YELLOW}Updating Ubuntu repositories & cleaning up...${NC}"
83
88
  export DEBIAN_FRONTEND=noninteractive
84
89
  rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock
85
90
  dpkg --configure -a || true
86
- apt update -y
87
- apt upgrade -y -o Dpkg::Options::="--force-confnew"
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}"
88
94
 
89
95
  # 2. Install Dependencies
90
96
  echo -e "${YELLOW}Installing core dependencies...${NC}"
91
- apt install curl git build-essential -y
97
+ apt install curl git build-essential -y || echo -e "${YELLOW}Warning: Dependencies install had issues...${NC}"
92
98
 
93
99
  # 3. Install Node.js 22
94
- echo -e "${YELLOW}Installing Node.js 22...${NC}"
100
+ echo -e "${YELLOW}Checking Node.js...${NC}"
101
+ # Check if node exists and is recent enough?
95
102
  if ! command -v node &> /dev/null; then
103
+ echo -e "${YELLOW}Installing Node.js 22...${NC}"
96
104
  curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
97
105
  apt install -y nodejs
98
106
  else
@@ -100,24 +108,61 @@ else
100
108
  fi
101
109
 
102
110
  # 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."
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}"
117
+
118
+ # Determine where npm installs global binaries
119
+ NPM_PREFIX=$(npm prefix -g 2>/dev/null || echo "/usr")
120
+ NPM_BIN="$NPM_PREFIX/bin"
121
+
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"
117
127
  fi
118
128
  fi
119
129
 
120
- # 5. Create Bionic Bypass (Patch)
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
+ 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."
163
+ fi
164
+
165
+ # 6. Create Bionic Bypass (Patch)
121
166
  echo -e "${YELLOW}Creating network interface patch (patch.js)...${NC}"
122
167
  cat << 'JS' > /root/patch.js
123
168
  const os = require('os');
@@ -137,30 +182,26 @@ os.networkInterfaces = function() {
137
182
  };
138
183
  JS
139
184
 
140
- # 6. Configure Environment
185
+ # 7. Configure Environment
141
186
  echo -e "${YELLOW}Configuring environment variables...${NC}"
142
- # Add to .bashrc if not present
143
187
  if ! grep -q "patch.js" /root/.bashrc; then
144
188
  echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.bashrc
145
189
  fi
146
- # Add to .profile for good measure
147
190
  if ! grep -q "patch.js" /root/.profile; then
148
191
  echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.profile
149
192
  fi
150
-
151
- # Apply immediately for this session
152
193
  export NODE_OPTIONS="--require /root/patch.js"
153
194
 
154
195
  echo -e "\n${GREEN}Starting OpenClaw Onboarding...${NC}"
155
196
  echo -e "${YELLOW}IMPORTANT: Select 'Loopback (127.0.0.1)' for Gateway Bind!${NC}"
156
197
 
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.
198
+ # Run onboarding
159
199
  openclaw onboard || echo -e "${YELLOW}Onboarding finished or skipped.${NC}"
160
200
 
161
201
  echo -e "\n${GREEN}╔═══════════════════════════════════════════╗${NC}"
162
202
  echo -e "${GREEN}║ INSTALLATION COMPLETE! ║${NC}"
163
203
  echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
204
+ echo -e "You are now being logged into Ubuntu."
164
205
  echo -e "Type ${BLUE}openclaw gateway${NC} to start."
165
206
  EOF
166
207
 
@@ -169,9 +210,10 @@ chmod +x "$INTERNAL_SCRIPT"
169
210
  echo -e "\n${BLUE}[6/6]${NC} Entering Ubuntu to finalize setup..."
170
211
  echo -e "Please wait while we configure the container..."
171
212
 
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
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
175
217
 
176
218
  echo -e "\n${GREEN}Cleaning up...${NC}"
177
219
  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.5",
4
4
  "description": "OpenClaw Droid - Android AI Gateway Installer with proot-distro Ubuntu",
5
5
  "files": [
6
6
  "install.sh",