#!/bin/sh

mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t devtmpfs devtmpfs /dev

if [ -f /opt/kernel/neurotron/neurotron_main.py ]; then
    export PYTHONHOME=/usr
    export PYTHONPATH=/usr/lib/python3.13:/usr/lib/python3.13/site-packages
    export PATH=/sbin:/bin:/usr/sbin:/usr/bin

    echo '👉 Inicializando hipocampo físico...'
    /usr/bin/python3 /opt/kernel/neurotron/neurotron_core/disk_init.py

    echo '👉 Inicializando o Neurotron...'
    /usr/bin/python3 /opt/kernel/neurotron/neurotron_main.py || echo "⚠️ Neurotron falhou" &

    sleep 5

    echo '👉 Inicializando Painel de Telemetria do Neurotron...'
    /usr/bin/python3 /opt/kernel/neurotron/neurotron_core/telemetry_tail.py
else
    echo '⚙️  BusyBox ativo — Neurotron ausente.'
fi

exec /bin/sh
