Commit Graph

204 Commits

Author SHA1 Message Date
f5f9b285c0 Add module tests 2025-02-16 16:20:09 -08:00
5e35703091 Ensure target path exists before mknod
Co-authored-by: LoveSy <shana@zju.edu.cn>
2025-02-12 01:13:56 +08:00
d2768357da Support systemlessly deleting files or folders
After we refactor the magic mount and always mount folder as tmpfs,
we can easily support deleting files or folders now. We recognize
dummy devices with major number 0 and minor number 0 as an indicator
for removing files and folders. This indicator is borrowed from
overlayfs.
2024-12-27 15:57:54 -08:00
506961a10d flash module: ignore META-INF 2024-12-12 10:07:47 -08:00
e6bd2ff60f Fix stock image restore
Fix #8211
2024-08-20 02:23:20 -07:00
2cbec20238 find_boot_image: test GKI 1.0 2024-08-19 03:05:24 -07:00
4b724c7257 find_boot_image: test previous kernels (<=4.19) 2024-08-19 03:05:24 -07:00
ab04c6ab39 find_boot_image: keep symlink 2024-08-19 03:05:24 -07:00
07835a3e0e util_functions.sh: Fix syntax error due to missing then
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2024-08-06 01:16:19 -07:00
09131aca89 Fix find_boot_image
Close #8255
2024-08-05 11:24:30 -07:00
a8789073f1 Run copy_preinit_files in run_migrations 2024-07-23 02:21:49 -07:00
d33b077a13 Remove NVBASE
We only move /cache/data_adb/magisk and /data/magisk to /data/adb/magisk (#7638), so NVBASE is redundant and we can just use MAGISKBIN.
2024-07-23 02:03:47 -07:00
2282365cf8 clean code 2024-07-23 02:02:56 -07:00
9a00b7b942 update copy_preinit_files 2024-07-23 02:02:56 -07:00
a07b9315a5 Add riscv64 support 2024-07-02 14:34:22 -07:00
7dca5b831a check empty init_boot partition
For upgrading devices that continue to use Android 12 or older kernel versions, the generic ramdisk remains where it was with no requirement for a new init_boot image.
2024-07-02 14:23:28 -07:00
187f583c95 Fix $RECOVERYMODE from config being incorrectly overridden
Move legacy SAR checking logic into mount_partitions, and avoid calling get_flags before check_boot_ramdisk
Fix #7346
2023-10-10 15:53:18 -07:00
de00f1d5a9 Always check mounts to detect legacy SAR on bootmode 2023-08-30 01:02:19 -07:00
e9b9bf987b Fix syntax error in util_functions.sh 2023-08-29 15:33:03 -07:00
75d905a56d Fix device detection scripts and logic 2023-08-28 22:13:36 -07:00
51afe43a30 Cleanup util_functions 2023-08-28 22:13:36 -07:00
d12d9e82f1 Force kernel to load rootfs only for legacy SAR devices 2023-08-18 17:18:34 -07:00
4d2b62da0d Do not override global variables in document 2023-07-21 12:04:42 -07:00
f33343b4e6 Remove unused code and logic 2023-07-17 18:58:48 -07:00
16d728f379 Partially document global variables in scripts 2023-07-17 16:07:16 -07:00
18fe0e6442 Fix scripts
manager.sh + boot_patch.sh:
- all listed files from boot_patch.sh header are required for boot patching, but stub.apk was being removed so install_magisk via addon.d.sh would fail without it; leave it in place

addon.d.sh:
- remove old redundant recovery_actions call (it's also performed by setup_flashable in initialize)
- print ABI to match flash_script.sh output

boot_patch.sh:
- catch and abort on any errors from ramdisk.cpio patching in the future

util_functions.sh:
- fix hiding of mount_partitions /system_root umount stderr
- quote mount_apex .pb DEST name parsing charset for safety even though both work

Fixes #6828
2023-04-08 21:13:40 -07:00
3dd94672b0 Fix preinit scripts 2023-03-22 03:07:34 -07:00
4e2b88b3d0 Rename rules to preinit
It is possible that we will allow more preinit files for modules.
Rename the partition and folders from rules to preinit.
2023-03-21 00:40:11 -07:00
7048aa1014 Rename sepolicy.rules -> rules 2023-03-21 00:40:11 -07:00
33fb4653f0 Sanitize any bad chars from mount_apex apex_manifest.pb string parsing
For example, Lineage's com.android.ondevicepersonalization apex_manifest.pb has a # char, which strings keeps in its output, and breaks the mount for that apex before this fix
2023-03-17 02:44:36 -07:00
85a4b249b3 Skip copy old rule 2023-03-02 02:05:38 -08:00
9e8c68af12 Refactor sepolicy.rules resolve
We resolve available partitions for sepolicy.rules when patching
boot and bind mount the partition by magiskinit.

For older devices, the previous logic won't work because the part name
is never readable.

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2023-02-12 00:36:38 -08:00
d740bbe058 Ignore AMLogic "normal" slot suffix in scripts as well
Fixes #6572
2023-02-03 10:44:43 -08:00
0d38c94c9c scripts: fix root loss until reboot after Magisk addon.d-v2
- /system/bin/su was being removed in error from the live system so update remove_system_su to be aware of a running A/B OTA and generalize/simplify removal logic with relative paths to correctly run on the updated system slot
2022-12-23 16:36:44 -08:00
87801b6f23 Fix mv file when install module 2022-06-07 02:46:16 -07:00
97135879a1 Fix sepolicy rules dir is not found in recovery 2022-05-07 02:43:26 -07:00
e88eed9a8d Update util_functions.sh 2022-05-06 00:03:38 -07:00
b4c398542a Fix signboot signature 2022-05-06 00:00:20 -07:00
ff340ce3d8 Suppress verbose output to stderr 2022-04-29 04:57:28 -07:00
f639f39e79 More friendly info 2022-04-08 02:26:11 -07:00
01a1213463 /data/adb/magisk/magisk.apk no longer exists 2022-04-07 23:20:42 -07:00
50b159b43d Add init_boot parition 2022-03-02 22:50:05 -08:00
21505a7470 Update scripts for PATCHVBMETAFLAG 2022-01-12 02:29:34 -08:00
fd7bf2bc3a Support PATCHVBMETAFLAG env variable 2022-01-12 02:29:34 -08:00
de1b2b19b0 Only store sepolicy rules into partitions in ext4 format
Fix topjohnwu#5013
When installing from recovery, previous implementation may select f2fs partitions to store sepolicy rules, but magiskinit won't mount them and unable to load sepolicy rules.
2022-01-11 02:25:34 -08:00
f4ed6274a4 Invert vbmeta header patching config
vbmeta header should not be patched in most cases
2021-12-14 04:52:25 -08:00
228570640e Introduce KEEPVBMETAFLAG env variable
Close #4447, close #4906, close #4901, close #4964
2021-11-23 22:14:12 -08:00
68ac409bfd Scripts fixes and improvements
- ensure all scripts use $NVBASE $MAGISKBIN $POSTFSDATAD and $SERVICED where appropriate
- simplify new grep_cmdline() using xargs and more sed
- show correct active sepolicy $RULESDIR on devices with no encryption
- add support for Android 12 .capex (compressed apex) files
2021-11-20 14:17:02 -08:00
4dac9e40bd Support bootconfig on util_functions.sh
Close #4869
2021-11-07 11:22:21 -08:00
ff3f377911 scripts: touch up print_title
- stars aren't pounds, let's just call it a title bar :P
2021-10-31 10:53:55 -07:00