2017-08-02 10:23:42 +00:00
|
|
|
# EX_ARM, EX_X86, BB_ARM, and BB_X86 should be generated in build.py
|
2017-08-16 19:46:01 +00:00
|
|
|
[ "$1" = "indep" ] && INDEP=true || INDEP=false
|
|
|
|
$INDEP && TMPDIR=/data/local/tmp || TMPDIR=/dev/tmp
|
|
|
|
INSTALLER=$TMPDIR/install; BBDIR=$TMPDIR/bin
|
2017-08-02 10:23:42 +00:00
|
|
|
EXBIN=$BBDIR/b64xz; BBBIN=$BBDIR/busybox
|
2017-08-16 19:46:01 +00:00
|
|
|
$INDEP || rm -rf $TMPDIR 2>/dev/null;
|
|
|
|
mkdir -p $BBDIR 2>/dev/null
|
2017-08-02 10:23:42 +00:00
|
|
|
touch $EXBIN $BBBIN; chmod 755 $EXBIN $BBBIN
|
|
|
|
echo -ne $EX_ARM > $EXBIN
|
|
|
|
if $EXBIN --test 2>/dev/null; then
|
|
|
|
echo $BB_ARM | $EXBIN > $BBBIN
|
|
|
|
else
|
|
|
|
echo -ne $EX_x86 > $EXBIN
|
|
|
|
echo $BB_x86 | $EXBIN > $BBBIN
|
2017-08-01 18:21:50 +00:00
|
|
|
fi
|
2017-08-02 10:23:42 +00:00
|
|
|
$BBBIN --install -s $TMPDIR/bin
|
2017-08-01 18:21:50 +00:00
|
|
|
export PATH=$BBDIR:$PATH
|
2017-08-16 19:46:01 +00:00
|
|
|
if $INDEP; then
|
|
|
|
shift
|
|
|
|
exec sh $@
|
|
|
|
else
|
|
|
|
mkdir -p $INSTALLER
|
|
|
|
unzip -o "$3" -d $INSTALLER
|
|
|
|
exec sh $INSTALLER/META-INF/com/google/android/updater-script $@
|
|
|
|
fi
|