First ensure that you have everything ready:
- Exported the two Shizuku files:
rish
&rish_shizuku.dex
to a storage location that can be read by Termux.- Open Shizuku > Use Shizuku in terminal apps > Export files > Select location
- Termux is configured to access external storage use the following command:
termux-setup-storage
Table of Contents
Configuration
Note key directories:
- Termux bin path:
/data/data/com.termux/files/usr/bin/
- Shizuku export location relative to Termux home:
~/storage/shared/rish
Shizuku file preparation
Move the Shizuku files: rish
& rish_shizuku.dex
by running the following under Termux your device:
# Move the files
mv ~/storage/shared/rish/rish /data/data/com.termux/files/usr/bin/rish
mv ~/storage/shared/rish/rish_shizuku.dex /data/data/com.termux/files/usr/bin/rish_shizuku.dex
chmod +x /data/data/com.termux/files/usr/bin/rish
Check that rish is working
/data/data/com.termux/files/usr/bin/rish -c 'svc data disable'
It should print an error about RISH_APPLICATION_ID
not being set; this is normal continue with the configuration as that part is next.
Create the wrapper script
Note that this script adopted from: Shizuku by Casey Ng
# Create the rish_auto wrapper script, script adopted from: https://llamalab.com/automate/community/flows/45752
cat >/data/data/com.termux/files/usr/bin/rish_auto <<'EOL'
#!/system/bin/sh
BASEDIR=/data/data/com.termux/files/usr/bin
DEX="$BASEDIR"/rish_shizuku.dex
if [ ! -f "$DEX" ]; then
echo "Cannot find $DEX, please check the tutorial in Shizuku app"
exit 1
fi
# Replace "PKG" with the application id of your terminal app
[ -z "$RISH_APPLICATION_ID" ] && export RISH_APPLICATION_ID="com.termux"
/system/bin/app_process -Djava.class.path="$DEX" /system/bin --nice-name=rish rikka.shizuku.shell.ShizukuShellLoader "$@"
EOL
Set execute permission on rish_auto
chmod +x /data/data/com.termux/files/usr/bin/rish_auto
Test rish_auto wrapper script
rish_auto -c 'svc data enable'
# Other options
rish_auto -c 'svc data enable'
rish_auto -c 'svc data disable'
rish_auto -c 'svc wifi enable'
rish_auto -c 'svc wifi disable'
# Or the rish cli
rish_auto
The full script
Copy, paste and execute ready!
# First ensure that you have exported the two rish files:
# `rish` & `rish_shizuku.dex` to a storage location that can be read by Termux.
# Move the files
mv ~/storage/shared/rish/rish /data/data/com.termux/files/usr/bin/rish
mv ~/storage/shared/rish/rish_shizuku.dex /data/data/com.termux/files/usr/bin/rish_shizuku.dex
chmod +x /data/data/com.termux/files/usr/bin/rish
# Test rish is working
/data/data/com.termux/files/usr/bin/rish -c 'svc data enable'
# Create the rish_auto wrapper script, script adopted from: https://llamalab.com/automate/community/flows/45752
cat >/data/data/com.termux/files/usr/bin/rish_auto <<'EOL'
#!/system/bin/sh
BASEDIR=/data/data/com.termux/files/usr/bin
DEX="$BASEDIR"/rish_shizuku.dex
if [ ! -f "$DEX" ]; then
echo "Cannot find $DEX, please check the tutorial in Shizuku app"
exit 1
fi
# Replace "PKG" with the application id of your terminal app
[ -z "$RISH_APPLICATION_ID" ] && export RISH_APPLICATION_ID="com.termux"
/system/bin/app_process -Djava.class.path="$DEX" /system/bin --nice-name=rish rikka.shizuku.shell.ShizukuShellLoader "$@"
EOL
# Set execute permission
chmod +x /data/data/com.termux/files/usr/bin/rish_auto
# Test wrapper script
rish_auto -c 'svc data disable'
# or for rish CLI
rish_auto
Follow up
The following article: Tasker: Using Termux to manage application states with Rish ADB builds on the script used here.