Support Magisk Manager boot image file patch

This commit is contained in:
topjohnwu
2017-08-31 03:08:09 +08:00
parent 189c671ce2
commit f63af0601c
3 changed files with 21 additions and 15 deletions

View File

@@ -49,12 +49,15 @@ abort_wrap() {
# Pure bash dirname implementation
dirname_wrap() {
if echo $1 | grep "/" >/dev/null 2>&1; then
RES=${1%/*}
[ -z $RES ] && echo "/" || echo $RES
else
echo "."
fi
case "$1" in
*/*)
dir=${1%/*}
[ -z $dir ] && echo "/" || echo $dir
;;
*)
echo "."
;;
esac
}
# Pure bash basename implementation
@@ -93,10 +96,8 @@ cpio_mkdir() {
[ -z $1 ] && abort_wrap "This script requires a boot image as a parameter"
CWD=`pwd`
cd "`dirname_wrap $1`"
BOOTIMAGE="`pwd`/`basename_wrap $1`"
cd "$CWD"
[ -e "$BOOTIMAGE" ] || abort_wrap "$BOOTIMAGE does not exist!"