#!/usr/bin/env bash # MobileGL - tools/anland-mobilegl-plasma/scripts/push-tools.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 # push-tools.sh - install this skill's device- and container-side helpers on the phone. # device/*.sh -> $DEV_TOOLS (run as root: adb shell 'su -c "sh $DEV_TOOLS/.sh"') # container/mgrun -> /usr/local/bin/mgrun # container/kwprep.sh -> /root/kwprep.sh # Needs the container running (its rootfs is mounted at $CT_ROOT only then). # Overwrites same-named files other sessions may be using in $DEV_TOOLS; check first on a shared phone. set -euo pipefail here=$(cd "$(dirname "$0")" && pwd) . "$here/env.sh" adb_ shell "mkdir -p $DEV_TOOLS" for f in "$here"/device/*.sh; do tr -d '\r' < "$f" > "$ANL_DIR/push.tmp" adb_ push "$ANL_DIR/push.tmp" "$DEV_TOOLS/$(basename "$f")" >/dev/null echo "pushed $DEV_TOOLS/$(basename "$f")" done for f in mgrun kwprep.sh; do tr -d '\r' < "$here/container/$f" > "$ANL_DIR/push.tmp" adb_ push "$ANL_DIR/push.tmp" "$DEV_TOOLS/$f" >/dev/null done rm -f "$ANL_DIR/push.tmp" adb_ shell "su -c 'cp $DEV_TOOLS/mgrun $CT_ROOT/usr/local/bin/mgrun && chmod 755 $CT_ROOT/usr/local/bin/mgrun && cp $DEV_TOOLS/kwprep.sh $CT_ROOT/root/kwprep.sh && echo installed mgrun kwprep.sh'"