Android / busybox / termuxtestingenvionment

我正在开发一些在Linux / BSD / Mac / Windows上运行的bash脚本。 我想将它们移植到busybox环境中,让它们在androidterminal模拟器(如termux)中运行。

获取busybox / androidtesting环境的最佳方法是什么? 我试图去与docker的busybox图像。 我还需要能够添加工具,如ssh客户端或rsync,它通过apt install rsync工作在android termux中,但不会在docker镜像中工作,原因很明显。

有任何想法吗 ? 谢谢。

Busybox本身实际上只是一个可以performance得像许多不同工具一样的单一多任务二进制文件。 在纯粹的busybox环境中,你最终可能会编译busybox来包含你需要的applet(比如rsync)。

在你的问题中,你引用了一个命令apt install rsync 。 Busybox没有像您提到的那样的apt命令。 有可能安装一个软件包pipe理器,这个软件包pipe理器又可以按需安装。

Alpine Linux发行版有一个叫做apk的非常小的包pipe理器,它也可以使用busybox。 Docker Hub上的alpine官方图片基本上只有busybox和apk。 它的包基于libmusl而不是glibc。 肯定值得看看阿尔卑斯山。

以下是如何在alpine上安装rsync:

 $ 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 / # 

其他小型软件包pipe理器也可以工作,但我不知道他们是多么容易安装到一个精简的busybox根(如busybox图像)。 opkg和ipkg让人想起embedded式软件包pipe理器。