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
6623195b
You need to sign in or sign up before continuing.
Commit
6623195b
authored
Jan 24, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup scripts
parent
ec31bb9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
80 deletions
+2
-80
build.py
build.py
+2
-71
config.prop.sample
config.prop.sample
+0
-9
No files found.
build.py
View file @
6623195b
...
...
@@ -5,7 +5,6 @@ import subprocess
import
argparse
import
multiprocessing
import
zipfile
import
datetime
import
errno
import
shutil
import
lzma
...
...
@@ -151,7 +150,6 @@ def load_config(args):
# Default values
config
[
'version'
]
=
commit_hash
config
[
'outdir'
]
=
'out'
config
[
'prettyName'
]
=
'false'
# Load prop files
if
op
.
exists
(
args
.
config
):
...
...
@@ -161,8 +159,6 @@ def load_config(args):
if
key
.
startswith
(
'magisk.'
):
config
[
key
[
7
:]]
=
value
config
[
'prettyName'
]
=
config
[
'prettyName'
]
.
lower
()
==
'true'
try
:
config
[
'versionCode'
]
=
int
(
config
[
'versionCode'
])
except
ValueError
:
...
...
@@ -173,17 +169,10 @@ def load_config(args):
STDOUT
=
None
if
args
.
verbose
else
subprocess
.
DEVNULL
def
zip_with_msg
(
zip_file
,
source
,
target
):
if
not
op
.
exists
(
source
):
error
(
f
'{source} does not exist! Try build
\'
binary
\'
and
\'
apk
\'
before zipping!'
)
zip_file
.
write
(
source
,
target
)
vprint
(
f
'zip: {source} -> {target}'
)
def
collect_binary
():
for
arch
in
archs
+
arch64
:
mkdir_p
(
op
.
join
(
'native'
,
'out'
,
arch
))
for
bin
in
support_targets
+
[
'magiskinit64'
]
:
for
bin
in
support_targets
:
source
=
op
.
join
(
'native'
,
'libs'
,
arch
,
bin
)
target
=
op
.
join
(
'native'
,
'out'
,
arch
,
bin
)
mv
(
source
,
target
)
...
...
@@ -214,7 +203,7 @@ def find_build_tools():
build_tools
=
op
.
join
(
build_tools_root
,
ls
[
-
1
])
return
build_tools
# Unused but keep this code
def
sign_zip
(
unsigned
):
if
'keyStore'
not
in
config
:
return
...
...
@@ -384,60 +373,6 @@ def build_snet(args):
header
(
'Output: '
+
target
)
def
zip_uninstaller
(
args
):
header
(
'* Packing Uninstaller Zip'
)
datestr
=
f
'{datetime.datetime.now():
%
Y
%
m
%
d}'
name
=
f
'Magisk-uninstaller-{datestr}.zip'
if
config
[
'prettyName'
]
else
'magisk-uninstaller.zip'
output
=
op
.
join
(
config
[
'outdir'
],
name
)
with
zipfile
.
ZipFile
(
output
,
'w'
,
compression
=
zipfile
.
ZIP_DEFLATED
,
allowZip64
=
False
)
as
zipf
:
# update-binary
source
=
op
.
join
(
'scripts'
,
'update_binary.sh'
)
target
=
op
.
join
(
'META-INF'
,
'com'
,
'google'
,
'android'
,
'update-binary'
)
zip_with_msg
(
zipf
,
source
,
target
)
# updater-script
source
=
op
.
join
(
'scripts'
,
'uninstaller.sh'
)
target
=
op
.
join
(
'META-INF'
,
'com'
,
'google'
,
'android'
,
'updater-script'
)
zip_with_msg
(
zipf
,
source
,
target
)
# Binaries
for
exe
in
(
'busybox'
,
'magiskboot'
):
for
arch
in
archs
:
source
=
op
.
join
(
'native'
,
'out'
,
arch
,
exe
)
target
=
op
.
join
(
'lib'
,
arch
,
f
'lib{exe}.so'
)
zip_with_msg
(
zipf
,
source
,
target
)
# util_functions.sh
source
=
op
.
join
(
'scripts'
,
'util_functions.sh'
)
with
open
(
source
,
'r'
)
as
script
:
# Add version info util_functions.sh
util_func
=
script
.
read
()
.
replace
(
'#MAGISK_VERSION_STUB'
,
f
'MAGISK_VER="{config["version"]}"
\n
'
f
'MAGISK_VER_CODE={config["versionCode"]}'
)
target
=
op
.
join
(
'assets'
,
'util_functions.sh'
)
vprint
(
f
'zip: {source} -> {target}'
)
zipf
.
writestr
(
target
,
util_func
)
# chromeos
for
tool
in
[
'futility'
,
'kernel_data_key.vbprivk'
,
'kernel.keyblock'
]:
if
tool
==
'futility'
:
source
=
op
.
join
(
'tools'
,
tool
)
else
:
source
=
op
.
join
(
'tools'
,
'keys'
,
tool
)
target
=
op
.
join
(
'assets'
,
'chromeos'
,
tool
)
zip_with_msg
(
zipf
,
source
,
target
)
# End of zipping
sign_zip
(
output
)
header
(
'Output: '
+
output
)
def
cleanup
(
args
):
support_targets
=
{
'native'
,
'java'
}
if
args
.
target
:
...
...
@@ -541,10 +476,6 @@ snet_parser = subparsers.add_parser(
'snet'
,
help
=
'build snet extension'
)
snet_parser
.
set_defaults
(
func
=
build_snet
)
un_parser
=
subparsers
.
add_parser
(
'uninstaller'
,
help
=
'create flashable uninstaller'
)
un_parser
.
set_defaults
(
func
=
zip_uninstaller
)
clean_parser
=
subparsers
.
add_parser
(
'clean'
,
help
=
'cleanup'
)
clean_parser
.
add_argument
(
'target'
,
nargs
=
'*'
,
help
=
'native, java, or empty to clean both'
)
...
...
config.prop.sample
View file @
6623195b
...
...
@@ -9,15 +9,6 @@ version=string
# Output path. Default: out
outdir=string
################################################################
# Whether to use pretty names for zips
# e.g. Magisk-v${version}.zip, Magisk-uninstaller-${date}.zip
# Default names are magisk-${release/debug/uninstaller}.zip
################################################################
# Default: false
prettyName=bool
#####################################################
# Signing configs for signing zips and APKs
# These 4 variables has to be either all set or not
...
...
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