This Magisk module contains bash for arm64 CPUs

ASUS_I006D:/ $ bash --version
GNU bash, version 5.2.37(3)-release (aarch64-unknown-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ASUS_I006D:/ $ 


There are three bash binaries in the module; /system/bin/bash is dynamically linked but only for the standard Android OS libraries, /system/bin/bash-static is statically linked and not stripped, 
and /system/bin/bash-static-stripped is statically linked and stripped:

ASUS_I006D:/ $ ls -l /system/bin/bash*                                                                                                                                                               
-rwxr-xr-x 1 root root 2876408 2025-06-07 15:14 /system/bin/bash
-rwxr-xr-x 1 root root 5966560 2025-06-07 15:14 /system/bin/bash-static
-rwxr-xr-x 1 root root 3134552 2025-06-07 15:14 /system/bin/bash-static-stripped
-rwxr-xr-x 1 root root    7292 2025-06-07 15:14 /system/bin/bashbug
ASUS_I006D:/ $ 

(bashbug is a script for bug reporting)


ASUS_I006D:/ $ file /system/bin/bash                                                                                                                                                                 
/system/bin/bash: ELF shared object, 64-bit LSB arm64, dynamic (/system/bin/linker64), for Android 31, built by NDK r27b (12297006), not stripped
ASUS_I006D:/ $ 

ASUS_I006D:/ $ ldd /system/bin/bash
	linux-vdso.so.1 => [vdso] (0x754af61000)
	libc.so => /apex/com.android.runtime/lib64/bionic/libc.so (0x75448da000)
	libdl.so => /apex/com.android.runtime/lib64/bionic/libdl.so (0x7546b52000)
ASUS_I006D:/ $ 


ASUS_I006D:/ $ file /system/bin/bash-static                                                                                                                                                          
/system/bin/bash-static: ELF executable, 64-bit LSB arm64, static, for Android 31, built by NDK r27b (12297006), not stripped
ASUS_I006D:/ $ 

ASUS_I006D:/ $ ldd /system/bin/bash-static                                                                                                                                                           
error: "/system/bin/bash-static" has unexpected e_type: 2
1|ASUS_I006D:/ $ 


ASUS_I006D:/ $ file /system/bin/bash-static-stripped                                                                                                                                               
/system/bin/bash-static-stripped: ELF executable, 64-bit LSB arm64, static, for Android 31, built by NDK r27b (12297006), stripped
ASUS_I006D:/ $ 

ASUS_I006D:/ $ ldd /system/bin/bash-static-stripped                                                                                                                                                
error: "/system/bin/bash-static-stripped" has unexpected e_type: 2
1|ASUS_I006D:/ $ 


If the file /system_ext/bin/bash exists, the customize script replaces it with a symbolic link to /system/bin/bash.



All patches from the Termux repository for bash 

https://github.com/termux/termux-packages/tree/master/packages/bash

that are approbiate for a Magisk Module were applied



The init file for the bash binary is 

  /system/etc/bash.bashrc

This init script sources the file

  /data/local/tmp/home/bashrc

if it exists.


The directory used for temporary files is /data/local/tmp/var/tmp. The customize script creates this directory if it does not yet exist.


Notes for compiling bash
------------------------

Replace the file ./lib/sh/eaccess.c with the file patches/eaccess.c from this ZIP file or use the patch patches/eaccess.patch from this ZIP file to enable tests like

 [ -x /bin/sh ] && echo ok

for non-root user in bash.



History

02.04.2025 v1.0.0
  initial release

07.06.2025 v1.1.0
  tests like "[ -x /system/bin/sh ]" for non-root user now work again 

