Android / busybox / termux test envionment

I’m developping some bash scripts that run on Linux/BSD/Mac/Windows.
I’d like to port them to the busybox environment, to get them to run in an android terminal emulator, like termux.

What’s the best way to get a test environment for busybox / android ?
I’ve tried to go with the docker busybox image.
I also need to be able to add tools like an ssh client or rsync, which works in android termux via apt install rsync, but won’t work in a docker image for obvious reasons.

  • Dockerfile Overriding ENV variable
  • How to mix several python scripts into a shell script?
  • permission denied error in docker
  • command not found when running in docker bash script
  • How to run a bash script in an Alpine Docker container
  • How to transfer a environment variable into a dockerfile
  • Any ideas ?
    Thanks.

  • Android instrumentation test with Bitbucket pipelane and Docker
  • Docker - dynamic regex-based sed substitution in files
  • how to continue a bash script after it reboots the machine from the command after the reboot command?
  • How to run appium test using aluedeke/appium-android docker image?
  • Dockerfile: How to replace a placeholder in environment variable with build-arg's?
  • How to run docker image , take ssh of container and bind port to “49” in single cmd?
  • One Solution collect form web for “Android / busybox / termux test envionment”

    Busybox itself is really just a single multicall binary that can behave like many different tools. In a pure busybox environment, you’d probably end up compiling busybox to include the applets that you need (like rsync).

    In your question, you referenced a command apt install rsync. Busybox doesn’t have an apt command, like you mentioned. It may be possible to install a package manager that would in turn be able to install things on demand.

    The Alpine Linux distro has a very small package manager called apk, and it also can use busybox. The alpine official image on the Docker Hub essentially has just busybox and apk. Its packages are based on libmusl instead of glibc. It’d be worth taking a look at alpine for sure.

    Here’s how to install rsync on alpine:

    $ docker run --rm -it alpine sh
    / # which busybox
    /bin/busybox
    / # ls -lah `which mv`
    lrwxrwxrwx    1 root     root          12 Jun 23 19:37 /bin/mv -> /bin/busybox
    / # apk --no-cache add rsync
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
    (1/4) Installing libattr (2.4.47-r4)
    (2/4) Installing libacl (2.2.52-r2)
    (3/4) Installing popt (1.16-r6)
    (4/4) Installing rsync (3.1.2-r2)
    Executing busybox-1.24.2-r9.trigger
    OK: 5 MiB in 15 packages
    / # ls -lah `which rsync`
    -rwxr-xr-x    1 root     root      396.0K Apr 29 16:02 /usr/bin/rsync
    / #
    

    Other tiny package managers may work as well, but I’m not aware of how easy they are to install into a stripped down busybox root (like the busybox image). opkg and ipkg come to mind for embedded package managers.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.