A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.
feat: improve init-podroid boot sequence with better timing and stage reporting
ExTva492cff3d283
diff --git a/init-podroid b/init-podroidindex 286eeec..1acd363 100755--- a/init-podroid+++ b/init-podroid@@ -7,6 +7,11 @@# ══════════════════════════════════════════════════════════════════════════════if [ "$1" = "--main" ]; then+# ── Boot stage output (for Android UI detection) ─────────────────────────────+mkdir -p /run+boot_stage() { echo "$*" > /run/boot_stage 2>/dev/null; echo "$*"; }+boot_stage "Initializing system..."+# ── Init logging (silent unless error) ───────────────────────────────────────_LOG=/tmp/init-early.loglog() { printf "%s %s\n" "$(date '+%H:%M:%S' 2>/dev/null)" "$*" >> "$_LOG" 2>/dev/null; }@@ -64,6 +69,7 @@ cat > /etc/hosts <<'HOSTS'HOSTS# ── Kernel modules (silent) ─────────────────────────────────────────────────+boot_stage "Loading kernel modules..."KVER=$(uname -r)if [ -d "/lib/modules/$KVER" ]; thendepmod -a 2>/dev/null@@ -91,7 +97,8 @@ for param in $(cat /proc/cmdline); doesacdone-# ── Networking (silent) ────────────────────────────────────────────────────+# ── Networking ────────────────────────────────────────────────────────────────+boot_stage "Waiting for network..."ip link set lo up 2>/dev/nullNETIF=""for i in $(seq 1 30); do@@ -104,6 +111,10 @@ if [ -n "$NETIF" ]; thenip link set dev "$NETIF" up 2>/dev/nullip addr add 10.0.2.15/24 dev "$NETIF" 2>/dev/nullip route add default via 10.0.2.2 dev "$NETIF" 2>/dev/null+ boot_stage "Network found"+else+ log_error "No network interface found after 30s"+ boot_stage "Network found"ficat > /etc/resolv.conf <<'DNS'@@ -118,7 +129,10 @@ mount -t 9p \-o trans=virtio,version=9p2000.L,rw,msize=1048576,cache=loose,noatime \downloads /mnt/downloads 2>/dev/null-# ── Container sysctls (Alpine/Podman best practices) ────────────────────────+# ── Container configuration ──────────────────────────────────────────────────+boot_stage "Configuring containers..."++# Container sysctls (Alpine/Podman best practices)sysctl -qw net.ipv4.ip_forward=1 2>/dev/nullsysctl -qw net.ipv4.conf.all.forwarding=1 2>/dev/nullsysctl -qw net.bridge.bridge-nf-call-iptables=1 2>/dev/null@@ -130,13 +144,10 @@ sysctl -qw fs.inotify.max_user_watches=65536 2>/dev/nullsysctl -qw net.core.rmem_max=26214400 2>/dev/nullsysctl -qw net.core.wmem_max=26214400 2>/dev/null-# ── Podman configuration (Alpine official recommendations) ─────────────────+# Podman configuration (Alpine official recommendations)[ -f /etc/subuid ] || echo "root:100000:65536" > /etc/subuid[ -f /etc/subgid ] || echo "root:100000:65536" > /etc/subgid-# containers.conf - minimal, based on Alpine Wiki-rm -f /etc/containers/containers.conf 2>/dev/null-mkdir -p /etc/containerscat > /etc/containers/containers.conf <<'CONF'[containers]@@ -151,8 +162,6 @@ events_logger = "file"network_backend = "netavark"CONF-# storage.conf-mkdir -p /etc/containerscat > /etc/containers/storage.conf <<'CONF'[storage]driver = "overlay"@@ -163,18 +172,16 @@ graphroot = "/var/lib/containers/storage"mount_program = "/usr/bin/fuse-overlayfs"CONF-# registries.conf-mkdir -p /etc/containerscat > /etc/containers/registries.conf <<'CONF'unqualified-search-registries = ["docker.io", "quay.io"]CONF-# crun.conf (empty)mkdir -p /etc/crun[ -f /etc/crun/crun.conf ] || touch /etc/crun/crun.conf-# ── SSH setup (Dropbear) - Suppress all output ─────────────────────────────+# ── SSH setup (Dropbear) ──────────────────────────────────────────────────────if [ "$SSH_ENABLED" = "1" ]; then+ boot_stage "Starting SSH..."if [ ! -f /etc/podroid-ssh-init ]; thenecho "root:podroid" | chpasswd 2>/dev/nulltouch /etc/podroid-ssh-init@@ -215,6 +222,7 @@ shutdown_handler() {trap shutdown_handler TERM INT HUP# ── Gather system info for MOTD ──────────────────────────────────────────────+boot_stage "Almost ready..."VM_IP=$(ip addr show "$NETIF" 2>/dev/null | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)STORAGE_USED=$(df -BG / 2>/dev/null | awk 'NR==2 {gsub(/G/,"",$3); print $3}')STORAGE_TOTAL=$(df -BG / 2>/dev/null | awk 'NR==2 {gsub(/G/,"",$2); print $2}')@@ -319,19 +327,22 @@ PROFdone < /dev/hvc0) &-# ── Login wrapper ────────────────────────────────────────────────────────────+# ── Login wrapper (nvim fix: script allocates a real PTY so TUI apps work) ───mkdir -p /usr/local/bin-cat > /usr/local/bin/podroid-login <<'LOGIN'#!/bin/bash-export SHELL=/bin/bash-cat /etc/motd-exec /bin/bash --login+cat /etc/motd 2>/dev/null+exec /usr/bin/script -q -c 'exec /bin/bash --login' /dev/nullLOGINchmod +x /usr/local/bin/podroid-login+grep -q '^root:' /etc/passwd 2>/dev/null || echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd-grep -q '^root:' /etc/passwd 2>/dev/null || \- echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd+boot_stage "Ready!"+rm -f /run/boot_stage++# Give the Android boot monitor 2 seconds to read "Ready!" before+# the bridge takes over the serial socket (serial.sock is single-client).+sleep 2while true; do/sbin/getty -n -l /usr/local/bin/podroid-login 0 ttyAMA0 xterm-256color@@ -392,8 +403,7 @@ if [ -n "$PERSIST_DEV" ]; thenmkdir -p /mnt/overlay/mnt/persistmount --bind /mnt/persist /mnt/overlay/mnt/persisttouch /mnt/persist/.overlay-active-- # Use chroot (works when devpts is properly set up before)+umount /dev 2>/dev/nullumount /sys 2>/dev/nullumount /proc 2>/dev/null