feat(arch): organize ELF binaries into arch/{x86_64,aarch64,armv6l,i386} with bin-env and arch-dispatcher

This commit is contained in:
Kryštof Pešek
2026-11-05 18:02:54 +01:00
parent 45a3731cbc
commit 6322ff9e89
49 changed files with 47 additions and 11 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# =============================================================================
# ~/bin/arch-dispatcher — Universal Architecture Binary Runner
# Dispatches commands to ~/bin/arch/$(uname -m)/<cmd>
# =============================================================================
CMD="$(basename "$0")"
ARCH="$(uname -m)"
TARGET="$HOME/bin/arch/$ARCH/$CMD"
if [ -x "$TARGET" ]; then
exec "$TARGET" "$@"
fi
echo "Error: '$CMD' is not available for architecture '$ARCH' in ~/bin/arch/$ARCH/" >&2
exit 127
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
Executable
BIN
View File
Binary file not shown.
View File
View File
View File
View File
View File
BIN
View File
Binary file not shown.
View File
View File
View File
View File
View File
View File
View File
View File
View File
+17
View File
@@ -0,0 +1,17 @@
# ~/bin/bin-env — Architecture-Aware Fleet Path Setup
# Sourced in ~/.bashrc and ~/.zshrc across t520, bazina, boxC, penguin, phone
_ARCH="$(uname -m)"
if [ -d "$HOME/bin/arch/$_ARCH" ]; then
case ":$PATH:" in
*":$HOME/bin/arch/$_ARCH:"*) ;;
*) export PATH="$HOME/bin/arch/$_ARCH:$PATH" ;;
esac
fi
case ":$PATH:" in
*":$HOME/bin:"*) ;;
*) export PATH="$HOME/bin:$PATH" ;;
esac
unset _ARCH
+15 -11
View File
@@ -2,32 +2,36 @@
# =============================================================================
# ~/bin/otop — Observatoř Top Launcher (Grid Telemetry & Fleet Matrix)
# =============================================================================
ARCH="$(uname -m)"
# 1. Lokální sestavení v observator/otop
# 1. Nativní architektura v ~/bin/arch/$ARCH/otop
if [ -x "$HOME/bin/arch/$ARCH/otop" ]; then
exec "$HOME/bin/arch/$ARCH/otop" "$@"
fi
# 2. Lokální sestavení v observator/otop
if [ -x "$HOME/src/observator/otop/bin/otop" ]; then
exec "$HOME/src/observator/otop/bin/otop" "$@"
fi
# 2. Systémově nainstalovaný otop
# 3. Systémově nainstalovaný otop
if [ -x "/usr/local/bin/otop" ]; then
exec "/usr/local/bin/otop" "$@"
fi
# 3. Stažení binárky pokud chybí
ARCH="$(uname -m)"
# 4. Automatické stažení pro x86_64 pokud chybí
if [ "$ARCH" = "x86_64" ]; then
echo "[otop] Stahuji předkompilovanou binárku otop-x86_64..."
mkdir -p "$HOME/.local/bin"
if curl -sL https://xn--peek-h6a.com/otop-x86_64 -o "$HOME/.local/bin/otop" || curl -sL http://91.139.118.43/otop-x86_64 -o "$HOME/.local/bin/otop"; then
chmod +x "$HOME/.local/bin/otop"
exec "$HOME/.local/bin/otop" "$@"
mkdir -p "$HOME/bin/arch/x86_64"
if curl -sL https://xn--peek-h6a.com/otop-x86_64 -o "$HOME/bin/arch/x86_64/otop" || curl -sL http://91.139.118.43/otop-x86_64 -o "$HOME/bin/arch/x86_64/otop"; then
chmod +x "$HOME/bin/arch/x86_64/otop"
exec "$HOME/bin/arch/x86_64/otop" "$@"
fi
fi
# 4. Fallback na standardní btop
# 5. Fallback na standardní btop
if command -v btop >/dev/null 2>&1; then
exec btop "$@"
fi
echo "Chyba: otop ani btop nebyl nalezen." >&2
echo "Chyba: otop ani btop nebyl nalezen pro architekturu $ARCH." >&2
exit 1