karnel-termux 0.0.1
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/LICENSE +21 -0
- package/README.md +454 -0
- package/install.sh +272 -0
- package/karnel/bin/karnel +77 -0
- package/karnel/cli/commands/brain.sh +1553 -0
- package/karnel/cli/commands/cleanup.sh +66 -0
- package/karnel/cli/commands/doctor.sh +1528 -0
- package/karnel/cli/commands/env.sh +233 -0
- package/karnel/cli/commands/help.sh +8 -0
- package/karnel/cli/commands/ia.sh +502 -0
- package/karnel/cli/commands/init.sh +1274 -0
- package/karnel/cli/commands/install.sh +718 -0
- package/karnel/cli/commands/list.sh +399 -0
- package/karnel/cli/commands/open.sh +106 -0
- package/karnel/cli/commands/pg.sh +719 -0
- package/karnel/cli/commands/reinstall.sh +663 -0
- package/karnel/cli/commands/show.sh +90 -0
- package/karnel/cli/commands/start.sh +54 -0
- package/karnel/cli/commands/status.sh +96 -0
- package/karnel/cli/commands/uninstall.sh +668 -0
- package/karnel/cli/commands/update.sh +723 -0
- package/karnel/cli/commands/upgrade.sh +40 -0
- package/karnel/cli/commands/version.sh +3 -0
- package/karnel/cli/commands/voice.sh +230 -0
- package/karnel/cli/karnel.sh +706 -0
- package/karnel/modules/ai.sh +135 -0
- package/karnel/modules/auto.sh +114 -0
- package/karnel/modules/db.sh +132 -0
- package/karnel/modules/deploy.sh +74 -0
- package/karnel/modules/dev.sh +148 -0
- package/karnel/modules/editor.sh +115 -0
- package/karnel/modules/lang.sh +124 -0
- package/karnel/modules/npm.sh +146 -0
- package/karnel/modules/shell.sh +338 -0
- package/karnel/modules/ui.sh +139 -0
- package/karnel/modules/voice.sh +118 -0
- package/karnel/tools/ai/all.sh +209 -0
- package/karnel/tools/ai/antigravity-cli/README.md +45 -0
- package/karnel/tools/ai/antigravity-cli/bin/agy +28 -0
- package/karnel/tools/ai/antigravity-cli/helper/agy_helper.c +39 -0
- package/karnel/tools/ai/antigravity-cli/install.sh +469 -0
- package/karnel/tools/ai/claude-code/README.md +45 -0
- package/karnel/tools/ai/claude-code/bin/claude +29 -0
- package/karnel/tools/ai/claude-code/helper/claude_helper.c +42 -0
- package/karnel/tools/ai/claude-code/install.sh +278 -0
- package/karnel/tools/ai/cline/install.sh +160 -0
- package/karnel/tools/ai/codegraph/README.md +43 -0
- package/karnel/tools/ai/codegraph/bin/codegraph +5 -0
- package/karnel/tools/ai/codegraph/install.sh +160 -0
- package/karnel/tools/ai/codex/README.md +44 -0
- package/karnel/tools/ai/codex/install.sh +104 -0
- package/karnel/tools/ai/command-code/README.md +62 -0
- package/karnel/tools/ai/command-code/install.sh +136 -0
- package/karnel/tools/ai/crush/README.md +17 -0
- package/karnel/tools/ai/crush/install.sh +89 -0
- package/karnel/tools/ai/ctx7/README.md +26 -0
- package/karnel/tools/ai/ctx7/install.sh +61 -0
- package/karnel/tools/ai/engram/README.md +44 -0
- package/karnel/tools/ai/engram/install.sh +127 -0
- package/karnel/tools/ai/freebuff/README.md +52 -0
- package/karnel/tools/ai/freebuff/bin/freebuff +28 -0
- package/karnel/tools/ai/freebuff/helper/freebuff_helper.c +47 -0
- package/karnel/tools/ai/freebuff/install.sh +303 -0
- package/karnel/tools/ai/gemini-cli/README.md +46 -0
- package/karnel/tools/ai/gemini-cli/install.sh +111 -0
- package/karnel/tools/ai/gentle-ai/README.md +42 -0
- package/karnel/tools/ai/gentle-ai/install.sh +253 -0
- package/karnel/tools/ai/gentle-ai/termux-patches.go +256 -0
- package/karnel/tools/ai/gga/README.md +49 -0
- package/karnel/tools/ai/gga/install.sh +134 -0
- package/karnel/tools/ai/hermes-agent/README.md +50 -0
- package/karnel/tools/ai/hermes-agent/install.sh +120 -0
- package/karnel/tools/ai/kilocode-cli/README.md +45 -0
- package/karnel/tools/ai/kilocode-cli/bin/kilocode +21 -0
- package/karnel/tools/ai/kilocode-cli/helper/kilocode_helper.c +47 -0
- package/karnel/tools/ai/kilocode-cli/install.sh +179 -0
- package/karnel/tools/ai/kimchi-code/README.md +53 -0
- package/karnel/tools/ai/kimchi-code/install.sh +221 -0
- package/karnel/tools/ai/kimi-code/README.md +45 -0
- package/karnel/tools/ai/kimi-code/install.sh +111 -0
- package/karnel/tools/ai/kiro/README.md +17 -0
- package/karnel/tools/ai/kiro/install.sh +134 -0
- package/karnel/tools/ai/mimocode/README.md +43 -0
- package/karnel/tools/ai/mimocode/bin/mimo +28 -0
- package/karnel/tools/ai/mimocode/helper/mimocode_helper.c +47 -0
- package/karnel/tools/ai/mimocode/install.sh +287 -0
- package/karnel/tools/ai/minimax-cli/README.md +45 -0
- package/karnel/tools/ai/minimax-cli/install.sh +111 -0
- package/karnel/tools/ai/mistral-vibe/README.md +46 -0
- package/karnel/tools/ai/mistral-vibe/install.sh +119 -0
- package/karnel/tools/ai/odysseus/README.md +35 -0
- package/karnel/tools/ai/odysseus/install.sh +198 -0
- package/karnel/tools/ai/ollama/README.md +44 -0
- package/karnel/tools/ai/ollama/install.sh +78 -0
- package/karnel/tools/ai/omni-route/README.md +111 -0
- package/karnel/tools/ai/omni-route/install.sh +165 -0
- package/karnel/tools/ai/openclaude/README.md +46 -0
- package/karnel/tools/ai/openclaude/install.sh +110 -0
- package/karnel/tools/ai/openclaw/README.md +47 -0
- package/karnel/tools/ai/openclaw/install.sh +112 -0
- package/karnel/tools/ai/opencode/README.md +51 -0
- package/karnel/tools/ai/opencode/bin/opencode +28 -0
- package/karnel/tools/ai/opencode/helper/opencode_helper.c +57 -0
- package/karnel/tools/ai/opencode/install.sh +290 -0
- package/karnel/tools/ai/openspec/README.md +34 -0
- package/karnel/tools/ai/openspec/install.sh +61 -0
- package/karnel/tools/ai/pi/README.md +46 -0
- package/karnel/tools/ai/pi/install.sh +104 -0
- package/karnel/tools/ai/qwen-code/README.md +45 -0
- package/karnel/tools/ai/qwen-code/install.sh +111 -0
- package/karnel/tools/auto/all.sh +57 -0
- package/karnel/tools/auto/n8n/README.md +47 -0
- package/karnel/tools/auto/n8n/install.sh +102 -0
- package/karnel/tools/db/all.sh +61 -0
- package/karnel/tools/db/mariadb/README.md +43 -0
- package/karnel/tools/db/mariadb/install.sh +65 -0
- package/karnel/tools/db/mongodb/README.md +42 -0
- package/karnel/tools/db/mongodb/install.sh +73 -0
- package/karnel/tools/db/postgresql/README.md +45 -0
- package/karnel/tools/db/postgresql/install.sh +65 -0
- package/karnel/tools/db/redis/README.md +46 -0
- package/karnel/tools/db/redis/install.sh +64 -0
- package/karnel/tools/db/sqlite/README.md +44 -0
- package/karnel/tools/db/sqlite/install.sh +65 -0
- package/karnel/tools/deploy/all.sh +43 -0
- package/karnel/tools/deploy/netlify/install.sh +41 -0
- package/karnel/tools/deploy/railway/install.sh +109 -0
- package/karnel/tools/deploy/vercel/install.sh +43 -0
- package/karnel/tools/dev/all.sh +77 -0
- package/karnel/tools/dev/bat/README.md +44 -0
- package/karnel/tools/dev/bat/install.sh +82 -0
- package/karnel/tools/dev/bc/README.md +44 -0
- package/karnel/tools/dev/bc/install.sh +82 -0
- package/karnel/tools/dev/cloudflared/README.md +43 -0
- package/karnel/tools/dev/cloudflared/install.sh +82 -0
- package/karnel/tools/dev/curl/README.md +43 -0
- package/karnel/tools/dev/curl/install.sh +82 -0
- package/karnel/tools/dev/fzf/README.md +44 -0
- package/karnel/tools/dev/fzf/install.sh +82 -0
- package/karnel/tools/dev/gh/README.md +43 -0
- package/karnel/tools/dev/gh/install.sh +82 -0
- package/karnel/tools/dev/html2text/README.md +44 -0
- package/karnel/tools/dev/html2text/install.sh +82 -0
- package/karnel/tools/dev/imagemagick/README.md +44 -0
- package/karnel/tools/dev/imagemagick/install.sh +82 -0
- package/karnel/tools/dev/jq/README.md +44 -0
- package/karnel/tools/dev/jq/install.sh +82 -0
- package/karnel/tools/dev/lsd/README.md +44 -0
- package/karnel/tools/dev/lsd/install.sh +82 -0
- package/karnel/tools/dev/make/README.md +44 -0
- package/karnel/tools/dev/make/install.sh +82 -0
- package/karnel/tools/dev/ncurses/README.md +42 -0
- package/karnel/tools/dev/ncurses/install.sh +82 -0
- package/karnel/tools/dev/openssh/README.md +43 -0
- package/karnel/tools/dev/openssh/install.sh +75 -0
- package/karnel/tools/dev/proot/README.md +43 -0
- package/karnel/tools/dev/proot/install.sh +82 -0
- package/karnel/tools/dev/shfmt/README.md +44 -0
- package/karnel/tools/dev/shfmt/install.sh +82 -0
- package/karnel/tools/dev/tmate/README.md +44 -0
- package/karnel/tools/dev/tmate/install.sh +82 -0
- package/karnel/tools/dev/tmux/README.md +43 -0
- package/karnel/tools/dev/tmux/install.sh +75 -0
- package/karnel/tools/dev/translate/README.md +44 -0
- package/karnel/tools/dev/translate/install.sh +82 -0
- package/karnel/tools/dev/tree/README.md +44 -0
- package/karnel/tools/dev/tree/install.sh +82 -0
- package/karnel/tools/dev/udocker/README.md +44 -0
- package/karnel/tools/dev/udocker/install.sh +82 -0
- package/karnel/tools/dev/wget/README.md +44 -0
- package/karnel/tools/dev/wget/install.sh +82 -0
- package/karnel/tools/editor/all.sh +59 -0
- package/karnel/tools/editor/code-server/README.md +42 -0
- package/karnel/tools/editor/code-server/install.sh +74 -0
- package/karnel/tools/editor/neovim/README.md +43 -0
- package/karnel/tools/editor/neovim/install.sh +64 -0
- package/karnel/tools/editor/nvchad/README.md +45 -0
- package/karnel/tools/editor/nvchad/install.sh +105 -0
- package/karnel/tools/lang/all.sh +63 -0
- package/karnel/tools/lang/clang/README.md +43 -0
- package/karnel/tools/lang/clang/install.sh +79 -0
- package/karnel/tools/lang/golang/README.md +43 -0
- package/karnel/tools/lang/golang/install.sh +79 -0
- package/karnel/tools/lang/nodejs/README.md +43 -0
- package/karnel/tools/lang/nodejs/install.sh +79 -0
- package/karnel/tools/lang/perl/README.md +43 -0
- package/karnel/tools/lang/perl/install.sh +79 -0
- package/karnel/tools/lang/php/README.md +43 -0
- package/karnel/tools/lang/php/install.sh +79 -0
- package/karnel/tools/lang/python/README.md +43 -0
- package/karnel/tools/lang/python/install.sh +79 -0
- package/karnel/tools/lang/rust/README.md +43 -0
- package/karnel/tools/lang/rust/install.sh +79 -0
- package/karnel/tools/npm/all.sh +90 -0
- package/karnel/tools/npm/live-server/README.md +43 -0
- package/karnel/tools/npm/live-server/install.sh +96 -0
- package/karnel/tools/npm/localtunnel/README.md +43 -0
- package/karnel/tools/npm/localtunnel/install.sh +112 -0
- package/karnel/tools/npm/markserv/README.md +43 -0
- package/karnel/tools/npm/markserv/install.sh +95 -0
- package/karnel/tools/npm/ncu/README.md +43 -0
- package/karnel/tools/npm/ncu/install.sh +95 -0
- package/karnel/tools/npm/nestjs/README.md +43 -0
- package/karnel/tools/npm/nestjs/install.sh +95 -0
- package/karnel/tools/npm/ngrok/README.md +44 -0
- package/karnel/tools/npm/ngrok/install.sh +95 -0
- package/karnel/tools/npm/prettier/README.md +43 -0
- package/karnel/tools/npm/prettier/install.sh +95 -0
- package/karnel/tools/npm/psqlformat/README.md +43 -0
- package/karnel/tools/npm/psqlformat/install.sh +95 -0
- package/karnel/tools/npm/turbopack/README.md +8 -0
- package/karnel/tools/npm/turbopack/install.sh +42 -0
- package/karnel/tools/npm/typescript/README.md +43 -0
- package/karnel/tools/npm/typescript/install.sh +95 -0
- package/karnel/tools/npm/vercel/README.md +43 -0
- package/karnel/tools/npm/vercel/install.sh +95 -0
- package/karnel/tools/shell/all.sh +67 -0
- package/karnel/tools/shell/better-npm/README.md +43 -0
- package/karnel/tools/shell/better-npm/install.sh +85 -0
- package/karnel/tools/shell/fzf-tab/README.md +44 -0
- package/karnel/tools/shell/fzf-tab/install.sh +85 -0
- package/karnel/tools/shell/history-substring/README.md +43 -0
- package/karnel/tools/shell/history-substring/install.sh +85 -0
- package/karnel/tools/shell/powerlevel10k/README.md +43 -0
- package/karnel/tools/shell/powerlevel10k/install.sh +85 -0
- package/karnel/tools/shell/you-should-use/README.md +43 -0
- package/karnel/tools/shell/you-should-use/install.sh +85 -0
- package/karnel/tools/shell/zsh-autopair/README.md +44 -0
- package/karnel/tools/shell/zsh-autopair/install.sh +85 -0
- package/karnel/tools/shell/zsh-autosuggestions/README.md +43 -0
- package/karnel/tools/shell/zsh-autosuggestions/install.sh +85 -0
- package/karnel/tools/shell/zsh-completions/README.md +43 -0
- package/karnel/tools/shell/zsh-completions/install.sh +85 -0
- package/karnel/tools/shell/zsh-defer/README.md +43 -0
- package/karnel/tools/shell/zsh-defer/install.sh +85 -0
- package/karnel/tools/shell/zsh-syntax-highlighting/README.md +43 -0
- package/karnel/tools/shell/zsh-syntax-highlighting/install.sh +72 -0
- package/karnel/tools/ui/all.sh +61 -0
- package/karnel/tools/ui/banner/README.md +42 -0
- package/karnel/tools/ui/banner/install.sh +160 -0
- package/karnel/tools/ui/cursor/README.md +42 -0
- package/karnel/tools/ui/cursor/install.sh +58 -0
- package/karnel/tools/ui/extra-keys/README.md +43 -0
- package/karnel/tools/ui/extra-keys/install.sh +62 -0
- package/karnel/tools/ui/font/README.md +43 -0
- package/karnel/tools/ui/font/install.sh +63 -0
- package/karnel/tools/voice/all.sh +27 -0
- package/karnel/tools/voice/install.sh +10 -0
- package/karnel/tools/voice/uninstall.sh +8 -0
- package/karnel/utils/banner.sh +492 -0
- package/karnel/utils/bootstrap.sh +25 -0
- package/karnel/utils/colors.sh +33 -0
- package/karnel/utils/dialogrc +30 -0
- package/karnel/utils/env.sh +53 -0
- package/karnel/utils/log.sh +567 -0
- package/karnel/utils/version.sh +205 -0
- package/package.json +42 -0
- package/scripts/npm-install.js +60 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Kimchi CLI - Karnel installer
|
|
4
|
+
# Usa o sistema de import padronizado do Karnel (bootstrap.sh)
|
|
5
|
+
import "@/utils/log"
|
|
6
|
+
import "@/utils/colors"
|
|
7
|
+
|
|
8
|
+
export KARNEL_CACHE="${KARNEL_CACHE:-$HOME/.cache/karnel}"
|
|
9
|
+
export PREFIX="${PREFIX:-/data/data/com.termux/files/usr}"
|
|
10
|
+
|
|
11
|
+
LOG_FILE="$KARNEL_CACHE/install_ai.log"
|
|
12
|
+
KIMCHI_DATA_DIR="$HOME/.local/share/karnel-data/kimchi"
|
|
13
|
+
KIMCHI_BIN_PATH="$KIMCHI_DATA_DIR/kimchi"
|
|
14
|
+
|
|
15
|
+
_get_latest_kimchi_version() {
|
|
16
|
+
curl -fsSL https://api.github.com/repos/getkimchi/kimchi/releases/latest 2>/dev/null |
|
|
17
|
+
grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_kimchi_download_binary() {
|
|
21
|
+
loading "Downloading Kimchi CLI" _kimchi_download_binary_impl
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_kimchi_download_binary_impl() {
|
|
25
|
+
local latest_version
|
|
26
|
+
latest_version=$(_get_latest_kimchi_version)
|
|
27
|
+
if [ -z "$latest_version" ]; then
|
|
28
|
+
log_error "Failed to fetch latest Kimchi version"
|
|
29
|
+
return 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
mkdir -p "$KIMCHI_DATA_DIR"
|
|
33
|
+
|
|
34
|
+
local arch
|
|
35
|
+
arch=$(uname -m)
|
|
36
|
+
local kimchi_arch=""
|
|
37
|
+
case "$arch" in
|
|
38
|
+
aarch64|arm64) kimchi_arch="arm64" ;;
|
|
39
|
+
x86_64) kimchi_arch="amd64" ;;
|
|
40
|
+
*) kimchi_arch="arm64" ;;
|
|
41
|
+
esac
|
|
42
|
+
|
|
43
|
+
local tarball="kimchi_linux_${kimchi_arch}.tar.gz"
|
|
44
|
+
local download_url="https://github.com/getkimchi/kimchi/releases/download/${latest_version}/${tarball}"
|
|
45
|
+
|
|
46
|
+
if ! curl -fsSL "$download_url" -o "$KIMCHI_DATA_DIR/$tarball" &>>"$LOG_FILE"; then
|
|
47
|
+
log_error "Failed to download Kimchi binary"
|
|
48
|
+
return 1
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
if ! tar -zxf "$KIMCHI_DATA_DIR/$tarball" -C "$KIMCHI_DATA_DIR" &>>"$LOG_FILE"; then
|
|
52
|
+
log_error "Failed to extract Kimchi binary"
|
|
53
|
+
return 1
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
rm -f "$KIMCHI_DATA_DIR/$tarball"
|
|
57
|
+
|
|
58
|
+
# Find the kimchi binary (may be named kimchi or kimchi-linux-*)
|
|
59
|
+
local kimchi_bin=""
|
|
60
|
+
if [ -f "$KIMCHI_BIN_PATH" ]; then
|
|
61
|
+
kimchi_bin="$KIMCHI_BIN_PATH"
|
|
62
|
+
else
|
|
63
|
+
kimchi_bin=$(find "$KIMCHI_DATA_DIR" -name "kimchi*" -type f -executable 2>/dev/null | head -1)
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
if [ -z "$kimchi_bin" ] || [ ! -f "$kimchi_bin" ]; then
|
|
67
|
+
log_error "Kimchi binary not found after extraction"
|
|
68
|
+
return 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# Rename if needed
|
|
72
|
+
if [ "$kimchi_bin" != "$KIMCHI_BIN_PATH" ]; then
|
|
73
|
+
mv "$kimchi_bin" "$KIMCHI_BIN_PATH"
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
chmod +x "$KIMCHI_BIN_PATH"
|
|
77
|
+
|
|
78
|
+
# Validacao: confirma que o binario existe e e executavel
|
|
79
|
+
if [ ! -x "$KIMCHI_BIN_PATH" ]; then
|
|
80
|
+
log_error "Kimchi binary is not executable after setup"
|
|
81
|
+
return 1
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
return 0
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_install_kimchi_wrapper() {
|
|
88
|
+
loading "Creating Kimchi wrapper" _install_kimchi_wrapper_impl
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
_install_kimchi_wrapper_impl() {
|
|
92
|
+
local wrapper_path="$PREFIX/bin/kimchi"
|
|
93
|
+
|
|
94
|
+
# Cria wrapper com CAMINHO ABSOLUTO para evitar depender de variaveis em runtime.
|
|
95
|
+
# O caminho e resolvido no momento da instalacao (KIMCHI_BIN_PATH = $HOME/.local/share/karnel-data/kimchi/kimchi).
|
|
96
|
+
cat > "$wrapper_path" << WRAPPER
|
|
97
|
+
#!/data/data/com.termux/files/usr/bin/bash
|
|
98
|
+
# Kimchi CLI wrapper — gerado pelo Karnel
|
|
99
|
+
# Caminho absoluto do binario (resolvido na instalacao)
|
|
100
|
+
KIMCHI_BIN="${KIMCHI_BIN_PATH}"
|
|
101
|
+
|
|
102
|
+
if [ "\$#" -eq 0 ]; then
|
|
103
|
+
exec "\$KIMCHI_BIN"
|
|
104
|
+
elif [ "\$1" = "-i" ] || [ "\$1" = "--interactive" ]; then
|
|
105
|
+
# Kimchi nao tem flag -i; modo interativo e o padrao
|
|
106
|
+
exec "\$KIMCHI_BIN"
|
|
107
|
+
else
|
|
108
|
+
exec "\$KIMCHI_BIN" "\$@"
|
|
109
|
+
fi
|
|
110
|
+
WRAPPER
|
|
111
|
+
chmod +x "$wrapper_path"
|
|
112
|
+
|
|
113
|
+
# Valida que o wrapper foi criado corretamente
|
|
114
|
+
if [ ! -f "$wrapper_path" ]; then
|
|
115
|
+
log_error "Failed to create kimchi wrapper at $wrapper_path"
|
|
116
|
+
return 1
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Verifica se o caminho no wrapper esta correto (nao pode ser "/kimchi" na raiz)
|
|
120
|
+
if grep -q 'KIMCHI_BIN="/kimchi"' "$wrapper_path" 2>/dev/null; then
|
|
121
|
+
log_error "Kimchi wrapper has invalid path (/kimchi) — KIMCHI_DATA_DIR was empty"
|
|
122
|
+
rm -f "$wrapper_path"
|
|
123
|
+
return 1
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
# Kimchi é glibc — precisa rodar dentro do proot ubuntu no Termux
|
|
127
|
+
if ! command -v proot-distro &>/dev/null; then
|
|
128
|
+
pkg install proot-distro -y &>>"$LOG_FILE" || true
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
# Rewrite wrapper to use proot-distro
|
|
132
|
+
cat > "$wrapper_path" << 'PROOT_WRAPPER'
|
|
133
|
+
#!/data/data/com.termux/files/usr/bin/bash
|
|
134
|
+
KIMCHI_DIR="/data/data/com.termux/files/home/.local/share/karnel-data/kimchi"
|
|
135
|
+
KIMCHI_BIN="$KIMCHI_DIR/kimchi"
|
|
136
|
+
|
|
137
|
+
ARGS=""
|
|
138
|
+
for arg in "$@"; do
|
|
139
|
+
ARGS="$ARGS '$arg'"
|
|
140
|
+
done
|
|
141
|
+
|
|
142
|
+
exec proot-distro login ubuntu -- bash -c "
|
|
143
|
+
export HOME=/root
|
|
144
|
+
mkdir -p /root/.local/share/kimchi
|
|
145
|
+
cp -r $KIMCHI_DIR/share/kimchi/* /root/.local/share/kimchi/ 2>/dev/null || true
|
|
146
|
+
$KIMCHI_BIN $ARGS
|
|
147
|
+
" 2>&1
|
|
148
|
+
PROOT_WRAPPER
|
|
149
|
+
chmod +x "$wrapper_path"
|
|
150
|
+
|
|
151
|
+
return 0
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
install_kimchi_code() {
|
|
155
|
+
# Verificacao dupla: binario REAL (nao wrapper) + comando no PATH
|
|
156
|
+
if [ -f "$KIMCHI_BIN_PATH" ] && command -v kimchi &>/dev/null; then
|
|
157
|
+
log_info "Kimchi is already installed"
|
|
158
|
+
return 2
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
log_info "Installing Kimchi CLI..."
|
|
162
|
+
|
|
163
|
+
mkdir -p "$(dirname "$LOG_FILE")" "$KIMCHI_DATA_DIR"
|
|
164
|
+
|
|
165
|
+
_kimchi_download_binary || return 1
|
|
166
|
+
_install_kimchi_wrapper || return 1
|
|
167
|
+
|
|
168
|
+
# Validacao final: command -v + verificacao de que nao e stub
|
|
169
|
+
if command -v kimchi &>/dev/null; then
|
|
170
|
+
local bin_path
|
|
171
|
+
bin_path=$(command -v kimchi)
|
|
172
|
+
if [ -f "$bin_path" ] && grep -q "KIMCHI_BIN=" "$bin_path" 2>/dev/null; then
|
|
173
|
+
log_success "Kimchi CLI installed"
|
|
174
|
+
log_info "Usage: ${D_CYAN}kimchi${NC} to launch the interactive TUI"
|
|
175
|
+
log_info "Setup: ${D_CYAN}kimchi setup${NC} for first-time configuration"
|
|
176
|
+
log_info "Docs: ${D_CYAN}https://docs.kimchi.dev${NC}"
|
|
177
|
+
return 0
|
|
178
|
+
fi
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
log_error "Kimchi CLI installation failed: binary not found or invalid"
|
|
182
|
+
rm -f "$PREFIX/bin/kimchi" 2>/dev/null
|
|
183
|
+
return 1
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
uninstall_kimchi_code() {
|
|
187
|
+
log_info "Uninstalling Kimchi CLI..."
|
|
188
|
+
mkdir -p "$(dirname "$LOG_FILE")"
|
|
189
|
+
|
|
190
|
+
rm -f "$PREFIX/bin/kimchi" 2>/dev/null
|
|
191
|
+
rm -rf "$KIMCHI_DATA_DIR" 2>/dev/null
|
|
192
|
+
|
|
193
|
+
log_success "Kimchi CLI uninstalled"
|
|
194
|
+
return 0
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
update_kimchi_code() {
|
|
198
|
+
log_info "Updating Kimchi CLI..."
|
|
199
|
+
mkdir -p "$(dirname "$LOG_FILE")"
|
|
200
|
+
|
|
201
|
+
rm -rf "$KIMCHI_DATA_DIR" 2>/dev/null
|
|
202
|
+
mkdir -p "$KIMCHI_DATA_DIR"
|
|
203
|
+
|
|
204
|
+
_kimchi_download_binary || {
|
|
205
|
+
log_error "Failed to update Kimchi CLI"
|
|
206
|
+
return 1
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
_install_kimchi_wrapper || {
|
|
210
|
+
log_error "Failed to update Kimchi CLI wrapper"
|
|
211
|
+
return 1
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
log_success "Kimchi CLI updated"
|
|
215
|
+
return 0
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
reinstall_kimchi_code() {
|
|
219
|
+
uninstall_kimchi_code
|
|
220
|
+
install_kimchi_code
|
|
221
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Kimi Code
|
|
2
|
+
|
|
3
|
+
Kimi Code CLI — The Starting Point for Next-Gen Agents
|
|
4
|
+
|
|
5
|
+
**Package:** @moonshot-ai/kimi-code
|
|
6
|
+
**Author:** israel marques
|
|
7
|
+
**Repository:** https://github.com/israelmarques1024-dotcom/karnel-termux
|
|
8
|
+
**Official:** https://github.com/MoonshotAI/kimi-code
|
|
9
|
+
**Type:** AI CLI tool (npm global package)
|
|
10
|
+
**License:** MIT
|
|
11
|
+
|
|
12
|
+
# Description
|
|
13
|
+
|
|
14
|
+
Kimi Code CLI is an AI coding agent that runs in your terminal — it can read and edit code, run shell commands, search files, fetch web pages, and choose the next step based on the feedback it receives. It works out of the box with Moonshot AI’s Kimi models and can also be configured to use other compatible providers.
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
- Node.js LTS (nodejs-lts)
|
|
19
|
+
- npm
|
|
20
|
+
- git, ripgrep
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
karnel install ai --kimi-code
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Uninstall
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
karnel uninstall ai --kimi-code
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Update
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
karnel update ai --kimi-code
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
|
|
42
|
+
- Installed as a global npm package: `@moonshot-ai/kimi-code`
|
|
43
|
+
- Command: `kimi`
|
|
44
|
+
- Requires authentication with Kimi API key or OAuth
|
|
45
|
+
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
import "@/utils/log"
|
|
4
|
+
|
|
5
|
+
LOG_FILE="$KARNEL_CACHE/install_ai.log"
|
|
6
|
+
|
|
7
|
+
_kimi_code_dependencies() {
|
|
8
|
+
loading "Installing dependencies" _kimi_code_dependencies_impl
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
_kimi_code_dependencies_impl() {
|
|
12
|
+
declare -A DEPS=(
|
|
13
|
+
["nodejs-lts"]="node"
|
|
14
|
+
["git"]="git"
|
|
15
|
+
["ripgrep"]="rg"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
local pkg_name bin_name
|
|
19
|
+
for pkg_name in "${!DEPS[@]}"; do
|
|
20
|
+
bin_name="${DEPS[$pkg_name]}"
|
|
21
|
+
if ! command -v "$bin_name" &>/dev/null; then
|
|
22
|
+
if ! pkg install "$pkg_name" -y &>>"$LOG_FILE"; then
|
|
23
|
+
log_error "Failed to install $pkg_name"
|
|
24
|
+
return 1
|
|
25
|
+
fi
|
|
26
|
+
fi
|
|
27
|
+
done
|
|
28
|
+
|
|
29
|
+
return 0
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_install_kimi_code_npm() {
|
|
33
|
+
loading "Installing Kimi Code" _install_kimi_code_npm_impl
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_install_kimi_code_npm_impl() {
|
|
37
|
+
if ! npm install -g @moonshot-ai/kimi-code &>>"$LOG_FILE"; then
|
|
38
|
+
log_error "Failed to install Kimi Code"
|
|
39
|
+
return 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
return 0
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
install_kimi_code() {
|
|
46
|
+
if command -v kimi &>/dev/null; then
|
|
47
|
+
log_info "Kimi Code is already installed"
|
|
48
|
+
return 2
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
log_info "Installing Kimi Code..."
|
|
52
|
+
|
|
53
|
+
mkdir -p "$(dirname "$LOG_FILE")"
|
|
54
|
+
|
|
55
|
+
_kimi_code_dependencies || return 1
|
|
56
|
+
_install_kimi_code_npm || return 1
|
|
57
|
+
|
|
58
|
+
log_success "Kimi Code installed successfully"
|
|
59
|
+
return 0
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
uninstall_kimi_code() {
|
|
63
|
+
if ! command -v kimi &>/dev/null; then
|
|
64
|
+
log_success "Kimi Code is not installed"
|
|
65
|
+
return 2
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
log_info "Uninstalling Kimi Code..."
|
|
69
|
+
mkdir -p "$(dirname "$LOG_FILE")"
|
|
70
|
+
|
|
71
|
+
loading "Removing Kimi Code" _uninstall_kimi_code_impl
|
|
72
|
+
|
|
73
|
+
log_success "Kimi Code uninstalled successfully"
|
|
74
|
+
return 0
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_uninstall_kimi_code_impl() {
|
|
78
|
+
if ! npm uninstall -g @moonshot-ai/kimi-code &>>"$LOG_FILE"; then
|
|
79
|
+
log_error "Failed to uninstall Kimi Code"
|
|
80
|
+
return 1
|
|
81
|
+
fi
|
|
82
|
+
return 0
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
update_kimi_code() {
|
|
86
|
+
if ! command -v kimi &>/dev/null; then
|
|
87
|
+
log_error "Kimi Code is not installed"
|
|
88
|
+
return 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
log_info "Updating Kimi Code..."
|
|
92
|
+
mkdir -p "$(dirname "$LOG_FILE")"
|
|
93
|
+
|
|
94
|
+
loading "Updating Kimi Code" _update_kimi_code_impl
|
|
95
|
+
|
|
96
|
+
log_success "Kimi Code updated successfully"
|
|
97
|
+
return 0
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
_update_kimi_code_impl() {
|
|
101
|
+
if ! npm update -g @moonshot-ai/kimi-code &>>"$LOG_FILE"; then
|
|
102
|
+
log_error "Failed to update Kimi Code"
|
|
103
|
+
return 1
|
|
104
|
+
fi
|
|
105
|
+
return 0
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
reinstall_kimi_code() {
|
|
109
|
+
uninstall_kimi_code
|
|
110
|
+
install_kimi_code
|
|
111
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Kiro
|
|
2
|
+
|
|
3
|
+
> AI-powered coding assistant from Amazon/AWS.
|
|
4
|
+
|
|
5
|
+
Kiro is an AI coding assistant that helps with code generation, debugging, and development tasks. It provides an interactive terminal interface with multi-model support.
|
|
6
|
+
|
|
7
|
+
**Install:** `karnel install ai --kiro`
|
|
8
|
+
**Command:** `kiro` or `kiro-cli`
|
|
9
|
+
**Docs:** https://kiro.dev
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- AI-powered code generation and editing
|
|
14
|
+
- Multi-model support
|
|
15
|
+
- Interactive terminal interface
|
|
16
|
+
- Code analysis and debugging
|
|
17
|
+
- Project-aware context
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
import "@/utils/log"
|
|
4
|
+
import "@/utils/colors"
|
|
5
|
+
|
|
6
|
+
LOG_FILE="$KARNEL_CACHE/install_ai.log"
|
|
7
|
+
|
|
8
|
+
install_kiro() {
|
|
9
|
+
if command -v kiro &>/dev/null || command -v kiro-cli &>/dev/null; then
|
|
10
|
+
log_info "Kiro is already installed"
|
|
11
|
+
return 2
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
log_info "Installing Kiro CLI..."
|
|
15
|
+
|
|
16
|
+
# Try the official installer first
|
|
17
|
+
log_info "Running official Kiro installer..."
|
|
18
|
+
if echo "y" | curl -fsSL https://cli.kiro.dev/install 2>/dev/null | bash 2>>"$LOG_FILE"; then
|
|
19
|
+
if command -v kiro &>/dev/null || command -v kiro-cli &>/dev/null; then
|
|
20
|
+
log_success "Kiro installed successfully"
|
|
21
|
+
return 0
|
|
22
|
+
fi
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Fallback: download directly from release server
|
|
26
|
+
log_warn "Official installer failed, trying direct download..."
|
|
27
|
+
|
|
28
|
+
local arch
|
|
29
|
+
arch=$(uname -m)
|
|
30
|
+
local manifest
|
|
31
|
+
manifest=$(curl -fsSL "https://prod.download.cli.kiro.dev/stable/latest/manifest.json" 2>/dev/null)
|
|
32
|
+
|
|
33
|
+
if [[ -z "$manifest" ]]; then
|
|
34
|
+
log_error "Failed to fetch Kiro manifest"
|
|
35
|
+
return 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Find the arm64 linux package (prefer musl for Termux compatibility)
|
|
39
|
+
local download_path
|
|
40
|
+
# Try musl first (statically linked, works without glibc)
|
|
41
|
+
download_path=$(echo "$manifest" | python3 -c "
|
|
42
|
+
import json,sys
|
|
43
|
+
d=json.load(sys.stdin)
|
|
44
|
+
for p in d['packages']:
|
|
45
|
+
if p.get('architecture')=='aarch64' and p.get('os')=='linux' and 'tar' in p.get('fileType','').lower() and 'xz' not in p.get('fileType','').lower() and 'zst' not in p.get('fileType','').lower() and 'musl' in p.get('download',''):
|
|
46
|
+
print(p['download'])
|
|
47
|
+
break
|
|
48
|
+
" 2>/dev/null)
|
|
49
|
+
# Fallback to glibc version
|
|
50
|
+
if [[ -z "$download_path" ]]; then
|
|
51
|
+
download_path=$(echo "$manifest" | python3 -c "
|
|
52
|
+
import json,sys
|
|
53
|
+
d=json.load(sys.stdin)
|
|
54
|
+
for p in d['packages']:
|
|
55
|
+
if p.get('architecture')=='aarch64' and p.get('os')=='linux' and 'tar' in p.get('fileType','').lower() and 'xz' not in p.get('fileType','').lower() and 'zst' not in p.get('fileType','').lower() and 'musl' not in p.get('download',''):
|
|
56
|
+
print(p['download'])
|
|
57
|
+
break
|
|
58
|
+
" 2>/dev/null)
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
if [[ -z "$download_path" ]]; then
|
|
62
|
+
log_error "No compatible package found for $arch"
|
|
63
|
+
return 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
local tmpdir
|
|
67
|
+
tmpdir=$(mktemp -d)
|
|
68
|
+
log_info "Downloading Kiro (this may take a while)..."
|
|
69
|
+
|
|
70
|
+
if curl -fsSL --connect-timeout 15 --max-time 300 \
|
|
71
|
+
"https://prod.download.cli.kiro.dev/stable/$download_path" \
|
|
72
|
+
-o "$tmpdir/kiro.tar.gz" 2>>"$LOG_FILE"; then
|
|
73
|
+
|
|
74
|
+
if tar xzf "$tmpdir/kiro.tar.gz" -C "$tmpdir" 2>>"$LOG_FILE"; then
|
|
75
|
+
local bin_path
|
|
76
|
+
bin_path=$(find "$tmpdir" -name "kiro-cli" -type f -executable 2>/dev/null | head -1)
|
|
77
|
+
if [[ -z "$bin_path" ]]; then
|
|
78
|
+
bin_path=$(find "$tmpdir" -name "kiro*" -type f -executable 2>/dev/null | head -1)
|
|
79
|
+
fi
|
|
80
|
+
if [[ -n "$bin_path" ]]; then
|
|
81
|
+
rm -f "$PREFIX/bin/kiro" "$PREFIX/bin/kiro-cli"
|
|
82
|
+
cp "$bin_path" "$PREFIX/bin/kiro-cli"
|
|
83
|
+
chmod +x "$PREFIX/bin/kiro-cli"
|
|
84
|
+
# Create symlink for convenience
|
|
85
|
+
ln -sf "$PREFIX/bin/kiro-cli" "$PREFIX/bin/kiro"
|
|
86
|
+
rm -rf "$tmpdir"
|
|
87
|
+
if command -v kiro-cli &>/dev/null || command -v kiro &>/dev/null; then
|
|
88
|
+
log_success "Kiro installed from direct download"
|
|
89
|
+
return 0
|
|
90
|
+
fi
|
|
91
|
+
# Binary exists but can't execute (missing glibc)
|
|
92
|
+
if [[ -f "$PREFIX/bin/kiro-cli" ]]; then
|
|
93
|
+
log_warn "Kiro binary installed but requires glibc to run"
|
|
94
|
+
log_info "Install glibc: ${D_CYAN}pkg install glibc-repo glibc${NC}"
|
|
95
|
+
log_info "Or use proot: ${D_CYAN}proot-distro install ubuntu${NC}"
|
|
96
|
+
return 0
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
rm -rf "$tmpdir"
|
|
103
|
+
log_error "Failed to install Kiro"
|
|
104
|
+
log_info "You can try manually: curl -fsSL https://cli.kiro.dev/install | bash"
|
|
105
|
+
return 1
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
uninstall_kiro() {
|
|
109
|
+
if ! command -v kiro &>/dev/null && ! command -v kiro-cli &>/dev/null; then
|
|
110
|
+
log_info "Kiro is not installed"
|
|
111
|
+
return 0
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
log_info "Uninstalling Kiro..."
|
|
115
|
+
rm -f "$PREFIX/bin/kiro" "$PREFIX/bin/kiro-cli"
|
|
116
|
+
log_success "Kiro uninstalled"
|
|
117
|
+
return 0
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
update_kiro() {
|
|
121
|
+
if ! command -v kiro &>/dev/null && ! command -v kiro-cli &>/dev/null; then
|
|
122
|
+
log_info "Kiro is not installed"
|
|
123
|
+
return 0
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
log_info "Updating Kiro..."
|
|
127
|
+
uninstall_kiro
|
|
128
|
+
install_kiro
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
reinstall_kiro() {
|
|
132
|
+
uninstall_kiro
|
|
133
|
+
install_kiro
|
|
134
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# MiMoCode
|
|
2
|
+
|
|
3
|
+
Xiaomi's AI coding agent — fast, local, and open-source
|
|
4
|
+
|
|
5
|
+
**Package:** mimocode
|
|
6
|
+
**Author:** israel marques
|
|
7
|
+
**Repository:** https://github.com/israelmarques1024-dotcom/karnel-termux
|
|
8
|
+
**Official:** https://github.com/XiaomiMiMo/MiMo-Code
|
|
9
|
+
**Type:** AI coding agent (Binary + glibc bootstrapper)
|
|
10
|
+
**License:** MIT
|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
|
|
14
|
+
MiMo Code is Xiaomi's AI coding agent — fast, local, and open-source. It provides intelligent code completion, refactoring suggestions, and natural language code generation directly in your terminal.
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
- glibc-repo, glibc, clang, curl, tar
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
karnel install ai --mimocode
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Uninstall
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
karnel uninstall ai --mimocode
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Update
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
karnel update ai --mimocode
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Notes
|
|
39
|
+
|
|
40
|
+
- Native installation requires `glibc-repo`, `glibc`, `clang`, and other dependencies (installed automatically)
|
|
41
|
+
- The real binary is stored in `~/.local/share/karnel-data/mimocode/`
|
|
42
|
+
- A small C bootstrapper (`mimocode_helper.c`) handles ELF loading via the glibc dynamic linker
|
|
43
|
+
- Data directory: `~/.local/share/karnel-data/mimocode/`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/data/data/com.termux/files/usr/bin/bash
|
|
2
|
+
|
|
3
|
+
UBUNTU_ROOTFS="__UBUNTU_ROOTFS__"
|
|
4
|
+
|
|
5
|
+
EXCLUDE_REGEX="^(PATH|LD_PRELOAD|LD_LIBRARY_PATH|PREFIX|HOME|PWD|OLDPWD|SHELL|IFS|_|SHLVL|PROMPT_COMMAND|TERMCAP|LS_COLORS|TERM)="
|
|
6
|
+
|
|
7
|
+
ENV_ARGS=()
|
|
8
|
+
while IFS= read -r line; do
|
|
9
|
+
if [[ -n "$line" && ! "$line" =~ $EXCLUDE_REGEX ]]; then
|
|
10
|
+
ENV_ARGS+=("--env" "$line")
|
|
11
|
+
fi
|
|
12
|
+
done < <(env)
|
|
13
|
+
|
|
14
|
+
ENV_ARGS+=(
|
|
15
|
+
"--env" "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt"
|
|
16
|
+
"--env" "TERM=$TERM"
|
|
17
|
+
"--env" "HOME=/root"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
unset LD_PRELOAD
|
|
21
|
+
proot-distro login \
|
|
22
|
+
"${ENV_ARGS[@]}" \
|
|
23
|
+
--termux-home \
|
|
24
|
+
--shared-tmp \
|
|
25
|
+
--bind "$UBUNTU_ROOTFS/root/.mimocode:/root/.mimocode" \
|
|
26
|
+
--work-dir "$PWD" \
|
|
27
|
+
ubuntu \
|
|
28
|
+
-- /root/.mimocode/bin/mimo "$@"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#include <stdlib.h>
|
|
2
|
+
#include <unistd.h>
|
|
3
|
+
#include <string.h>
|
|
4
|
+
#include <libgen.h>
|
|
5
|
+
#include <limits.h>
|
|
6
|
+
#include <stdio.h>
|
|
7
|
+
|
|
8
|
+
int main(int argc, char** argv) {
|
|
9
|
+
unsetenv("LD_PRELOAD");
|
|
10
|
+
unsetenv("LD_LIBRARY_PATH");
|
|
11
|
+
|
|
12
|
+
setenv("GODEBUG", "netdns=cgo", 1);
|
|
13
|
+
setenv("SSL_CERT_FILE", "/data/data/com.termux/files/usr/etc/tls/cert.pem", 1);
|
|
14
|
+
|
|
15
|
+
char exec_path[PATH_MAX];
|
|
16
|
+
ssize_t len = readlink("/proc/self/exe", exec_path, sizeof(exec_path) - 1);
|
|
17
|
+
if (len == -1) {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
exec_path[len] = '\0';
|
|
21
|
+
char* dir = dirname(exec_path);
|
|
22
|
+
|
|
23
|
+
char* loader = "/data/data/com.termux/files/usr/glibc/lib/ld-linux-aarch64.so.1";
|
|
24
|
+
char real_bin[] = "/data/data/com.termux/files/home/.local/share/karnel-data/mimocode/mimocode";
|
|
25
|
+
char lib_path[] = "/data/data/com.termux/files/usr/glibc/lib";
|
|
26
|
+
|
|
27
|
+
char** new_argv = malloc((argc + 4) * sizeof(char*));
|
|
28
|
+
if (!new_argv) {
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
new_argv[0] = loader;
|
|
33
|
+
new_argv[1] = "--library-path";
|
|
34
|
+
new_argv[2] = lib_path;
|
|
35
|
+
new_argv[3] = real_bin;
|
|
36
|
+
|
|
37
|
+
for (int i = 1; i < argc; i++) {
|
|
38
|
+
new_argv[i + 3] = argv[i];
|
|
39
|
+
}
|
|
40
|
+
new_argv[argc + 3] = NULL;
|
|
41
|
+
|
|
42
|
+
execv(loader, new_argv);
|
|
43
|
+
|
|
44
|
+
perror("execv");
|
|
45
|
+
free(new_argv);
|
|
46
|
+
return 1;
|
|
47
|
+
}
|