#!/usr/bin/env bash # MobileGL - tools/anland-mobilegl-plasma/scripts/ct.sh # Copyright (c) 2025-2026 MobileGL-Dev # Licensed under the GNU Lesser General Public License v3.0: # https://www.gnu.org/licenses/gpl-3.0.txt # https://www.gnu.org/licenses/lgpl-3.0.txt # SPDX-License-Identifier: LGPL-3.0-only # End of Source File Header # ct.sh [script-file] - run a bash script as ROOT inside the container (login shell), # reading the script from the file or from stdin. Generic form of the old c.sh/c2.sh/c3.sh. # # printf '%s\n' 'ls -la /tmp/*.log' | bash ct.sh mychan # bash ct.sh mychan ./something.cmd # # How: the script is written to $ANL_DIR/.cmd, pushed to $DEV_TOOLS/.cmd together with # a one-line .sh that does `droidspaces --name= run bash -lc "$(cat .cmd)"`, # and that runs under `su`. Quoting through adb + su + droidspaces is thereby avoided entirely. # # Pick a channel name of your own: other sessions on the same phone use c, c2, c3, xd, xr, gbm...; # writing to their channel files races with them. CR characters are stripped (Windows checkouts). # Inside, run user-side commands with `sudo -u env XDG_RUNTIME_DIR=/run/user/ ...`. # Never `pkill -f ` in a channel script: the `bash -lc "