openclaw-droid 3.0.1 → 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.
- package/install.sh +114 -53
- package/package.json +1 -1
package/install.sh
CHANGED
|
@@ -21,41 +21,35 @@ 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
|
-
# We use -o Dpkg::Options::="--force-confnew" to automatically accept new config files
|
|
29
26
|
if ! pkg update -y -o Dpkg::Options::="--force-confnew" || ! pkg upgrade -y -o Dpkg::Options::="--force-confnew"; then
|
|
30
27
|
echo -e "${YELLOW}Warning: Termux package update had issues.${NC}"
|
|
31
|
-
echo -e "Attempting to proceed
|
|
28
|
+
echo -e "Attempting to proceed..."
|
|
32
29
|
fi
|
|
33
30
|
|
|
34
31
|
echo -e "\n${BLUE}[2/6]${NC} Installing proot-distro..."
|
|
35
|
-
# Check if proot-distro is already installed to avoid re-installation issues
|
|
36
32
|
if command -v proot-distro &> /dev/null; then
|
|
37
33
|
echo -e " ${GREEN}✓${NC} proot-distro already installed."
|
|
38
34
|
else
|
|
39
35
|
if ! pkg install proot-distro -y; then
|
|
40
36
|
echo -e "${RED}Error:${NC} Failed to install proot-distro."
|
|
41
|
-
echo -e "${YELLOW}Tip:${NC} Try running 'pkg remove nodejs' if you have dependency conflicts, then run this script again."
|
|
42
37
|
exit 1
|
|
43
38
|
fi
|
|
44
39
|
fi
|
|
45
40
|
|
|
46
|
-
echo -e "\n${BLUE}[3/6]${NC}
|
|
47
|
-
if proot-distro
|
|
48
|
-
echo -e " ${GREEN}✓${NC} Ubuntu container
|
|
41
|
+
echo -e "\n${BLUE}[3/6]${NC} Checking Ubuntu container..."
|
|
42
|
+
if proot-distro list | grep -q "ubuntu (installed)"; then
|
|
43
|
+
echo -e " ${GREEN}✓${NC} Ubuntu container found. Proceeding to configuration..."
|
|
49
44
|
else
|
|
50
45
|
echo -e " ${YELLOW}Installing Ubuntu...${NC}"
|
|
51
46
|
if ! proot-distro install ubuntu; then
|
|
52
47
|
echo -e "${RED}Error:${NC} Failed to install Ubuntu container."
|
|
53
|
-
echo -e "Check your internet connection and disk space."
|
|
54
48
|
exit 1
|
|
55
49
|
fi
|
|
56
50
|
fi
|
|
57
51
|
|
|
58
|
-
echo -e "\n${BLUE}[4/6]${NC} Configuring auto-login..."
|
|
52
|
+
echo -e "\n${BLUE}[4/6]${NC} Configuring auto-login (optional)..."
|
|
59
53
|
if ! grep -q "proot-distro login ubuntu" ~/.bashrc; then
|
|
60
54
|
echo "proot-distro login ubuntu" >> ~/.bashrc
|
|
61
55
|
echo -e " ${GREEN}✓${NC} Auto-login configured."
|
|
@@ -69,83 +63,150 @@ INTERNAL_SCRIPT="$TERMUX_HOME/openclaw_internal_setup.sh"
|
|
|
69
63
|
|
|
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
|
-
echo -e "\n${BLUE}[
|
|
75
|
+
echo -e "\n${BLUE}[Internal]${NC} Configuring OpenClaw environment..."
|
|
80
76
|
|
|
81
|
-
#
|
|
77
|
+
# 1. Fix Package Manager & Clean Environment
|
|
78
|
+
echo -e "${YELLOW}Updating Ubuntu repositories & cleaning up...${NC}"
|
|
79
|
+
export DEBIAN_FRONTEND=noninteractive
|
|
82
80
|
rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock
|
|
83
81
|
dpkg --configure -a || true
|
|
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}"
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
apt
|
|
86
|
+
# 2. Install Dependencies
|
|
87
|
+
echo -e "${YELLOW}Installing core dependencies...${NC}"
|
|
88
|
+
apt install curl git build-essential -y || echo -e "${YELLOW}Warning: Dependencies install had issues...${NC}"
|
|
89
|
+
|
|
90
|
+
# 3. Install Node.js 22
|
|
91
|
+
echo -e "${YELLOW}Checking Node.js...${NC}"
|
|
92
|
+
# Check if node exists and is recent enough?
|
|
93
|
+
if ! command -v node &> /dev/null; then
|
|
94
|
+
echo -e "${YELLOW}Installing Node.js 22...${NC}"
|
|
95
|
+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
96
|
+
apt install -y nodejs
|
|
97
|
+
else
|
|
98
|
+
echo -e " ${GREEN}✓${NC} Node.js $(node -v) is installed."
|
|
99
|
+
fi
|
|
88
100
|
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
# 4. Install OpenClaw
|
|
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
|
|
91
105
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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"
|
|
118
|
+
fi
|
|
95
119
|
fi
|
|
96
120
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
echo
|
|
100
|
-
|
|
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
|
|
101
125
|
fi
|
|
102
126
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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"
|
|
110
138
|
fi
|
|
111
139
|
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
114
155
|
|
|
115
|
-
|
|
116
|
-
|
|
156
|
+
# 6. Create Bionic Bypass (Patch)
|
|
157
|
+
echo -e "${YELLOW}Creating network interface patch (patch.js)...${NC}"
|
|
158
|
+
cat << 'JS' > /root/patch.js
|
|
117
159
|
const os = require('os');
|
|
118
|
-
os.networkInterfaces = ()
|
|
160
|
+
os.networkInterfaces = function() {
|
|
161
|
+
return {
|
|
162
|
+
"lo": [
|
|
163
|
+
{
|
|
164
|
+
"address": "127.0.0.1",
|
|
165
|
+
"netmask": "255.0.0.0",
|
|
166
|
+
"family": "IPv4",
|
|
167
|
+
"mac": "00:00:00:00:00:00",
|
|
168
|
+
"internal": true,
|
|
169
|
+
"cidr": "127.0.0.1/8"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
};
|
|
173
|
+
};
|
|
119
174
|
JS
|
|
120
175
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
176
|
+
# 7. Configure Environment
|
|
177
|
+
echo -e "${YELLOW}Configuring environment variables...${NC}"
|
|
178
|
+
if ! grep -q "patch.js" /root/.bashrc; then
|
|
179
|
+
echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.bashrc
|
|
124
180
|
fi
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if ! grep -q "source /root/.bashrc" /root/.profile 2>/dev/null; then
|
|
128
|
-
echo "source /root/.bashrc" >> /root/.profile
|
|
181
|
+
if ! grep -q "patch.js" /root/.profile; then
|
|
182
|
+
echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.profile
|
|
129
183
|
fi
|
|
184
|
+
export NODE_OPTIONS="--require /root/patch.js"
|
|
185
|
+
|
|
186
|
+
echo -e "\n${GREEN}Starting OpenClaw Onboarding...${NC}"
|
|
187
|
+
echo -e "${YELLOW}IMPORTANT: Select 'Loopback (127.0.0.1)' for Gateway Bind!${NC}"
|
|
130
188
|
|
|
131
|
-
|
|
132
|
-
echo -e "${YELLOW}
|
|
133
|
-
export NODE_OPTIONS="-r /root/hijack.js"
|
|
134
|
-
openclaw onboard || echo -e "${YELLOW}Onboarding skipped or already completed.${NC}"
|
|
189
|
+
# Run onboarding
|
|
190
|
+
openclaw onboard || echo -e "${YELLOW}Onboarding finished or skipped.${NC}"
|
|
135
191
|
|
|
136
192
|
echo -e "\n${GREEN}╔═══════════════════════════════════════════╗${NC}"
|
|
137
193
|
echo -e "${GREEN}║ INSTALLATION COMPLETE! ║${NC}"
|
|
138
194
|
echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
|
|
195
|
+
echo -e "You are now being logged into Ubuntu."
|
|
196
|
+
echo -e "Type ${BLUE}openclaw gateway${NC} to start."
|
|
139
197
|
EOF
|
|
140
198
|
|
|
141
199
|
chmod +x "$INTERNAL_SCRIPT"
|
|
142
200
|
|
|
143
|
-
echo -e "\n${BLUE}Entering Ubuntu
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
201
|
+
echo -e "\n${BLUE}[6/6]${NC} Entering Ubuntu to finalize setup..."
|
|
202
|
+
echo -e "Please wait while we configure the container..."
|
|
203
|
+
|
|
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
|
|
147
208
|
|
|
148
|
-
echo -e "\n${GREEN}Cleaning up
|
|
209
|
+
echo -e "\n${GREEN}Cleaning up...${NC}"
|
|
149
210
|
rm -f "$INTERNAL_SCRIPT"
|
|
150
211
|
|
|
151
212
|
echo -e "\n${BLUE}Logging you into Ubuntu now...${NC}"
|