Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
9b445d89
Commit
9b445d89
authored
May 13, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extract feature to update-binary
parent
c3c78428
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
25 deletions
+34
-25
update_binary.sh
scripts/update_binary.sh
+34
-25
No files found.
scripts/update_binary.sh
View file @
9b445d89
# EX_ARM, EX_X86, BB_ARM, and BB_X86 should be generated in build.py
# EX_ARM, EX_X86, BB_ARM, and BB_X86 should be generated in build.py
dirname_wrap
()
{
getdir
()
{
case
"
$1
"
in
case
"
$1
"
in
*
/
*
)
dir
=
${
1
%/*
}
;
[
-z
$dir
]
&&
echo
"/"
||
echo
$dir
;;
*
/
*
)
dir
=
${
1
%/*
}
;
[
-z
$dir
]
&&
echo
"/"
||
echo
$dir
;;
*
)
echo
"."
;;
*
)
echo
"."
;;
esac
esac
}
}
[
"
$1
"
=
"indep"
]
&&
INDEP
=
true
||
INDEP
=
false
extract_bb
()
{
$INDEP
&&
TMPDIR
=
"
`
dirname_wrap
"
${
BASH_SOURCE
:-
$0
}
"
`
"
||
TMPDIR
=
/dev/tmp
EXBIN
=
$BBDIR
/b64xz
;
BBBIN
=
$BBDIR
/busybox
INSTALLER
=
$TMPDIR
/install
;
BBDIR
=
$TMPDIR
/bin
touch
$EXBIN
;
touch
$BBBIN
;
chmod
755
$EXBIN
$BBBIN
EXBIN
=
$BBDIR
/b64xz
;
BBBIN
=
$BBDIR
/busybox
echo
-ne
$EX_ARM
>
$EXBIN
$INDEP
||
rm
-rf
$TMPDIR
2>/dev/null
;
if
$EXBIN
--test
2>/dev/null
;
then
mkdir
-p
$BBDIR
2>/dev/null
echo
$BB_ARM
|
$EXBIN
>
$BBBIN
touch
$EXBIN
;
touch
$BBBIN
;
chmod
755
$EXBIN
$BBBIN
else
echo
-ne
$EX_ARM
>
$EXBIN
echo
-ne
$EX_X86
>
$EXBIN
if
$EXBIN
--test
2>/dev/null
;
then
echo
$BB_X86
|
$EXBIN
>
$BBBIN
echo
$BB_ARM
|
$EXBIN
>
$BBBIN
fi
else
rm
$EXBIN
echo
-ne
$EX_X86
>
$EXBIN
}
echo
$BB_X86
|
$EXBIN
>
$BBBIN
setup_bb
()
{
fi
BBDIR
=
$TMPDIR
/bin
;
mkdir
-p
$BBDIR
2>/dev/null
$BBBIN
--install
-s
$TMPDIR
/bin
extract_bb
export
PATH
=
$BBDIR
:
$PATH
$BBBIN
--install
-s
$BBDIR
if
$INDEP
;
then
export
PATH
=
$BBDIR
:
$PATH
shift
}
exec
sh
"
$@
"
case
"
$1
"
in
else
"extract"
)
mkdir
-p
$INSTALLER
[
-z
"
$2
"
]
&&
BBDIR
=
.
||
BBDIR
=
"
$2
"
unzip
-o
"
$3
"
-d
$INSTALLER
extract_bb
exec
sh
$INSTALLER
/META-INF/com/google/android/updater-script
$@
;;
fi
"indep"
)
TMPDIR
=
"
`
getdir
"
${
BASH_SOURCE
:-
$0
}
"
`
"
;
setup_bb
shift
;
exec
sh
"
$@
"
;;
*
)
TMPDIR
=
/dev/tmp
;
rm
-rf
$TMPDIR
2>/dev/null
;
setup_bb
INSTALLER
=
$TMPDIR
/install
;
mkdir
-p
$INSTALLER
;
unzip
-o
"
$3
"
-d
$INSTALLER
exec
sh
$INSTALLER
/META-INF/com/google/android/updater-script
$@
;;
esac
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment