Created
October 4, 2016 14:28
-
-
Save shriduttkothari/b255092c1ec4c32de97ffb038110151e to your computer and use it in GitHub Desktop.
opengapps integration script for android-x86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
prog=$(basename $0) | |
if [ ! -f build/envsetup.sh ]; then | |
echo ${prog}: Please cd to the directory you ran \'repo init\' in. | |
exit 1 | |
fi | |
source build/envsetup.sh | |
product=$(echo "$ANDROID_PRODUCT_OUT" | rev | cut -d/ -f1 | rev) | |
if [ -z "$product" ] | |
then | |
echo ${prog}: 'Please specify product by running "lunch [...]" to set $ANDROID_PRODUCT_OUT variable' | |
exit 1 | |
fi | |
pushd $(dirname $0) > /dev/null | |
echo "1. cleaning up..." | |
rm -rf tmp/* &> /dev/null | |
mkdir tmp/ &> /dev/null | |
echo "2. unpacking gapps archive..." | |
unzip *.zip -d tmp/ | |
echo "3. unpacking individual component archives..." | |
cd tmp/ | |
mkdir unpacked | |
find -name '*.tar.lz' | xargs -n 1 tar -px -C unpacked -f | |
echo "4. setting file permissions to 644..." | |
find unpacked/ -type f -exec chmod 644 {} + | |
echo "5. putting folder structure together..." | |
mkdir combined | |
find unpacked/ -type f | xargs -n 1 -I@ sh -c 'cd `echo "@" | cut -d/ -f1-3`; file=`echo "@" | cut -d/ -f4-`; rsync -R $file ../../../combined; cd ../../../' | |
echo "6. copying files into ${ANDROID_PRODUCT_OUT}/system ..." | |
rsync -r combined/ ${ANDROID_PRODUCT_OUT}/system | |
echo "7. removing system.img and system.sfs to force their rebuild" | |
rm -rf ${ANDROID_PRODUCT_OUT}/obj/PACKAGING/systemimage_intermediates/* | |
rm -f ${ANDROID_PRODUCT_OUT}/system.sfs | |
# rm -rf ${ANDROID_PRODUCT_OUT}/system/priv-app/PackageInstaller | |
rm -rf ${ANDROID_PRODUCT_OUT}/system/priv-app/GooglePackageInstaller | |
popd > /dev/null | |
echo "8. operations complete, please rebuild android" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment