Commit Graph
153 Commits
Author SHA1 Message Date
osm0sis cea8f976cd AK3+Backend: remove all backwards compat (it's been years) 2026-06-28 09:07:23 -03:00
osm0sis c2e5f7e841 Backend: move tools higher in the PATH
- avoids conflicts with any utilities that might also be part of busybox
2024-05-09 13:32:46 -03:00
osm0sis f1e1a32c60 Backend: improve modules rw remount output 2023-09-20 10:37:49 -03:00
osm0sis 04376fbe3e Backend: work around KernelSU not processing modules on initial install
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: https://github.com/tiann/KernelSU/issues/945
2023-09-13 16:01:35 -03:00
Chris Renshaw b9df8b892f Backend: add vendor security patch checking 2023-08-22 01:51:39 -03:00
Chris Renshaw a5ce1c04d1 Backend: hide shcon workaround stderr on (likely) working recoveries
- some recoveries don't allow reading/changing shell context and will show an error:

sh: write error: Invalid argument

- these recoveries seem to allow loop mounts unlike most LOS Recovery builds lately, so hide the error output
2023-08-10 12:36:28 -03:00
Chris Renshaw 9ab60a49de Backend: work around for chcon on broken recoveries 2023-08-01 11:04:26 -03:00
Chris Renshaw 4030d36655 AK3+Backend: helper module improvements and full KernelSU support
- only parse kernel strings when both do.modules=1 and do.systemless=1 are set
- support post-fs-data.sh in systemless kernel helper module (gets renamed and sourced from the built-in one)
- show systemless kernel helper module as an update pending reboot in module apps if flashed while booted
- add system_ext support to systemless kernel helper module
- show a warning during flash if systemless kernel helper module is configured but there's no decrypted /data access to be able to install it
- detect the installed KernelSU app as the indicator the user intends to use KernelSU, and install systemless kernel helper module to modules_update.img accordingly
- do KernelSU directory setup and create modules_update.img if this appears to be the initial KernelSU install
- set all systemless kernel helper module files to system_file context, since unlabeled files are not gracefully handled by KernelSU (they trigger a reboot and the module gets rejected)

NOTE: currently it appears KernelSU won't parse the modules_update.img on the first boot where it sets itself up from initial KernelSU install, but it will then do it after the following reboot. Hopefully this can be fixed by a future KernelSU release so that the systemless kernel helper module is active right away as this might be necessary to boot fully on some devices
2023-07-16 16:33:47 -03:00
osm0sis 0b37d0bfa4 AK3+Backend: add preliminary KernelSU support 2023-07-04 15:32:02 -03:00
osm0sis c878b3e62b Backend: fix loop mounts on newer Lineage-based recoveries
- loops would fail only in LOS Recovery from direct mount .img and losetup .img+loop mount with, e.g. "mount: mounting /dev/block/loop0 on /apex/com.android.adbd failed: Invalid argument"
- this started ~LOS19, I believe, though I haven't tracked down the specific change yet
- confusing to diagnose, since it always works in recovery adb shell, until I realized there was a context difference: "su" for adb shell and "recovery" for zip flashes
- switch shell context temporarily to "su" to do apex mounts, then return to original context (currently only necessary for mounting loops)
2023-05-26 07:25:10 -03:00
osm0sis 5c916de64c Backend: abort apex loop mounts early if failing
- /dev/block/loop* nodes don't behave correctly in Lineage Recovery anymore (beginning ~ LOS19), not sure why, but mount and losetup can't use them
- bail out early so we don't slow the install to a crawl with the rapid mount failures
2023-05-25 18:36:51 -03:00
osm0sis f4cbd4b68d Backend: fixup now that mount_apex direct .img mount works 2023-05-24 15:26:02 -03:00
osm0sis 8055e75b8e Backend: move busybox bin setup to setup_bb function, add tools to PATH 2023-05-06 15:21:34 -03:00
osm0sis ba82924dab AK3+Backend: pass AKHOME via export 2023-05-03 15:45:34 -03:00
osm0sis dee204c197 Backend: simpify getprop replacement propval return 2023-05-03 15:32:06 -03:00
osm0sis b3c769f1db AK3+Backend: use busybox as much as possible + OLD_PATH for exceptions 2023-04-23 00:09:54 -03:00
osm0sis f080b80e30 Backend: refactor mount_all and umount_all
- only umount /metadata and /persist if not already mounted, as some recoveries have these always mounted
- combine into list of possibly pre-mounted partitions to umount
2023-04-22 08:18:14 -03:00
osm0sis c45a8d52c0 Backend: support /metadata mount + debugging improvements
- look for .ak3-debugging file in /tmp /cache /metadata or /persist to allow debugging better on recoveries that only support sideload
- use /tmp for ak3-debug.tgz if sideloading, and fix .tgz compression when apex fails to mount
2023-04-21 16:42:22 -03:00
osm0sis 8588147d67 Backend: fix byname finding on modern Android versions for devices without super
- /dev/block/mapper exists on all devices with apex but only contains system partition symlinks on devices with super partition logical partitions
2023-04-05 23:19:05 -03:00
osm0sis 7a3e6df8ca Backend: fix showing ui_printfile padding char in error when booted 2023-03-23 17:05:57 -03:00
osm0sis 7c8c1e7e9b Backend: fix ui_printfile on Lineage-based recoveries
- add padding character to work around bad handling of leading whitespace which CWM-based and TWRP-based both handle fine
2023-03-16 17:10:24 -03:00
osm0sis 398b9631df Backend: correct build.prop locations for getprop replacement
- system_ext and odm only have build.prop in /<partition>/etc
- product may have build.prop in /product and/or /product/etc
2023-02-08 12:56:54 -04:00
osm0sis c2e33f95d1 AK3+Backend: support AMLogic devices where A-only sets slot=normal 2023-02-08 12:53:48 -04:00
osm0sis e49ea0be95 Backend: don't unmount any existing apex at start of flash 2023-01-08 14:03:30 -04:00
osm0sis e4e0c0eecb Backend: add useful mount debugging stderr for logs 2023-01-05 23:30:47 -04:00
osm0sis c713211a84 Backend: pass ZIPFILE name into AK3 core env 2022-11-11 08:10:07 -04:00
osm0sis 4ebf8e538c Backend: add id to helper module.prop so 3rd party mgr apps are happy 2022-04-28 23:36:54 -03:00
osm0sis 1edb7e9f39 Backend: fix devicecheck now that we can't abuse file_getprop with .* 2021-12-11 00:15:34 -04:00
osm0sis 66f42c1951 AK3+Backend: grep cleanups
- fix duplicate kernel version (vertmp) entries from some kernels
- don't use head when grep -m1 will suffice
- fix some (bad) OEM prop files including entries twice, use last entry like live system
2021-12-10 17:34:54 -04:00
osm0sis d432fd5721 Backend: support Android 12 .capex (compressed apex) files 2021-11-18 15:58:06 -04:00
osm0sis d5572891d9 Backend: fix apex mounts on fastboot boot'd TWRP
- work around different /apex environment causing loop mounts to fail on TWRP only when it's initiated by `fastboot boot twrp.img`
2021-10-18 11:43:01 -03:00
osm0sis 049180b3cd Backend: update apex support
- support unmounting TWRP's mounted apex files to avoid conflicts
- hide less apex u/mount stderr to aid future debugging
2021-10-16 14:54:06 -03:00
osm0sis 52aec65a1b Backend: use stderr for consistency with other debug output 2021-10-04 22:34:26 -03:00
osm0sis 42611f420b Backend: adjust AK_BASE_VERSION placement in output 2021-10-03 14:53:40 -03:00
osm0sis b32e4ceb6e Backend: fix module installation if apex mounts fail 2021-10-02 00:36:20 -03:00
osm0sis fc43a2a1a9 Backend: print AK_BASE_VERSION to stdout in script output 2021-10-01 19:20:43 -03:00
osm0sis f88f90e3d2 Backend: underps and regression fixes
- fallback by-name system mount may still result in /system at /system_root so add back check
- add missing /persist mountpoint
2021-09-15 00:02:22 -03:00
osm0sis 84caeb46e5 Backend: more partition mount fixes
- attempt to mount other partitions whether determined as /system or /system_root
- /system_root by that point if mounted will actually be /system_root so no need for further checks
- add missing /system_ext entries to custom getprop and cleanup functions
2021-09-14 17:10:11 -03:00
osm0sis 4dfc45a6b2 Backend: check before mounts, fix persist mount on Virtual A/B 2021-09-11 00:05:52 -03:00
osm0sis d705b13c45 Backend: mount cleanups and add system_ext support 2021-09-10 00:21:03 -03:00
osm0sis 5035d6b7cb AK3+Backend: fix systemless modules on multi-partition setups 2021-06-08 17:00:03 -03:00
osm0sis 0ec87a86b7 Backend: update apex mounting support for Android 11 2021-03-30 02:28:43 -03:00
osm0sis a1d0b70305 Backend: one more umount_all() touch-up 2021-02-02 23:06:59 -04:00
osm0sis 8df26b0389 AK3+Backend: cleanups, update *_line functions
- touch up a couple pesky minor things
- add global scope to replace_line and remove_line so they match replace_string, and can now work on all matches found in a file
2021-01-28 17:31:33 -04:00
osm0sis 02329ba5a5 Backend: add /product and /persist support 2021-01-18 16:08:36 -04:00
osm0sis 376be8cd93 Backend: clean up old style tic 2021-01-18 15:46:41 -04:00
osm0sis 25d89a6123 Backend: fix apex unmounting during addon.d-v2 2021-01-14 14:17:01 -04:00
osm0sis 1991a6a6a6 Backend: slot detection and mounting fixes
- remove unnecessary slot swapping since this is already handled with $POSTINSTALL and FlashAfterUpdate addon.d-v2's setup
- add cache mounting into main functions
- rename slot function to bring in line with my other projects
2021-01-14 01:31:14 -04:00
osm0sis 9cdec62256 Backend: mounting improvements
- don't rely on props if possible: determine dynamic/logical partitions from /dev/block/mapper presence, and detect slots more robustly using props and cmdline as in AK3 Core
- fix opposite slot detection for pushing modules to system and/or vendor during addon.d-v2
2021-01-13 23:53:52 -04:00
osm0sis 4006d35666 Backend: support mounting dynamic partitions from /dev/block/mapper 2021-01-11 23:48:21 -04:00