Commit Graph
117 Commits
Author SHA1 Message Date
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
osm0sis 51ed927b59 Backend: do apex mounts before /system bind to ensure a working env 2021-01-11 17:07:44 -04:00
osm0sis 8cf89c43ea Backend: fix sloppy/unpredictable cmd && this || that statements
- be a bit more POSIX to avoid any potential issues when stdout/err are redirected
2020-11-27 23:48:47 -04:00
osm0sis 53ce3e4073 Backend: add logical partition block mapper rw support
Thanks LuK1337 & erfanoabdi @ Lineage
2020-05-12 18:10:48 -03:00
osm0sis b3767d1978 Backend: try to preserve a working /etc/fstab on AOSP Q-based recovery 2020-05-12 18:02:30 -03:00
osm0sis c92c8c6972 Backend: don't do remounts for pushing modules in addon.d-v2 2020-02-18 12:48:52 -04:00
osm0sis 3f6d112472 AK3+Backend: fix truncated recovery.log with FlashAfterUpdate 2020-02-14 14:05:09 -04:00
osm0sis 273384db04 Backend: fixes for booted flashing and addon.d-v2
- only do setup_env and restore_env when in recovery to prevent environment/mount issues post-install
- use busybox [ for simple integer test to ensure known numerical operator behavior
2020-02-14 13:33:41 -04:00
osm0sis 5bec49dc98 Backend: simplify heredoc usage 2020-02-08 20:16:30 -04:00
osm0sis dfcfb87e6e Backend: support for upcoming recovery addon.d-v2
- for FlashAfterUpdate addon.d-v2 support while in recovery
- recovery addon.d-v2 requires /system and /system_root stay mounted
2020-02-04 16:09:00 -04:00
osm0sis 6bc4d96d3d Backend: add additional BOOTCLASSPATH entry for /apex mounts 2020-02-03 19:59:01 -04:00
osm0sis 3e5c6ba739 Backend: fix /system/bin/* execution on recoveries using LD_CONFIG_FILE 2020-02-03 17:07:08 -04:00
osm0sis e666adc66f AK3+Backend: mount and output fixes
- fix case where TWRP has /system_root mountpoint but ROM is non-SAR
- fix regression in ui_print when final character is \
2020-01-31 20:11:52 -04:00
osm0sis ebd2b04b2c Backend: work around some Lineage 17 (AOSP Q) Recovery issues
- Lineage 17 Recovery has some problems currently: /system mountpoint in ramdisk, neither /system nor /system_root in fstab (it has / instead, which is useless), ANDROID_ROOT=/system, and no /system_root symlink
- /etc is linked to /system/etc so once /system is mounted /etc/fstab is gone and no further simple mount commands will work so move other mounts before /system
- /system/bin are the only utilities available on PATH with none at all in /sbin so we need /apex files mounted immediately or no non-busybox commands will work after mounting /system over the recovery's skeleton /system
- not all devices have /dev/block/bootdevice symlinks, but at some point "broken recovery is broken" has to apply, so I don't intend to build out full system partition discovery for the SAR mount fallback
2020-01-29 14:24:41 -04:00
osm0sis c35c7ce358 AK3+Backend: /postinstall and opposite slot awareness for FlashAfterUpdate addon.d-v2 support
- for A/B OTAs my FlashAfterUpdate addon.d script requires the zip to know about addon.d-v2 and act accordingly
- signify support with #FLASHAFTERUPDATEV2 tag in updater-script to pass whitelist check since the majority of zips will not work correctly
2020-01-27 16:25:21 -04:00
osm0sis 03af96a541 Backend: fixes for mounting system on Lineage Recovery
- Lineage has a mindboggling: /system_root as mountpoint in ramdisk, neither /system nor /system_root in fstab (it has / instead, which is useless), ANDROID_ROOT=/system, and a possible symlink from /system to /system_root/system
- this failure to have a sensible, working fstab triggers the fallback to mounting directly from /dev/block/bootdevice which should exist on all modern devices which would need this SAR fallback
- add basic slot support for the fallback mount, since Lineage Recovery also doesn't make symlinks to the active slot partitions
2020-01-27 15:28:11 -04:00
osm0sis b772cca3ac Backend: put debugging down where it belongs too 2020-01-26 10:34:27 -04:00
osm0sis 062b44c75a Backend: work around ongoing TWRP SAR support fragmentation
TWRP now has 3(!) different competing implementations of SAR currently in use by maintainers:
1) /system as mountpoint in ramdisk/fstab and ANDROID_ROOT=/system, and possible symlink from /system_root to /system
2) /system_root as mountpoint in ramdisk/fstab, ANDROID_ROOT=/system_root, and possible symlink from /system to /system_root/system
3) /system_root as mountpoint in ramdisk/fstab, ANDROID_ROOT=/system, and possible symlink from /system to /system_root/system

Attempt to continue to accommodate this bullshit.
2020-01-24 14:54:39 -04:00
osm0sis be5c08b520 Backend: overdue clean up and refactor
- move checks to functions to isolate single-use variables as local
- signify globally available variables with capitalization
- move setup and mount to functions to mirror umount_all and restore_env
- cluster functions by use order (no call should preceed its function)
- use short circuit return tests to reduce indentation now that we use functions
2020-01-24 09:51:34 -04:00
osm0sis 7fb9efdb63 Backend: fix link restoration post-install 2020-01-21 06:16:45 -04:00
osm0sis b37d7e225f AK3+Backend: introduce systemless kernel modules support
- with do.systemless prop enabled in anykernel.sh, will push the contents of modules/ to create a simple "ak3-helper" Magisk module, where testing on devices thus far shows it loads early enough that even replacement kernel object .ko modules will get loaded
- the ak3-helper module info is populated from the kernel.string and parsed kernel version from the kernel being flashed, and if at boot time a different kernel is detected the module automatically removes itself before being loaded to avoid conflicts
- since logical partitions and ext4-dedup on Android 10 now prevent mounting /system or /vendor rw under any circumstances, this feature gives kernel developers back the freedom they had before all this to improve kernel .ko modules, .conf files, etc. with the added bonus of it cleaning up after itself
2020-01-18 07:21:46 -04:00
osm0sis bd279e6cba Backend: fix dalvikvm execution in recovery on Android 10 2020-01-15 12:38:24 -04:00
osm0sis d225890532 Backend: don't attempt to unmount /system_root when booted
- work around booted flashing apps like FKM/EXKM which make /system busy to keep it from being unmounted but can't do the same with /system_root which can lead to sketchy behavior
2020-01-15 11:49:40 -04:00
osm0sis 810de5296f Backend: APEX mounts support improvements 2020-01-12 02:22:30 -04:00
Zackptg5 648f23fdaa Should only run in recovery 2020-01-04 17:37:39 -04:00
Zackptg5 bb144e1a51 Add apex mount/umount (#48)
Add apex mounting for android Q so dynamic linked binaries and libs will work during install

* Add apex stuff
* Fix minor type
* Better minor type solution
* Update update-binary
2020-01-03 14:16:14 -04:00
osm0sis beec6a6114 Backend: further fixes for GSIs
- ro.vendor.build.product (from #44) doesn't appear to actually exist in nature, so replace it with ro.product.vendor.device for API 28+ devices, per https://github.com/phhusson/vendor_hardware_overlay/issues/25
- no need to check so many props for getprop parsing fallback check, simply look for ro.build.type which all devices should have in antiquity
2019-10-29 17:22:08 -03:00
osm0sis 07def96480 Backend: break early on getprop failure fallback when value found 2019-10-16 17:15:28 -03:00
osm0sis 6515f57493 Backend: fix getprop and devicecheck for GSIs
- add additional prop locations to getprop failure fallback
- add vendor props to devicecheck and getprop parsing fallback check to avoid false negatives on GSIs
- mask errors from devicecheck getprops as not all of them may exist on GSIs or non-GSIs

Thanks @lazerl0rd for the information and start on the changes

Closes #44
2019-10-16 17:05:52 -03:00
Chris Renshaw 98b1ac602f Backend: fix restore_env $bb commands
- this needs to be before cleanup so busybox will still be there
2019-08-29 01:27:02 -03:00
Chris Renshaw c6ccb4fa4e Backend: add /dev/random workaround for recovery
- per Chainfire, "fix slow RNG on some devices, which may cause installation to take weeks"
- it seems like this issue may have been triggered now in recovery on some devices by some of the changes from the new mounting rewrite
2019-08-27 13:37:49 -03:00
osm0sis a88936cd00 Backend: rewrite mount logic to properly cover all cases
- use $ANDROID_ROOT variable which in TWRP is set to /system_root on properly set up SAR devices and default set it to /system
- continue to correct any issues with /system and /system_root mountpoints but backup and restore any symlinks encountered
- only mount and umount /data when it is not mounted to begin with to fix MTP issues in TWRP on some devices (thanks @Zackptg5)
- refactor tear down into restore_env() function to allow restoring original recovery environment even after abort
- add lazy umounts because let's be thorough
- remove hacky workaround to avoid /system_root umount when booted since that should be handled by flashing app now
2019-08-17 22:50:48 -03:00
Chris Renshaw e2987e3947 Backend: mask error on TWRP devices without /system_root in fstab 2019-08-13 20:36:00 -03:00
Chris Renshaw ff4f310e3a Backend: support TWRP devices with /system_root in fstab 2019-08-13 09:16:34 -03:00
osm0sis 01db339f65 Backend: mounting fixes, simplify ui_printing from files
- rename unmount_all to umount_all since it's been bugging me for a while ;)
- refactor mountpoint setup into its own function
- try mount --move first since /system should already be mounted (thanks @Zackptg5)
- refactor reused script to ui_print from files into its own function
2019-08-12 23:40:53 -03:00
Chris Renshaw 4f722f3d67 Backend: fix derp 2019-08-07 00:31:31 -03:00
osm0sis 146c834d0f Backend: ensure /system_root umount even if /system is a symlink 2019-08-06 20:10:53 -03:00