karnel-termux 4.9.3 → 4.9.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.
- package/README.md +6 -6
- package/karnel/cli/commands/brain.sh +9 -2
- package/karnel/cli/commands/list.sh +1 -0
- package/karnel/cli/commands/open.sh +1 -1
- package/karnel/cli/commands/show.sh +7 -1
- package/karnel/cli/commands/voice.sh +2 -2
- package/karnel/modules/voice.sh +1 -1
- package/karnel/tools/ai/antigravity-cli/install.sh +2 -2
- package/karnel/tools/ai/claude-code/install.sh +2 -2
- package/karnel/tools/ai/codegraph/install.sh +1 -1
- package/karnel/tools/ai/engram/install.sh +13 -9
- package/karnel/tools/ai/freebuff/install.sh +2 -2
- package/karnel/tools/ai/gentle-ai/install.sh +1 -1
- package/karnel/tools/ai/hermes-agent/install.sh +4 -1
- package/karnel/tools/ai/kilocode-cli/install.sh +2 -2
- package/karnel/tools/ai/kiro/install.sh +33 -8
- package/karnel/tools/ai/mimocode/install.sh +2 -2
- package/karnel/tools/ai/mistral-vibe/install.sh +1 -1
- package/karnel/tools/ai/omni-route/install.sh +1 -1
- package/karnel/tools/ai/opencode/install.sh +2 -2
- package/karnel/tools/ai/qoder/install.sh +2 -2
- package/karnel/tools/auto/n8n/install.sh +1 -1
- package/karnel/tools/lang/bun/src/bun-shim.c +28 -7
- package/karnel/tools/voice/install.sh +1 -1
- package/karnel/utils/bootstrap.sh +13 -6
- package/karnel/utils/env.sh +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
<a href="https://termux.dev/">
|
|
23
23
|
<img src="https://img.shields.io/badge/platform-Termux%20%7C%20Android-0078D4?style=for-the-badge" alt="Platform">
|
|
24
24
|
</a>
|
|
25
|
-
<a href="https://
|
|
26
|
-
<img src="https://img.shields.io/badge/Site-
|
|
25
|
+
<a href="https://karneltermux.vercel.app">
|
|
26
|
+
<img src="https://img.shields.io/badge/Site-karneltermux.vercel.app-0078D4?style=for-the-badge" alt="Website">
|
|
27
27
|
</a>
|
|
28
28
|
</p>
|
|
29
29
|
|
|
@@ -298,7 +298,7 @@ Microphone -> termux-speech-to-text -> editor (edit) -> clipboard -> AI agent
|
|
|
298
298
|
### Requirements
|
|
299
299
|
|
|
300
300
|
- Termux:API: `pkg install termux-api`
|
|
301
|
-
- App Termux:API: https://
|
|
301
|
+
- App Termux:API: https://karneltermux.vercel.app/termux/api
|
|
302
302
|
- Editor: `karnel install editor`
|
|
303
303
|
|
|
304
304
|
---
|
|
@@ -373,7 +373,7 @@ karnel open db # Open DB module docs
|
|
|
373
373
|
karnel open ai --opencode # Open OpenCode docs on site
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
-
Documentation loads from https://
|
|
376
|
+
Documentation loads from https://karneltermux.vercel.app.
|
|
377
377
|
|
|
378
378
|
---
|
|
379
379
|
|
|
@@ -384,7 +384,7 @@ Documentation loads from https://kerneltermux.vercel.app.
|
|
|
384
384
|
- [Doctor reference](docs/doctor/README.md)
|
|
385
385
|
- [Architecture](docs/ARCHITECTURE.md)
|
|
386
386
|
- [Documentation changelog](docs/CHANGELOG.md)
|
|
387
|
-
- [Official website](https://
|
|
387
|
+
- [Official website](https://karneltermux.vercel.app)
|
|
388
388
|
|
|
389
389
|
---
|
|
390
390
|
|
|
@@ -492,7 +492,7 @@ MIT © Israel Marques
|
|
|
492
492
|
---
|
|
493
493
|
|
|
494
494
|
<p align="center">
|
|
495
|
-
<a href="https://
|
|
495
|
+
<a href="https://karneltermux.vercel.app">
|
|
496
496
|
<img src="https://img.shields.io/badge/Full%20Documentation-0078D4?style=for-the-badge" alt="Documentation">
|
|
497
497
|
</a>
|
|
498
498
|
</p>
|
|
@@ -150,7 +150,11 @@ _brain_pick_file() {
|
|
|
150
150
|
_brain_editor() {
|
|
151
151
|
local title="$1"
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
local editor_bin
|
|
154
|
+
editor_bin="${EDITOR:-nano}"
|
|
155
|
+
editor_bin="${editor_bin%% *}"
|
|
156
|
+
|
|
157
|
+
if ! command -v "$editor_bin" &>/dev/null; then
|
|
154
158
|
log_error "${EDITOR:-nano} not found"
|
|
155
159
|
list_item "Install it: ${D_CYAN}karnel install editor${D_NC}"
|
|
156
160
|
return 1
|
|
@@ -1082,7 +1086,10 @@ brain_edit() {
|
|
|
1082
1086
|
fi
|
|
1083
1087
|
|
|
1084
1088
|
local editor="${EDITOR:-}"
|
|
1085
|
-
|
|
1089
|
+
local editor_bin
|
|
1090
|
+
editor_bin="${EDITOR:-nano}"
|
|
1091
|
+
editor_bin="${editor_bin%% *}"
|
|
1092
|
+
if command -v "$editor_bin" &>/dev/null; then
|
|
1086
1093
|
editor="${EDITOR:-nano}"
|
|
1087
1094
|
elif [[ -z "$editor" ]] || ! command -v "$editor" &>/dev/null; then
|
|
1088
1095
|
for e in vim nano vi; do
|
|
@@ -188,6 +188,7 @@ _list_ai() {
|
|
|
188
188
|
table_row "omniRoute" "--omni-route" "omni-route" "$(_check_cmd "omni-route")"
|
|
189
189
|
table_row "Context7 Docs" "--ctx7" "ctx7" "$(_check_cmd "ctx7")"
|
|
190
190
|
table_row "OpenSpec SDD" "--openspec" "openspec" "$(_check_cmd "openspec")"
|
|
191
|
+
table_row "Qoder" "--qoder" "qodercli" "$(_check_cmd "qodercli")"
|
|
191
192
|
table_row "Copilot-Termux" "--copilot-termux" "copilot" "$(_check_cmd "copilot")"
|
|
192
193
|
table_end
|
|
193
194
|
|
|
@@ -78,7 +78,13 @@ show_main() {
|
|
|
78
78
|
return
|
|
79
79
|
fi
|
|
80
80
|
|
|
81
|
-
local readme_path
|
|
81
|
+
local readme_path
|
|
82
|
+
readme_path="$(realpath "$KARNEL_PATH/tools/$module/$tool/README.md" 2>/dev/null)"
|
|
83
|
+
|
|
84
|
+
if [[ -z "$readme_path" || "$readme_path" != "$KARNEL_PATH/tools/"* ]]; then
|
|
85
|
+
log_error "No documentation found for $module/$tool"
|
|
86
|
+
return 1
|
|
87
|
+
fi
|
|
82
88
|
|
|
83
89
|
if [[ ! -f "$readme_path" ]]; then
|
|
84
90
|
log_error "No documentation found for $module/$tool"
|
|
@@ -47,7 +47,7 @@ voice_help() {
|
|
|
47
47
|
echo
|
|
48
48
|
list_item "Termux:API package: ${D_CYAN}pkg install termux-api${NC}"
|
|
49
49
|
list_item "${EDITOR:-nano} editor: ${D_CYAN}karnel install editor${NC}"
|
|
50
|
-
list_item "Termux:API app: ${D_CYAN}https://
|
|
50
|
+
list_item "Termux:API app: ${D_CYAN}https://karneltermux.vercel.app/termux/api${NC}"
|
|
51
51
|
echo
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -94,7 +94,7 @@ voice_main() {
|
|
|
94
94
|
else
|
|
95
95
|
log_error "Termux:API is not installed"
|
|
96
96
|
list_item "Install the package: ${D_CYAN}pkg install termux-api${NC}"
|
|
97
|
-
list_item "Install the app: https://
|
|
97
|
+
list_item "Install the app: https://karneltermux.vercel.app/termux/api"
|
|
98
98
|
separator
|
|
99
99
|
return 1
|
|
100
100
|
fi
|
package/karnel/modules/voice.sh
CHANGED
|
@@ -35,7 +35,7 @@ install_voice() {
|
|
|
35
35
|
list_item "Termux:API (speech-to-text, clipboard)"
|
|
36
36
|
list_item "Termux:API app (Android APK)"
|
|
37
37
|
list_item "Voice CLI: ${D_CYAN}karnel voice [agent]${NC}"
|
|
38
|
-
list_item "Install Termux:API app from: ${D_CYAN}https://
|
|
38
|
+
list_item "Install Termux:API app from: ${D_CYAN}https://karneltermux.vercel.app/termux/api${NC}"
|
|
39
39
|
echo
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -36,7 +36,7 @@ _antigravity_cli_dependencies_impl() {
|
|
|
36
36
|
fi
|
|
37
37
|
|
|
38
38
|
declare -A DEPS=(
|
|
39
|
-
["clang"]="
|
|
39
|
+
["clang"]="cc"
|
|
40
40
|
["python"]="python"
|
|
41
41
|
["jq"]="jq"
|
|
42
42
|
["curl"]="curl"
|
|
@@ -191,7 +191,7 @@ _antigravity_compile_helper_impl() {
|
|
|
191
191
|
return 1
|
|
192
192
|
fi
|
|
193
193
|
|
|
194
|
-
if !
|
|
194
|
+
if ! cc -O2 -o "$PREFIX/bin/agy" "$HELPER_SRC" &>>"$LOG_FILE"; then
|
|
195
195
|
log_error "Failed to compile agy helper"
|
|
196
196
|
return 1
|
|
197
197
|
fi
|
|
@@ -52,7 +52,7 @@ _claude_install_deps_native_impl() {
|
|
|
52
52
|
fi
|
|
53
53
|
|
|
54
54
|
declare -A DEPS=(
|
|
55
|
-
["clang"]="
|
|
55
|
+
["clang"]="cc"
|
|
56
56
|
["curl"]="curl"
|
|
57
57
|
["tar"]="tar"
|
|
58
58
|
)
|
|
@@ -121,7 +121,7 @@ _compile_claude_helper_impl() {
|
|
|
121
121
|
return 1
|
|
122
122
|
fi
|
|
123
123
|
|
|
124
|
-
if !
|
|
124
|
+
if ! cc -O2 -o "$PREFIX/bin/claude" "$HELPER_SRC" &>>"$LOG_FILE"; then
|
|
125
125
|
log_error "Failed to compile claude helper"
|
|
126
126
|
return 1
|
|
127
127
|
fi
|
|
@@ -108,15 +108,19 @@ update_engram() {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
_update_engram_impl() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
export GOPATH="$HOME/.local/go"
|
|
112
|
+
export GOCACHE="$HOME/.cache/go"
|
|
113
|
+
export GOMODCACHE="$GOPATH/pkg/mod"
|
|
114
|
+
|
|
115
|
+
if ! git -C "$KARNEL_DATA/engram" pull &>>"$LOG_FILE"; then
|
|
116
|
+
log_error "Failed to pull engram repository"
|
|
117
|
+
return 1
|
|
118
|
+
fi
|
|
119
|
+
if ! go build -C "$KARNEL_DATA/engram/cmd/engram" -o "$PREFIX/bin/engram" &>>"$LOG_FILE"; then
|
|
120
|
+
log_error "Failed to build Engram"
|
|
121
|
+
return 1
|
|
122
|
+
fi
|
|
123
|
+
return 0
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
reinstall_engram() {
|
|
@@ -55,7 +55,7 @@ _freebuff_install_deps_native_impl() {
|
|
|
55
55
|
["git"]="git"
|
|
56
56
|
["curl"]="curl"
|
|
57
57
|
["tar"]="tar"
|
|
58
|
-
["clang"]="
|
|
58
|
+
["clang"]="cc"
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
local pkg_name bin_name
|
|
@@ -121,7 +121,7 @@ _compile_freebuff_helper_impl() {
|
|
|
121
121
|
return 1
|
|
122
122
|
fi
|
|
123
123
|
|
|
124
|
-
if !
|
|
124
|
+
if ! cc -O2 -o "$PREFIX/bin/freebuff" "$HELPER_SRC" &>>"$LOG_FILE"; then
|
|
125
125
|
log_error "Failed to compile freebuff helper"
|
|
126
126
|
return 1
|
|
127
127
|
fi
|
|
@@ -31,7 +31,10 @@ _install_hermes_agent_impl() {
|
|
|
31
31
|
if [ -d "$HERMES_DIR/.git" ]; then
|
|
32
32
|
cd "$HERMES_DIR" && git pull
|
|
33
33
|
else
|
|
34
|
-
git clone https://github.com/NousResearch/hermes-agent.git "$HERMES_DIR"
|
|
34
|
+
git clone https://github.com/NousResearch/hermes-agent.git "$HERMES_DIR" || {
|
|
35
|
+
log_error "Failed to clone hermes-agent repository"
|
|
36
|
+
return 1
|
|
37
|
+
}
|
|
35
38
|
fi
|
|
36
39
|
|
|
37
40
|
cd "$HERMES_DIR"
|
|
@@ -35,7 +35,7 @@ _install_kilocode_deps_impl() {
|
|
|
35
35
|
["git"]="git"
|
|
36
36
|
["ripgrep"]="rg"
|
|
37
37
|
["python"]="python"
|
|
38
|
-
["clang"]="
|
|
38
|
+
["clang"]="cc"
|
|
39
39
|
["jq"]="jq"
|
|
40
40
|
["nodejs-lts"]="node"
|
|
41
41
|
["curl"]="curl"
|
|
@@ -105,7 +105,7 @@ _compile_kilocode_helper_impl() {
|
|
|
105
105
|
return 1
|
|
106
106
|
fi
|
|
107
107
|
|
|
108
|
-
if !
|
|
108
|
+
if ! cc -O2 -o "$PREFIX/bin/kilocode" "$HELPER_SRC" &>>"$LOG_FILE"; then
|
|
109
109
|
log_error "Failed to compile kilocode helper"
|
|
110
110
|
return 1
|
|
111
111
|
fi
|
|
@@ -14,12 +14,25 @@ install_kiro() {
|
|
|
14
14
|
|
|
15
15
|
log_info "Installing Kiro CLI..."
|
|
16
16
|
|
|
17
|
+
# Ensure python3 is available (needed for manifest parsing)
|
|
18
|
+
if ! command -v python3 &>/dev/null; then
|
|
19
|
+
if ! yes | pkg install python &>>"$LOG_FILE"; then
|
|
20
|
+
log_error "Failed to install python3 (needed for kiro manifest parsing)"
|
|
21
|
+
return 1
|
|
22
|
+
fi
|
|
23
|
+
fi
|
|
24
|
+
|
|
17
25
|
# Try the official installer first
|
|
18
26
|
log_info "Running official Kiro installer..."
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
local install_script
|
|
28
|
+
install_script=$(curl -fsSL https://cli.kiro.dev/install 2>/dev/null)
|
|
29
|
+
if [[ -n "$install_script" ]]; then
|
|
30
|
+
if echo "y" | bash -s -- <<<"$install_script" 2>>"$LOG_FILE"; then
|
|
31
|
+
hash -r
|
|
32
|
+
if command -v kiro &>/dev/null || command -v kiro-cli &>/dev/null; then
|
|
33
|
+
log_success "Kiro installed successfully"
|
|
34
|
+
return 0
|
|
35
|
+
fi
|
|
23
36
|
fi
|
|
24
37
|
fi
|
|
25
38
|
|
|
@@ -85,16 +98,28 @@ for p in d['packages']:
|
|
|
85
98
|
# Create symlink for convenience
|
|
86
99
|
ln -sf "$PREFIX/bin/kiro-cli" "$PREFIX/bin/kiro"
|
|
87
100
|
rm -rf "$tmpdir"
|
|
101
|
+
hash -r
|
|
88
102
|
if command -v kiro-cli &>/dev/null || command -v kiro &>/dev/null; then
|
|
89
103
|
log_success "Kiro installed from direct download"
|
|
90
104
|
return 0
|
|
91
105
|
fi
|
|
92
106
|
# Binary exists but can't execute (missing glibc)
|
|
93
107
|
if [[ -f "$PREFIX/bin/kiro-cli" ]]; then
|
|
94
|
-
log_warn "Kiro binary
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
log_warn "Kiro binary needs glibc — installing..."
|
|
109
|
+
if [[ ! -f $PREFIX/etc/apt/sources.list.d/glibc.list ]]; then
|
|
110
|
+
yes | pkg install glibc-repo &>>"$LOG_FILE"
|
|
111
|
+
fi
|
|
112
|
+
if [[ ! -f $PREFIX/glibc/lib/libc.so.6 ]]; then
|
|
113
|
+
yes | pkg install glibc &>>"$LOG_FILE"
|
|
114
|
+
fi
|
|
115
|
+
if command -v kiro-cli &>/dev/null || command -v kiro &>/dev/null; then
|
|
116
|
+
log_success "Kiro installed successfully after glibc install"
|
|
117
|
+
return 0
|
|
118
|
+
else
|
|
119
|
+
log_warn "Kiro binary installed but still cannot execute"
|
|
120
|
+
log_info "Try: ${D_CYAN}proot-distro install ubuntu${NC}"
|
|
121
|
+
return 0
|
|
122
|
+
fi
|
|
98
123
|
fi
|
|
99
124
|
fi
|
|
100
125
|
fi
|
|
@@ -33,7 +33,7 @@ _mimocode_install_deps_impl() {
|
|
|
33
33
|
fi
|
|
34
34
|
|
|
35
35
|
declare -A DEPS=(
|
|
36
|
-
["clang"]="
|
|
36
|
+
["clang"]="cc"
|
|
37
37
|
["curl"]="curl"
|
|
38
38
|
["tar"]="tar"
|
|
39
39
|
)
|
|
@@ -102,7 +102,7 @@ _compile_mimocode_helper_impl() {
|
|
|
102
102
|
return 1
|
|
103
103
|
fi
|
|
104
104
|
|
|
105
|
-
if !
|
|
105
|
+
if ! cc -O2 -o "$PREFIX/bin/mimo" "$HELPER_SRC" &>>"$LOG_FILE"; then
|
|
106
106
|
log_error "Failed to compile mimocode helper"
|
|
107
107
|
return 1
|
|
108
108
|
fi
|
|
@@ -42,7 +42,7 @@ _omni_route_apply_platform_fixes() {
|
|
|
42
42
|
log_info "Termux/Android detected — applying native build fixes for omniRoute..."
|
|
43
43
|
|
|
44
44
|
local ng="/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
|
|
45
|
-
if [ -x "$ng" ] && command -v
|
|
45
|
+
if [ -x "$ng" ] && command -v cc >/dev/null 2>&1; then
|
|
46
46
|
for mod in better-sqlite3 sqlite-vec; do
|
|
47
47
|
local moddir="$pkg_root/node_modules/$mod"
|
|
48
48
|
[ -d "$moddir" ] || continue
|
|
@@ -55,7 +55,7 @@ _opencode_install_deps_native_impl() {
|
|
|
55
55
|
["git"]="git"
|
|
56
56
|
["ripgrep"]="rg"
|
|
57
57
|
["python"]="python"
|
|
58
|
-
["clang"]="
|
|
58
|
+
["clang"]="cc"
|
|
59
59
|
["jq"]="jq"
|
|
60
60
|
["nodejs-lts"]="node"
|
|
61
61
|
["curl"]="curl"
|
|
@@ -125,7 +125,7 @@ _compile_opencode_helper_impl() {
|
|
|
125
125
|
return 1
|
|
126
126
|
fi
|
|
127
127
|
|
|
128
|
-
if !
|
|
128
|
+
if ! cc -O2 -o "$PREFIX/bin/opencode" "$HELPER_SRC" &>>"$LOG_FILE"; then
|
|
129
129
|
log_error "Failed to compile opencode helper"
|
|
130
130
|
return 1
|
|
131
131
|
fi
|
|
@@ -65,7 +65,7 @@ _qoder_install_deps_native_impl() {
|
|
|
65
65
|
declare -A DEPS=(
|
|
66
66
|
["git"]="git"
|
|
67
67
|
["ripgrep"]="rg"
|
|
68
|
-
["clang"]="
|
|
68
|
+
["clang"]="cc"
|
|
69
69
|
["jq"]="jq"
|
|
70
70
|
["nodejs-lts"]="node"
|
|
71
71
|
["curl"]="curl"
|
|
@@ -142,7 +142,7 @@ _compile_qoder_helper_impl() {
|
|
|
142
142
|
return 1
|
|
143
143
|
fi
|
|
144
144
|
|
|
145
|
-
if !
|
|
145
|
+
if ! cc -O2 -o "$PREFIX/bin/qodercli" "$HELPER_SRC" &>>"$LOG_FILE"; then
|
|
146
146
|
log_error "Failed to compile qoder helper"
|
|
147
147
|
return 1
|
|
148
148
|
fi
|
|
@@ -240,14 +240,15 @@ int access(const char *p, int mode) {
|
|
|
240
240
|
ssize_t readlinkat(int dirfd, const char *path, char *buf, size_t bufsiz) {
|
|
241
241
|
if (path && streq(path, "/proc/self/exe")) {
|
|
242
242
|
int len = slen(wrapper_path);
|
|
243
|
-
|
|
243
|
+
int to_copy = len < (int)bufsiz ? len : (int)bufsiz - 1;
|
|
244
|
+
if (to_copy > 0) {
|
|
244
245
|
char *d = buf;
|
|
245
246
|
const char *s = wrapper_path;
|
|
246
|
-
|
|
247
|
+
for (int i = 0; i < to_copy; i++)
|
|
247
248
|
*d++ = *s++;
|
|
248
249
|
*d = '\0';
|
|
249
250
|
}
|
|
250
|
-
return
|
|
251
|
+
return to_copy > 0 ? to_copy : 0;
|
|
251
252
|
}
|
|
252
253
|
return (ssize_t)SREADLINKAT(dirfd, path, buf, bufsiz);
|
|
253
254
|
}
|
|
@@ -270,9 +271,14 @@ ssize_t readlinkat(int dirfd, const char *path, char *buf, size_t bufsiz) {
|
|
|
270
271
|
* bionic binaries. We use --library-path/--preload for glibc binaries instead.
|
|
271
272
|
* Returns pointer to static buffer. */
|
|
272
273
|
static char **strip_glibc_env(char *const envp[]) {
|
|
273
|
-
|
|
274
|
+
int count = 0;
|
|
275
|
+
while (envp[count])
|
|
276
|
+
count++;
|
|
277
|
+
static char *clean[4096];
|
|
278
|
+
if (count > 4095)
|
|
279
|
+
count = 4095;
|
|
274
280
|
int j = 0;
|
|
275
|
-
for (int i = 0; envp[i] && j <
|
|
281
|
+
for (int i = 0; envp[i] && j < count; i++) {
|
|
276
282
|
const char *e = envp[i];
|
|
277
283
|
/* Skip LD_LIBRARY_PATH=* */
|
|
278
284
|
if (e[0] == 'L' && e[1] == 'D' && e[2] == '_' && e[3] == 'L' &&
|
|
@@ -301,7 +307,9 @@ int execve(const char *pathname, char *const argv[], char *const envp[]) {
|
|
|
301
307
|
while (argv[argc])
|
|
302
308
|
argc++;
|
|
303
309
|
|
|
304
|
-
|
|
310
|
+
if (argc + 7 > 1024)
|
|
311
|
+
goto fallback;
|
|
312
|
+
char *new_argv[1024];
|
|
305
313
|
int i = 0;
|
|
306
314
|
new_argv[i++] = (char *)pathname;
|
|
307
315
|
new_argv[i++] = "--library-path";
|
|
@@ -331,7 +339,9 @@ int execve(const char *pathname, char *const argv[], char *const envp[]) {
|
|
|
331
339
|
while (argv[argc])
|
|
332
340
|
argc++;
|
|
333
341
|
|
|
334
|
-
|
|
342
|
+
if (argc + 8 > 1024)
|
|
343
|
+
goto fallback;
|
|
344
|
+
char *new_argv[1024];
|
|
335
345
|
int i = 0;
|
|
336
346
|
new_argv[i++] = (char *)ld_path;
|
|
337
347
|
new_argv[i++] = "--library-path";
|
|
@@ -349,4 +359,15 @@ int execve(const char *pathname, char *const argv[], char *const envp[]) {
|
|
|
349
359
|
|
|
350
360
|
errno = err;
|
|
351
361
|
return -1;
|
|
362
|
+
|
|
363
|
+
fallback:
|
|
364
|
+
/* If argv was too large for our static buffer, try the original execve */
|
|
365
|
+
r = SEXECVE(pathname, argv, clean_env);
|
|
366
|
+
if (r >= 0)
|
|
367
|
+
return (int)r;
|
|
368
|
+
r = SEXECVE(pathname, argv, envp);
|
|
369
|
+
if (r >= 0)
|
|
370
|
+
return (int)r;
|
|
371
|
+
errno = (int)(-r);
|
|
372
|
+
return -1;
|
|
352
373
|
}
|
|
@@ -5,6 +5,6 @@ import "@/utils/log"
|
|
|
5
5
|
_install_voice_tool() {
|
|
6
6
|
log_info "All voice dependencies are managed by Termux:API"
|
|
7
7
|
log_info "To use voice, install the Termux:API app from:"
|
|
8
|
-
log_info " https://
|
|
8
|
+
log_info " https://karneltermux.vercel.app/termux/api"
|
|
9
9
|
return 0
|
|
10
10
|
}
|
|
@@ -9,17 +9,24 @@ declare -A __KARNEL_IMPORTED
|
|
|
9
9
|
|
|
10
10
|
import() {
|
|
11
11
|
local base="${KARNEL_PATH}"
|
|
12
|
-
local
|
|
12
|
+
local resolved="${1//@/$base}.sh"
|
|
13
|
+
local canonical
|
|
14
|
+
canonical="$(realpath "$resolved" 2>/dev/null || echo "$resolved")"
|
|
13
15
|
|
|
14
|
-
if [[
|
|
16
|
+
if [[ "$canonical" != "$base"/* ]]; then
|
|
17
|
+
echo "karnel: import error: path traversal denied: $1" >&2
|
|
18
|
+
return 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if [[ -n "${__KARNEL_IMPORTED[$canonical]}" ]]; then
|
|
15
22
|
return
|
|
16
23
|
fi
|
|
17
24
|
|
|
18
|
-
if [[ ! -f "$
|
|
19
|
-
echo "karnel: import error: $
|
|
25
|
+
if [[ ! -f "$canonical" ]]; then
|
|
26
|
+
echo "karnel: import error: $canonical not found" >&2
|
|
20
27
|
return 1
|
|
21
28
|
fi
|
|
22
29
|
|
|
23
|
-
__KARNEL_IMPORTED[$
|
|
24
|
-
source "$
|
|
30
|
+
__KARNEL_IMPORTED[$canonical]=1
|
|
31
|
+
source "$canonical"
|
|
25
32
|
}
|
package/karnel/utils/env.sh
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "karnel-termux",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.5",
|
|
4
4
|
"description": "Modular Dev Environment for Termux — install languages, databases, AI agents, editors, and more with one command",
|
|
5
5
|
"bin": {
|
|
6
6
|
"karnel": "karnel/bin/karnel"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://github.com/israelmarques1024-dotcom/karnel-termux/issues"
|
|
42
42
|
},
|
|
43
|
-
"homepage": "https://
|
|
43
|
+
"homepage": "https://karneltermux.vercel.app",
|
|
44
44
|
"os": [
|
|
45
45
|
"android"
|
|
46
46
|
]
|