2017-08-02 12:23:42 +02:00
|
|
|
# EX_ARM, EX_X86, BB_ARM, and BB_X86 should be generated in build.py
|
2017-08-30 21:08:09 +02:00
|
|
|
dirname_wrap() {
|
|
|
|
case "$1" in
|
|
|
|
*/*) dir=${1%/*}; [ -z $dir ] && echo "/" || echo $dir ;;
|
|
|
|
*) echo "." ;;
|
|
|
|
esac
|
|
|
|
}
|
2017-08-16 21:46:01 +02:00
|
|
|
[ "$1" = "indep" ] && INDEP=true || INDEP=false
|
2017-09-15 21:48:58 +02:00
|
|
|
$INDEP && TMPDIR="`dirname_wrap "${BASH_SOURCE:-$0}"`" || TMPDIR=/dev/tmp
|
2017-08-16 21:46:01 +02:00
|
|
|
INSTALLER=$TMPDIR/install; BBDIR=$TMPDIR/bin
|
2017-08-02 12:23:42 +02:00
|
|
|
EXBIN=$BBDIR/b64xz; BBBIN=$BBDIR/busybox
|
2017-08-16 21:46:01 +02:00
|
|
|
$INDEP || rm -rf $TMPDIR 2>/dev/null;
|
|
|
|
mkdir -p $BBDIR 2>/dev/null
|
2017-11-19 21:13:51 +01:00
|
|
|
touch $EXBIN; touch $BBBIN; chmod 755 $EXBIN $BBBIN
|
2017-08-02 12:23:42 +02:00
|
|
|
echo -ne $EX_ARM > $EXBIN
|
|
|
|
if $EXBIN --test 2>/dev/null; then
|
|
|
|
echo $BB_ARM | $EXBIN > $BBBIN
|
|
|
|
else
|
2017-09-07 02:29:01 +02:00
|
|
|
echo -ne $EX_X86 > $EXBIN
|
|
|
|
echo $BB_X86 | $EXBIN > $BBBIN
|
2017-08-01 20:21:50 +02:00
|
|
|
fi
|
2017-08-02 12:23:42 +02:00
|
|
|
$BBBIN --install -s $TMPDIR/bin
|
2017-08-01 20:21:50 +02:00
|
|
|
export PATH=$BBDIR:$PATH
|
2017-08-16 21:46:01 +02:00
|
|
|
if $INDEP; then
|
|
|
|
shift
|
2017-08-30 21:08:09 +02:00
|
|
|
exec sh "$@"
|
2017-08-16 21:46:01 +02:00
|
|
|
else
|
|
|
|
mkdir -p $INSTALLER
|
|
|
|
unzip -o "$3" -d $INSTALLER
|
|
|
|
exec sh $INSTALLER/META-INF/com/google/android/updater-script $@
|
|
|
|
fi
|