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