2019-01-15 08:32:18 -05:00
|
|
|
#!/sbin/sh
|
|
|
|
X86_CNT=__X86_CNT__
|
2018-05-13 14:26:28 +08:00
|
|
|
extract_bb() {
|
2019-02-03 09:50:49 -05:00
|
|
|
touch "$BBBIN"
|
2019-01-15 08:32:18 -05:00
|
|
|
chmod 755 "$BBBIN"
|
2019-07-16 01:16:29 -07:00
|
|
|
dd if="$0" of="$BBBIN" bs=1024 skip=1 count=$X86_CNT
|
2019-08-09 13:44:45 -03:00
|
|
|
"$BBBIN" >/dev/null 2>&1 || dd if="$0" of="$BBBIN" bs=1024 skip=$(($X86_CNT + 1))
|
2018-05-13 14:26:28 +08:00
|
|
|
}
|
|
|
|
setup_bb() {
|
2019-02-24 02:11:11 -05:00
|
|
|
export BBDIR=$TMPDIR/bin
|
2019-01-15 08:32:18 -05:00
|
|
|
BBBIN=$BBDIR/busybox
|
|
|
|
mkdir -p $BBDIR 2>/dev/null
|
2018-05-13 14:26:28 +08:00
|
|
|
extract_bb
|
|
|
|
$BBBIN --install -s $BBDIR
|
|
|
|
export PATH=$BBDIR:$PATH
|
|
|
|
}
|
|
|
|
case "$1" in
|
2019-01-15 08:32:18 -05:00
|
|
|
"extract"|"-x")
|
|
|
|
[ -z "$2" ] && BBBIN=./busybox || BBBIN="$2"
|
2018-05-13 14:26:28 +08:00
|
|
|
extract_bb
|
|
|
|
;;
|
2019-01-15 08:32:18 -05:00
|
|
|
"indep"|"sh")
|
2019-02-24 02:11:11 -05:00
|
|
|
TMPDIR=.
|
|
|
|
setup_bb
|
|
|
|
shift
|
2018-07-10 02:44:58 +08:00
|
|
|
exec /system/bin/sh "$@"
|
2018-05-13 14:26:28 +08:00
|
|
|
;;
|
|
|
|
*)
|
2019-01-15 08:32:18 -05:00
|
|
|
export TMPDIR=/dev/tmp
|
|
|
|
rm -rf $TMPDIR 2>/dev/null
|
|
|
|
setup_bb
|
|
|
|
export INSTALLER=$TMPDIR/install
|
|
|
|
mkdir -p $INSTALLER
|
|
|
|
unzip -o "$3" -d $INSTALLER >&2
|
2018-07-10 02:44:58 +08:00
|
|
|
exec sh $INSTALLER/META-INF/com/google/android/updater-script "$@"
|
2018-05-13 14:26:28 +08:00
|
|
|
;;
|
|
|
|
esac
|
2019-01-15 08:32:18 -05:00
|
|
|
exit
|