Skip to content

Commit

Permalink
neutrino: anykernel.sh: Support both OOS and custom ROMs in the same zip
Browse files Browse the repository at this point in the history
We can build both images and include them in the zip then
dynamically move them to where they need to go.

This is an extension of what we used to do with OnePlus6T (da88709)

However, things have gotten a little more complicated this time
around with the inordinate amount of device variants and codenames
that we're supporting here. Furthermore, OnePlus7(Pro) device
build.props contain two instances of ro.build.user/ro.build.flavor
each, thus we've included a secondary file_getprop function to
accommodate this unusual scenario and ensure that we're returning
the desired match when handling those devices.

[@0ctobot: Adapted from nathanchance/AnyKernel2-archive@bfa82cf]
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
  • Loading branch information
0ctobot committed Jan 13, 2020
1 parent 911c164 commit 8ef1e1a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
kernels/
version
19 changes: 19 additions & 0 deletions anykernel.sh
Expand Up @@ -38,6 +38,25 @@ ramdisk_compression=auto
set_perm_recursive 0 0 755 644 $ramdisk/*;
set_perm_recursive 0 0 750 750 $ramdisk/init* $ramdisk/sbin;

## Select the correct image to flash
hotdog="$(grep -wom 1 hotdog*.* /system/build.prop | sed 's/.....$//')";
guacamole="$(grep -wom 1 guacamole*.* /system/build.prop | sed 's/.....$//')";
userflavor="$(file_getprop /system/build.prop "ro.build.user"):$(file_getprop /system/build.prop "ro.build.flavor")";
userflavor2="$(file_getprop2 /system/build.prop "ro.build.user"):$(file_getprop2 /system/build.prop "ro.build.flavor")";
if [ "$userflavor" == "jenkins:$hotdog-user" ] || [ "$userflavor2" == "jenkins:$guacamole-user" ]; then
os="stock";
os_string="OxygenOS";
else
os="custom";
os_string="a custom ROM";
fi;
ui_print " " "You are on $os_string!";
if [ -f $home/kernels/$os/Image.gz-dtb ]; then
mv $home/kernels/$os/Image.gz-dtb $home/Image.gz-dtb;
else
ui_print " " "There is no kernel for your OS in this zip! Aborting..."; exit 1;
fi;

## AnyKernel install
dump_boot;
write_boot;
Expand Down
6 changes: 6 additions & 0 deletions tools/ak3-core.sh
Expand Up @@ -35,6 +35,12 @@ contains() {
file_getprop() {
grep "^$2=" "$1" | cut -d= -f2-;
}
### Added to standardize OnePlus7(Pro) device detection

# file_getprop2 <file> <property>
file_getprop2() {
grep "^$2=" "$1" | cut -d= -f2- | sed -n 2p;
}
###

### file/directory attributes functions:
Expand Down

0 comments on commit 8ef1e1a

Please sign in to comment.