diff --git a/build/meta/com/google/android/update-binary b/build/meta/com/google/android/update-binary new file mode 100644 index 0000000..d521d5a --- /dev/null +++ b/build/meta/com/google/android/update-binary @@ -0,0 +1,81 @@ +#!/sbin/sh + +ZIP=$3 + +set_con() { + $UTILS chcon -h u:object_r:"$1":s0 $2 + $UTILS chcon u:object_r:"$1":s0 $2 +} + +set_perm() { + $UTILS chmod $1 $2 +} + +set_owner() { + $UTILS chown $1:$2 $3 +} + +ui_print "*****************" +ui_print "Gapps installer" +ui_print "*****************" + +ui_print "Mounting /system" + +if mount /system; then + ui_print "/system mounted" +else +# 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 + ui_print "Could not mount /system! Aborting..." + exit 1 +else + ui_print "/system mounted" +fi +fi + +if [ -f /system/bin/toybox ]; then +UTILS=/system/bin/toybox +else +ui_print "Could not find /system/bin/toybox! Aborting..." +exit 1 +fi + + +ui_print "Extracting files" +cd /tmp +mkdir system +cd system +unzip -o "$ZIP" +DIRS="addon.d app priv-app framework etc lib" +if [ -d /system/lib64 ]; then +DIRS="$DIRS lib64" +fi +for dirs in $DIRS; do +set_perm 0755 $dir +for d in `$UTILS find ./$dir -type d`; do +set_perm 0755 $d +set_owner system system $d +done +for f in `$UTILS find ./$dir -type f`; do +type=$(echo "$f" | sed 's/.*\.//') +if [ "$type" == "sh" ] || [ "$type" == "$f" ]; then +set_perm 0755 $f +else +set_perm 0644 $f +fi +set_owner system system $f +set_con system_file $f +done +done +ui_print "Copying files" +$UTILS cp --preserve=a -r ./* /system/ +ui_print "Cleaning up files" +cd ../ +$UTILS rm -rf system/ + +ui_print "Unmounting /system" +umount /system + +ui_print "Done!" +exit 0 diff --git a/build/meta/com/google/android/updater-script b/build/meta/com/google/android/updater-script new file mode 100644 index 0000000..028ff5c --- /dev/null +++ b/build/meta/com/google/android/updater-script @@ -0,0 +1 @@ +# this is a dummy file, the magic is in update-binary, which is a shell script