Skip to content

A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.

1.0 KB
Raw Blame
#!/sbin/openrc-run
description="Podroid VM ready marker (consumed by Android boot detector)"

depend() {
    after podroid-network
    after dropbear *
}

start() {
    # By the time we run, every other service has started (depend: after *).
    # OOM-protect Podroid's infrastructure processes so a hungry user app
    # (Firefox, Chromium, big npm builds, podman pulls) gets reaped first.
    # -1000 makes a process completely immune to OOM. Match by argv[0]
    # basename instead of pidfile to catch all variants (multiple Xvnc
    # screens, forked dropbear instances per SSH session, the agent's
    # listener children).
    for _name in dropbear Xvnc pulseaudio podroid-vsock-agent dnsmasq; do
        for _pid in $(pgrep -x "$_name" 2>/dev/null); do
            echo -1000 > "/proc/$_pid/oom_score_adj" 2>/dev/null
        done
    done

    # Emit the boot stages BootStageDetector expects.
    echo "Starting SSH..." > /dev/console
    echo "Almost ready..." > /dev/console
    echo "Ready!" > /dev/console
    return 0
}

stop() {
    return 0
}