openclaw-droid 3.0.1 → 3.0.2
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 +76 -48
- package/package.json +1 -1
package/install.sh
CHANGED
|
@@ -25,37 +25,36 @@ echo -e "\n${BLUE}[1/6]${NC} Updating Termux packages..."
|
|
|
25
25
|
export DEBIAN_FRONTEND=noninteractive
|
|
26
26
|
|
|
27
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
28
|
if ! pkg update -y -o Dpkg::Options::="--force-confnew" || ! pkg upgrade -y -o Dpkg::Options::="--force-confnew"; then
|
|
30
29
|
echo -e "${YELLOW}Warning: Termux package update had issues.${NC}"
|
|
31
30
|
echo -e "Attempting to proceed. If installation fails, try running 'pkg remove nodejs' manually."
|
|
32
31
|
fi
|
|
33
32
|
|
|
34
33
|
echo -e "\n${BLUE}[2/6]${NC} Installing proot-distro..."
|
|
35
|
-
# Check if proot-distro is already installed to avoid re-installation issues
|
|
36
34
|
if command -v proot-distro &> /dev/null; then
|
|
37
35
|
echo -e " ${GREEN}✓${NC} proot-distro already installed."
|
|
38
36
|
else
|
|
39
37
|
if ! pkg install proot-distro -y; then
|
|
40
38
|
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
|
|
39
|
+
echo -e "${YELLOW}Tip:${NC} Try running 'pkg remove nodejs' if you have dependency conflicts."
|
|
42
40
|
exit 1
|
|
43
41
|
fi
|
|
44
42
|
fi
|
|
45
43
|
|
|
46
|
-
echo -e "\n${BLUE}[3/6]${NC}
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
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..."
|
|
49
48
|
else
|
|
50
49
|
echo -e " ${YELLOW}Installing Ubuntu...${NC}"
|
|
51
50
|
if ! proot-distro install ubuntu; then
|
|
52
51
|
echo -e "${RED}Error:${NC} Failed to install Ubuntu container."
|
|
53
|
-
echo -e "Check your internet connection and disk space."
|
|
54
52
|
exit 1
|
|
55
53
|
fi
|
|
56
54
|
fi
|
|
57
55
|
|
|
58
|
-
echo -e "\n${BLUE}[4/6]${NC} Configuring auto-login..."
|
|
56
|
+
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
|
|
59
58
|
if ! grep -q "proot-distro login ubuntu" ~/.bashrc; then
|
|
60
59
|
echo "proot-distro login ubuntu" >> ~/.bashrc
|
|
61
60
|
echo -e " ${GREEN}✓${NC} Auto-login configured."
|
|
@@ -67,6 +66,7 @@ echo -e "\n${BLUE}[5/6]${NC} Creating internal setup script..."
|
|
|
67
66
|
TERMUX_HOME="$HOME"
|
|
68
67
|
INTERNAL_SCRIPT="$TERMUX_HOME/openclaw_internal_setup.sh"
|
|
69
68
|
|
|
69
|
+
# Create the internal script that runs INSIDE Ubuntu
|
|
70
70
|
cat << 'EOF' > "$INTERNAL_SCRIPT"
|
|
71
71
|
#!/bin/bash
|
|
72
72
|
set -e
|
|
@@ -76,76 +76,104 @@ BLUE='\033[0;34m'
|
|
|
76
76
|
YELLOW='\033[1;33m'
|
|
77
77
|
NC='\033[0m'
|
|
78
78
|
|
|
79
|
-
echo -e "\n${BLUE}[
|
|
79
|
+
echo -e "\n${BLUE}[Internal]${NC} Configuring OpenClaw environment..."
|
|
80
80
|
|
|
81
|
-
#
|
|
81
|
+
# 1. Fix Package Manager
|
|
82
|
+
echo -e "${YELLOW}Updating Ubuntu repositories...${NC}"
|
|
83
|
+
export DEBIAN_FRONTEND=noninteractive
|
|
82
84
|
rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock
|
|
83
85
|
dpkg --configure -a || true
|
|
86
|
+
apt update -y
|
|
87
|
+
apt upgrade -y -o Dpkg::Options::="--force-confnew"
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
apt update && apt upgrade -y -o Dpkg::Options::="--force-confnew"
|
|
88
|
-
|
|
89
|
-
echo -e "\n${YELLOW}Installing dependencies...${NC}"
|
|
89
|
+
# 2. Install Dependencies
|
|
90
|
+
echo -e "${YELLOW}Installing core dependencies...${NC}"
|
|
90
91
|
apt install curl git build-essential -y
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
apt install -y git
|
|
95
|
-
fi
|
|
96
|
-
|
|
97
|
-
if ! command -v git &> /dev/null; then
|
|
98
|
-
echo -e "${RED}Error:${NC} Git is required by npm to install OpenClaw."
|
|
99
|
-
echo -e "${YELLOW}Tip:${NC} Ensure apt is healthy, then run: apt update && apt install -y git"
|
|
100
|
-
exit 1
|
|
101
|
-
fi
|
|
102
|
-
|
|
103
|
-
echo -e "\n${YELLOW}Installing Node.js 22 from NodeSource...${NC}"
|
|
104
|
-
# Check if already installed
|
|
93
|
+
# 3. Install Node.js 22
|
|
94
|
+
echo -e "${YELLOW}Installing Node.js 22...${NC}"
|
|
105
95
|
if ! command -v node &> /dev/null; then
|
|
106
96
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
107
97
|
apt install -y nodejs
|
|
108
98
|
else
|
|
109
|
-
echo -e " ${GREEN}✓${NC} Node.js
|
|
99
|
+
echo -e " ${GREEN}✓${NC} Node.js $(node -v) is installed."
|
|
110
100
|
fi
|
|
111
101
|
|
|
112
|
-
|
|
102
|
+
# 4. Install OpenClaw
|
|
103
|
+
echo -e "${YELLOW}Installing OpenClaw global package...${NC}"
|
|
113
104
|
npm install -g openclaw@latest
|
|
114
105
|
|
|
115
|
-
|
|
116
|
-
|
|
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."
|
|
117
|
+
fi
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
# 5. Create Bionic Bypass (Patch)
|
|
121
|
+
echo -e "${YELLOW}Creating network interface patch (patch.js)...${NC}"
|
|
122
|
+
cat << 'JS' > /root/patch.js
|
|
117
123
|
const os = require('os');
|
|
118
|
-
os.networkInterfaces = ()
|
|
124
|
+
os.networkInterfaces = function() {
|
|
125
|
+
return {
|
|
126
|
+
"lo": [
|
|
127
|
+
{
|
|
128
|
+
"address": "127.0.0.1",
|
|
129
|
+
"netmask": "255.0.0.0",
|
|
130
|
+
"family": "IPv4",
|
|
131
|
+
"mac": "00:00:00:00:00:00",
|
|
132
|
+
"internal": true,
|
|
133
|
+
"cidr": "127.0.0.1/8"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
};
|
|
119
138
|
JS
|
|
120
139
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
140
|
+
# 6. Configure Environment
|
|
141
|
+
echo -e "${YELLOW}Configuring environment variables...${NC}"
|
|
142
|
+
# Add to .bashrc if not present
|
|
143
|
+
if ! grep -q "patch.js" /root/.bashrc; then
|
|
144
|
+
echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.bashrc
|
|
124
145
|
fi
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
echo "source /root/.bashrc" >> /root/.profile
|
|
146
|
+
# Add to .profile for good measure
|
|
147
|
+
if ! grep -q "patch.js" /root/.profile; then
|
|
148
|
+
echo 'export NODE_OPTIONS="--require /root/patch.js"' >> /root/.profile
|
|
129
149
|
fi
|
|
130
150
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
# Apply immediately for this session
|
|
152
|
+
export NODE_OPTIONS="--require /root/patch.js"
|
|
153
|
+
|
|
154
|
+
echo -e "\n${GREEN}Starting OpenClaw Onboarding...${NC}"
|
|
155
|
+
echo -e "${YELLOW}IMPORTANT: Select 'Loopback (127.0.0.1)' for Gateway Bind!${NC}"
|
|
156
|
+
|
|
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.
|
|
159
|
+
openclaw onboard || echo -e "${YELLOW}Onboarding finished or skipped.${NC}"
|
|
135
160
|
|
|
136
161
|
echo -e "\n${GREEN}╔═══════════════════════════════════════════╗${NC}"
|
|
137
162
|
echo -e "${GREEN}║ INSTALLATION COMPLETE! ║${NC}"
|
|
138
163
|
echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
|
|
164
|
+
echo -e "Type ${BLUE}openclaw gateway${NC} to start."
|
|
139
165
|
EOF
|
|
140
166
|
|
|
141
167
|
chmod +x "$INTERNAL_SCRIPT"
|
|
142
168
|
|
|
143
|
-
echo -e "\n${BLUE}Entering Ubuntu
|
|
144
|
-
|
|
145
|
-
|
|
169
|
+
echo -e "\n${BLUE}[6/6]${NC} Entering Ubuntu to finalize setup..."
|
|
170
|
+
echo -e "Please wait while we configure the container..."
|
|
171
|
+
|
|
172
|
+
# Run the internal script inside Ubuntu
|
|
173
|
+
# We bind the home directory to access the script
|
|
146
174
|
proot-distro login ubuntu --bind "$TERMUX_HOME":/mnt/termux -- bash /mnt/termux/openclaw_internal_setup.sh
|
|
147
175
|
|
|
148
|
-
echo -e "\n${GREEN}Cleaning up
|
|
176
|
+
echo -e "\n${GREEN}Cleaning up...${NC}"
|
|
149
177
|
rm -f "$INTERNAL_SCRIPT"
|
|
150
178
|
|
|
151
179
|
echo -e "\n${BLUE}Logging you into Ubuntu now...${NC}"
|