Fix module installs in recovery

Close #3494
This commit is contained in:
topjohnwu 2020-12-28 00:24:03 -08:00
parent d3e4b29e62
commit b51b884fc7

View File

@ -116,14 +116,23 @@ ensure_bb() {
fi
chmod 755 $bb
# Busybox could be a script, make sure /system/bin/sh exists
if [ ! -f /system/bin/sh ]; then
umount -l /system 2>/dev/null
mkdir -p /system/bin
ln -s $(command -v sh) /system/bin/sh
fi
export ASH_STANDALONE=1
# Find our current arguments
# Run in busybox environment to ensure consistent results
# /proc/<pid>/cmdline shall be <interpreter> <script> <arguments...>
local cmds="$($bb sh -o standalone -c "
local cmds="$($bb sh -c "
for arg in \$(tr '\0' '\n' < /proc/$$/cmdline); do
if [ -z \"\$cmds\" ]; then
# Skip the first argument as we want to change the interpreter
cmds=\"sh -o standalone\"
cmds=\"sh\"
else
cmds=\"\$cmds '\$arg'\"
fi