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
fd7bf2bc
Commit
fd7bf2bc
authored
Dec 14, 2021
by
vvb2060
Committed by
John Wu
Jan 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support PATCHVBMETAFLAG env variable
parent
b2cd24ed
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
39 additions
and
7 deletions
+39
-7
Config.kt
app/src/main/java/com/topjohnwu/magisk/core/Config.kt
+4
-3
Info.kt
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
+1
-0
MagiskInstaller.kt
...n/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
+1
-0
ShellInit.kt
...rc/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt
+2
-0
InstallViewModel.kt
.../java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
+3
-2
fragment_install_md2.xml
app/src/main/res/layout/fragment_install_md2.xml
+12
-1
manager.sh
app/src/main/res/raw/manager.sh
+7
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
util_functions.sh
scripts/util_functions.sh
+8
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Config.kt
View file @
fd7bf2bc
...
@@ -109,9 +109,10 @@ object Config : PreferenceModel, DBConfig {
...
@@ -109,9 +109,10 @@ object Config : PreferenceModel, DBConfig {
else
else
Value
.
DEFAULT_CHANNEL
Value
.
DEFAULT_CHANNEL
@JvmStatic
var
keepVerity
=
false
@JvmField
var
keepVerity
=
false
@JvmStatic
var
keepEnc
=
false
@JvmField
var
keepEnc
=
false
@JvmStatic
var
recovery
=
false
@JvmField
var
patchVbmeta
=
false
@JvmField
var
recovery
=
false
var
bootId
by
preference
(
Key
.
BOOT_ID
,
""
)
var
bootId
by
preference
(
Key
.
BOOT_ID
,
""
)
var
askedHome
by
preference
(
Key
.
ASKED_HOME
,
false
)
var
askedHome
by
preference
(
Key
.
ASKED_HOME
,
false
)
...
...
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
View file @
fd7bf2bc
...
@@ -34,6 +34,7 @@ object Info {
...
@@ -34,6 +34,7 @@ object Info {
@JvmField
val
isZygiskEnabled
=
System
.
getenv
(
"ZYGISK_ENABLED"
)
==
"1"
@JvmField
val
isZygiskEnabled
=
System
.
getenv
(
"ZYGISK_ENABLED"
)
==
"1"
@JvmStatic
val
isFDE
get
()
=
crypto
==
"block"
@JvmStatic
val
isFDE
get
()
=
crypto
==
"block"
@JvmField
var
ramdisk
=
false
@JvmField
var
ramdisk
=
false
@JvmField
var
vbmeta
=
false
@JvmField
var
hasGMS
=
true
@JvmField
var
hasGMS
=
true
@JvmField
val
isPixel
=
Build
.
BRAND
==
"google"
@JvmField
val
isPixel
=
Build
.
BRAND
==
"google"
@JvmField
val
isEmulator
=
@JvmField
val
isEmulator
=
...
...
app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
View file @
fd7bf2bc
...
@@ -357,6 +357,7 @@ abstract class MagiskInstallImpl protected constructor(
...
@@ -357,6 +357,7 @@ abstract class MagiskInstallImpl protected constructor(
"cd $installDir"
,
"cd $installDir"
,
"KEEPFORCEENCRYPT=${Config.keepEnc} "
+
"KEEPFORCEENCRYPT=${Config.keepEnc} "
+
"KEEPVERITY=${Config.keepVerity} "
+
"KEEPVERITY=${Config.keepVerity} "
+
"PATCHVBMETAFLAG=${Config.patchVbmeta} "
+
"RECOVERYMODE=${Config.recovery} "
+
"RECOVERYMODE=${Config.recovery} "
+
"sh boot_patch.sh $srcBoot"
)
"sh boot_patch.sh $srcBoot"
)
...
...
app/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt
View file @
fd7bf2bc
...
@@ -75,6 +75,7 @@ class ShellInit : Shell.Initializer() {
...
@@ -75,6 +75,7 @@ class ShellInit : Shell.Initializer() {
Const
.
MAGISKTMP
=
getVar
(
"MAGISKTMP"
)
Const
.
MAGISKTMP
=
getVar
(
"MAGISKTMP"
)
Info
.
isSAR
=
getBool
(
"SYSTEM_ROOT"
)
Info
.
isSAR
=
getBool
(
"SYSTEM_ROOT"
)
Info
.
ramdisk
=
getBool
(
"RAMDISKEXIST"
)
Info
.
ramdisk
=
getBool
(
"RAMDISKEXIST"
)
Info
.
vbmeta
=
getBool
(
"VBMETAEXIST"
)
Info
.
isAB
=
getBool
(
"ISAB"
)
Info
.
isAB
=
getBool
(
"ISAB"
)
Info
.
crypto
=
getVar
(
"CRYPTOTYPE"
)
Info
.
crypto
=
getVar
(
"CRYPTOTYPE"
)
...
@@ -82,6 +83,7 @@ class ShellInit : Shell.Initializer() {
...
@@ -82,6 +83,7 @@ class ShellInit : Shell.Initializer() {
Config
.
recovery
=
getBool
(
"RECOVERYMODE"
)
Config
.
recovery
=
getBool
(
"RECOVERYMODE"
)
Config
.
keepVerity
=
getBool
(
"KEEPVERITY"
)
Config
.
keepVerity
=
getBool
(
"KEEPVERITY"
)
Config
.
keepEnc
=
getBool
(
"KEEPFORCEENCRYPT"
)
Config
.
keepEnc
=
getBool
(
"KEEPFORCEENCRYPT"
)
Config
.
patchVbmeta
=
getBool
(
"PATCHVBMETAFLAG"
)
return
true
return
true
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
View file @
fd7bf2bc
package
com.topjohnwu.magisk.ui.install
package
com.topjohnwu.magisk.ui.install
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
androidx.databinding.Bindable
import
androidx.databinding.Bindable
import
androidx.lifecycle.viewModelScope
import
androidx.lifecycle.viewModelScope
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.BR
...
@@ -26,11 +27,11 @@ class InstallViewModel(
...
@@ -26,11 +27,11 @@ class InstallViewModel(
)
:
BaseViewModel
()
{
)
:
BaseViewModel
()
{
val
isRooted
=
Shell
.
rootAccess
()
val
isRooted
=
Shell
.
rootAccess
()
val
skipOptions
=
Info
.
isEmulator
||
(
Info
.
ramdisk
&&
!
Info
.
isFDE
&&
Info
.
isSAR
)
val
skipOptions
=
Info
.
ramdisk
&&
!
Info
.
isFDE
&&
Info
.
isSAR
&&
!(!
Info
.
vbmeta
&&
Build
.
VERSION
.
SDK_INT
>=
30
)
val
noSecondSlot
=
!
isRooted
||
Info
.
isPixel
||
Info
.
isVirtualAB
||
!
Info
.
isAB
||
Info
.
isEmulator
val
noSecondSlot
=
!
isRooted
||
Info
.
isPixel
||
Info
.
isVirtualAB
||
!
Info
.
isAB
||
Info
.
isEmulator
@get
:
Bindable
@get
:
Bindable
var
step
=
if
(
skipOptions
)
1
else
0
var
step
=
if
(
Info
.
isEmulator
||
skipOptions
)
1
else
0
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
step
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
step
)
var
_method
=
-
1
var
_method
=
-
1
...
...
app/src/main/res/layout/fragment_install_md2.xml
View file @
fd7bf2bc
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
<import
type=
"com.topjohnwu.magisk.core.Config"
/>
<import
type=
"com.topjohnwu.magisk.core.Config"
/>
<import
type=
"android.os.Build"
/>
<variable
<variable
name=
"viewModel"
name=
"viewModel"
type=
"com.topjohnwu.magisk.ui.install.InstallViewModel"
/>
type=
"com.topjohnwu.magisk.ui.install.InstallViewModel"
/>
...
@@ -34,7 +36,7 @@
...
@@ -34,7 +36,7 @@
<com.google.android.material.card.MaterialCardView
<com.google.android.material.card.MaterialCardView
style=
"@style/WidgetFoundation.Card"
style=
"@style/WidgetFoundation.Card"
gone=
"@{viewModel.skipOptions}"
gone=
"@{viewModel.skipOptions
|| Info.isEmulator
}"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/l1"
android:layout_marginStart=
"@dimen/l1"
...
@@ -108,6 +110,15 @@
...
@@ -108,6 +110,15 @@
android:text=
"@string/keep_force_encryption"
android:text=
"@string/keep_force_encryption"
app:tint=
"?colorPrimary"
/>
app:tint=
"?colorPrimary"
/>
<CheckBox
style=
"@style/WidgetFoundation.Checkbox"
goneUnless=
"@{!Info.vbmeta && Build.VERSION.SDK_INT >= 30}"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:checked=
"@={Config.patchVbmeta}"
android:text=
"@string/patch_vbmeta"
app:tint=
"?colorPrimary"
/>
<CheckBox
<CheckBox
style=
"@style/WidgetFoundation.Checkbox"
style=
"@style/WidgetFoundation.Checkbox"
gone=
"@{Info.ramdisk}"
gone=
"@{Info.ramdisk}"
...
...
app/src/main/res/raw/manager.sh
View file @
fd7bf2bc
...
@@ -179,6 +179,12 @@ check_encryption() {
...
@@ -179,6 +179,12 @@ check_encryption() {
fi
fi
}
}
check_vbmeta_partition
()
{
if
[
-e
/dev/block/by-name/vbmeta_a
]
||
[
-e
/dev/block/by-name/vbmeta
]
;
then
VBMETAEXIST
=
true
fi
}
##########################
##########################
# Non-root util_functions
# Non-root util_functions
##########################
##########################
...
@@ -211,6 +217,7 @@ app_init() {
...
@@ -211,6 +217,7 @@ app_init() {
SHA1
=
$(
grep_prop SHA1
$MAGISKTMP
/config
)
SHA1
=
$(
grep_prop SHA1
$MAGISKTMP
/config
)
check_boot_ramdisk
&&
RAMDISKEXIST
=
true
||
RAMDISKEXIST
=
false
check_boot_ramdisk
&&
RAMDISKEXIST
=
true
||
RAMDISKEXIST
=
false
check_encryption
check_encryption
check_vbmeta_partition
# Make sure RECOVERYMODE has value
# Make sure RECOVERYMODE has value
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
}
}
...
...
app/src/main/res/values/strings.xml
View file @
fd7bf2bc
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
<!--Install-->
<!--Install-->
<string
name=
"keep_force_encryption"
>
Preserve force encryption
</string>
<string
name=
"keep_force_encryption"
>
Preserve force encryption
</string>
<string
name=
"keep_dm_verity"
>
Preserve AVB 2.0/dm-verity
</string>
<string
name=
"keep_dm_verity"
>
Preserve AVB 2.0/dm-verity
</string>
<string
name=
"patch_vbmeta"
>
Patch vbmeta in boot image
</string>
<string
name=
"recovery_mode"
>
Recovery Mode
</string>
<string
name=
"recovery_mode"
>
Recovery Mode
</string>
<string
name=
"install_options_title"
>
Options
</string>
<string
name=
"install_options_title"
>
Options
</string>
<string
name=
"install_method_title"
>
Method
</string>
<string
name=
"install_method_title"
>
Method
</string>
...
...
scripts/util_functions.sh
View file @
fd7bf2bc
...
@@ -403,7 +403,14 @@ get_flags() {
...
@@ -403,7 +403,14 @@ get_flags() {
KEEPFORCEENCRYPT
=
false
KEEPFORCEENCRYPT
=
false
fi
fi
fi
fi
[
-z
$PATCHVBMETAFLAG
]
&&
PATCHVBMETAFLAG
=
false
if
[
-z
$PATCHVBMETAFLAG
]
;
then
if
[
-e
/dev/block/by-name/vbmeta_a
]
||
[
-e
/dev/block/by-name/vbmeta
]
;
then
PATCHVBMETAFLAG
=
false
else
PATCHVBMETAFLAG
=
true
ui_print
"- Not found vbmeta partition, patch vbmetaflag"
fi
fi
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
[
-z
$RECOVERYMODE
]
&&
RECOVERYMODE
=
false
}
}
...
...
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