Created
July 21, 2014 09:38
-
-
Save ildar/b94f3784e2210a8aaa31 to your computer and use it in GitHub Desktop.
restore busybox functions (applets) on a (remote) device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# restore busybox functions' links | |
# suppose that busybox is in PATHs | |
DOREMOTE=${DOREMOTE:-adb shell} | |
LOCALRUNNER=`busybox which busybox 2>/dev/null` | |
busybox which busybox || RUN=${RUN:-$DOREMOTE busybox} | |
$LOCALRUNNER which adb || RUN=${RUN:-busybox} | |
RUN=${RUN:-$DOREMOTE busybox} | |
FUNCS=`$RUN | $LOCALRUNNER tr -d '\r' | $LOCALRUNNER grep -A99 defined | $LOCALRUNNER tail -n +2 | $LOCALRUNNER tr -d ,` | |
BB=`$RUN which busybox | $LOCALRUNNER tr -d '\r'` | |
echo $BB | grep -q / || BB=/system/xbin/busybox | |
echo $BB | grep -q /system/ || BB=/system/xbin/busybox | |
DEST=${DEST:-`$LOCALRUNNER dirname $BB`} | |
[[ "$1" == "-n" ]] && RUN="echo $RUN" | |
$LOCALRUNNER which adb && adb remount | |
for f in $FUNCS; do | |
$RUN ln -s busybox $DEST/$f | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment