Git Product home page Git Product logo

adb-scrcpy-scripts's Introduction

adb-scrcpy-scripts

Bash scripts for Android screen control in a Linux Deploy "chroot".

With code saved in folder "~/adb-scrcpy-scripts"...

Copy file to Termux shortcuts, set permissions

File "TERMUX_STOP_scrcpy_in_Linux_script.sh":

  1. ... platform-tools/adb push ~/adb-scrcpy-scripts/TERMUX_STOP_scrcpy_in_Linux_script.sh /sdcard/TERMUX_STOP_scrcpy_in_Linux_script.sh
  2. https://wiki.termux.com/wiki/Internal_and_external_storage
  3. Termux: mv ~/storage/shared/TERMUX_STOP_scrcpy_in_Linux_script.sh ~/.shortcuts/TERMUX_STOP_scrcpy_in_Linux_script.sh
  4. Termux: chmod +rwx ~/.shortcuts/TERMUX_STOP_scrcpy_in_Linux_script.sh

and do that for "TERMUX_scrcpy_in_Linux_script.sh".

adb and scrcpy in a Linux Deploy container

(profile: "linux", Mounts + GUI + X11 subsystem enabled in "Properties" -> new mounts: "/system/xbin/" > "/system/xbin/", "/data/local/tmp/" > "/data-tmp/", "/sdcard/" > "/sdcard/", update Settings > PATH variable "/system/xbin",
https://github.com/meefik/linuxdeploy#faq, mkdir /data/local/mnt/etc/ if it doesn't exist)

... platform-tools/adb shell                                           # remote device shell
  su                                                                     # root login
    /data/data/ru.meefik.linuxdeploy/files/bin/linuxdeploy -p linux shell  # container root login
      uname -m                                                               # the machine hardware name
      exit

    # If hardware name is "aarch64", replace BusyBox package with apt package:
    mount -o rw,remount /system 2>/dev/null || mount -o rw,remount / 2>/dev/null
    rm /system/xbin/ar

    exit
  exit

If the machine hardware is "x86_64": https://developer.android.com/studio/releases/platform-tools#downloads,
copy that "platform-tools" folder to $HOME, ... platform-tools/adb push ~/platform-tools /sdcard/platform-tools

  1. ... platform-tools/adb push ~/adb-scrcpy-scripts/add_to_container.sh /sdcard/add_to_container.sh
  2. ... platform-tools/adb shell
  3. su --command "cat /sdcard/add_to_container.sh > /data/local/tmp/add_to_container.sh && /data/data/ru.meefik.linuxdeploy/files/bin/linuxdeploy -p linux shell"
    • bash -c ". /data-tmp/add_to_container.sh [that hardware name]"
    • exit
  4. su --command "rm /data/local/tmp/add_to_container.sh"
...
$ exit
... platform-tools/adb push ~/adb-scrcpy-scripts/LINUX_CONTAINER/ /sdcard/
... platform-tools/adb shell                                           # remote device shell
  su                                                                     # root login
    /data/data/ru.meefik.linuxdeploy/files/bin/linuxdeploy -p linux shell  # container root login
      sudo -u android bash -c 'mv /sdcard/LINUX_CONTAINER/ ~/Desktop/'
      readarray -t files <<<"$(ls /home/android/Desktop/LINUX_CONTAINER/ | sed -E '/.+\.[^s][^h].*/d')";\
        declare -p files;
      for (( i=0 ; i < ${#files[*]} ; ++i )); do chmod u+x "/home/android/Desktop/LINUX_CONTAINER/${files[$i]}"; \
        /bin/chown android "/home/android/Desktop/LINUX_CONTAINER/${files[$i]}"; done
      exit
    exit
  exit

Executing

Login to container in VNC X11 (Linux Deploy -> "START", XServer XSDL), run (~/Desktop/)LINUX_CONTAINER/execute_adb_scrcpy.sh...

adb-scrcpy-scripts's People

Contributors

unique-ej avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.