Skip to content

Commit

Permalink
update for pie
Browse files Browse the repository at this point in the history
  • Loading branch information
Micha-Btz committed Aug 21, 2019
1 parent a639a6d commit 82ce62a
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 59 deletions.
Binary file modified META-INF/com/google/android/update-binary
Binary file not shown.
11 changes: 6 additions & 5 deletions META-INF/com/google/android/updater-script
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ui_print("Installing swipelib addon...");
ui_print("Installing swipelib pie addon...");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_file("mount-system.sh", "/tmp/mount-system.sh");
package_extract_file("unmount-system.sh", "/tmp/unmount-system.sh");
Expand All @@ -9,11 +9,12 @@ run_program("/tmp/mount-system.sh") == 0 || abort("Could not mount /system");
if getprop("ro.build.system_root_image") != "true" then
package_extract_dir("system", "/system");
set_metadata("/system/addon.d/78-swipelib.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/app/LatinIME/lib/arm64/libjni_latinimegoogle.so", "uid", 0, "gid", 0, "mode", 0644, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/lib64/libjni_latinimegoogle.so", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");

else
package_extract_dir("system", "/system/system");
set_metadata("/system/system/addon.d/78-swipelib.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/system/app/LatinIME/lib/arm64/libjni_latinimegoogle.so", "uid", 0, "gid", 0, "mode", 0644, "selabel", "u:object_r:system_file:s0");
package_extract_dir("system", "/system_root/system");
set_metadata("/system_root/system/addon.d/78-swipelib.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
set_metadata("/system_root/system/lib64/libjni_latinimegoogle.so", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
endif;

run_program("/tmp/unmount-system.sh") == 0 || ui_print("Could not unmount /system");
Expand Down
45 changes: 26 additions & 19 deletions mount-system.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
#!/sbin/sh

if mount /system; then
# Modern devices use /system as root ("/")
system_as_root=`getprop ro.build.system_root_image`
if [ "$system_as_root" == "true" ]; then
if mount /system_root; then
exit 0
fi
fi

# Try to get the block from /etc/recovery.fstab
block=`cat /etc/recovery.fstab | cut -d '#' -f 1 | grep /system | grep -o '/dev/[^ ]*' | head -1`
if [ -n "$block" ] && mount $block /; then
active_slot=`getprop ro.boot.slot_suffix`
if [ ! -z "$active_slot" ]; then
block=/dev/block/bootdevice/by-name/system$active_slot
else
block=/dev/block/bootdevice/by-name/system
fi
mkdir -p /system_root
if mount -o rw $block /system_root ||
mount -o rw $block /system_root -t ext4 ||
mount -o rw $block /system_root -t f2fs; then
exit 0
fi
fi
else
if mount /system; then
exit 0
fi

# Modern devices use /system as root ("/")
#system_as_root=`getprop ro.build.system_root_image`
#if [ "$system_as_root" == "true" ]; then
# active_slot=`getprop ro.boot.slot_suffix`
# if [ ! -z "$active_slot" ]; then
# block=/dev/block/bootdevice/by-name/system$active_slot
# else
# block=/dev/block/bootdevice/by-name/system
# fi
# if mount -o rw $block /system_root && mount /system_root /system; then
# exit 0
# fi
#fi
# Try to get the block from /etc/recovery.fstab
block=`cat /etc/recovery.fstab | cut -d '#' -f 1 | grep /system | grep -o '/dev/[^ ]*' | head -1`
if [ -n "$block" ] && mount $block /system; then
exit 0
fi
fi

exit 1
Binary file removed signapk.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion system/addon.d/78-swipelib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

list_files() {
cat <<EOF
/system/app/LatinIME/lib/arm64/libjni_latinimegoogle.so
/system/lib64/libjni_latinimegoogle.so
/system/addon.d/78-swipelib.sh
EOF
}
Expand Down
File renamed without changes.
Binary file removed testkey.pk8
Binary file not shown.
27 changes: 0 additions & 27 deletions testkey.x509.pem

This file was deleted.

8 changes: 4 additions & 4 deletions unmount-system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Modern devices use /system as root ("/")
system_as_root=`getprop ro.build.system_root_image`
if [ "$system_as_root" == "true" ]; then
if umount /system && umount /system_root; then
if umount /system_root; then
exit 0
fi
fi

if umount /system; then
else
if umount /system; then
exit 0
fi
fi

exit 1
6 changes: 3 additions & 3 deletions zip.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#! /bin/bash
FILE=swipelib
VERSION=v0.5.2
CM_Version=lineage-15.1
VERSION=v0.6.2
CM_Version=lineage-16.0
NAME=($FILE-$CM_Version-$VERSION)

echo "Making Zip"
# zipping
zip -r $NAME.zip system/* META-INF/* mount-system.sh unmount-system.sh
echo "ZIP is Ready"
echo "Signing ZIP"
java -jar signapk.jar testkey.x509.pem testkey.pk8 $NAME.zip $NAME-SIGNED.zip
java -jar /usr/share/signapk/signapk.jar --min-sdk-version 25 buildtools/testkey.x509.pem buildtools/testkey.pk8 $NAME.zip $NAME-SIGNED.zip
# Cleanup
echo "Cleaning up"
rm $NAME.zip
Expand Down

0 comments on commit 82ce62a

Please sign in to comment.