Hope someone finds this helpful:
Spoiler
#!/bin/bash
#
#****************************************************************
## set shortcuts
out=~/android/system/out/target/product/passion
work=~/Desktop/custom_nexus
## Remove app list
rm_apk_list="AndroidTerm.apk CarHomeGoogle.apk CarHomeLauncher.apk Development.apk Facebook.apk Gmail.apk GoogleQuickSearchBox.apk googlevoice.apk HtcCopyright.apk HtcEmailPolicy.apk HtcSettings.apk LatinImeTutorial.apk Maps.apk Protips.apk Street.apk Superuser.apk Twitter.apk VoiceSearch.apk YouTube.apk"
#****************************************************************
setup () {
cd ~/android/system
clear
echo "Do you want to clobber the /out directory?"
echo "Clobbering may prevent errors with the build, but it will make the build take much longer."
echo "If you are not experiencing issues, there is no need to clobber."
echo "'yes' to clobber, anything else to not clobber"
read clob
echo "Do you want to sync repo?"
echo "Syncing repo will give you the latest updates, but it can take a while."
echo "If you haven't synced in a day or two, you should probably sync."
echo "'yes' to sync repo, anything else to skip syncing repo."
read rs
}
#****************************************************************
gapps () {
cd ~/android/system/vendor/cyanogen
./get-google-files -v hdpi #needed to be fixed in source, manually fix and run for now
}
#****************************************************************
rsync () {
if [ "$rs" == "yes" ]; then
repo sync
fi
}
#****************************************************************
clobb () {
if [ "$clob" == "yes" ]; then
make clobber
fi
}
#****************************************************************
prep_build () {
clear
cd ~/android/system
cp ./vendor/cyanogen/products/cyanogen_passion.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_passion-eng
}
#****************************************************************
build () {
clear
make -j`grep 'processor' /proc/cpuinfo | wc -l` CYANOGEN_WITH_GOOGLE=true CYANOGEN_NIGHTLY=true otapackage
}
#****************************************************************
prep_customize () {
## copy finished .zip to work directory
zip1=`ls $out | grep ota | grep -v md5`
cp $out/$zip1 $work/temp/$zip1
## unzip and clean up
cd $work/temp
unzip $zip1
rm $zip1
}
#****************************************************************
customize () {
## Add apps
cp $work/add_apk/* $work/temp/system/app/
## Replace default audio
rm -rf $work/temp/system/media/audio
cp -R $work/replace_media/audio $work/temp/system/media/
## Remove unwanted apps (from Remove app list)
for apk in $rm_apk_list; do
echo " Removing $apk"
rm $work/temp/system/app/$apk
done
## Zip
cd $work/temp/
zip -r $zip1 *
}
#****************************************************************
squish () {
## make backup of 'orginial' .zip (this will make it easier/faster/cleaner to make subsequent builds)
cp $out/$zip1 $out/$zip1.bak
## move to /out and squish
cp $work/temp/$zip1 $out/$zip1
~/android/system/vendor/cyanogen/tools/squisher
}
#****************************************************************
clean_up () {
## move and rename finished file
zip2=`ls $out | grep update | grep -v md5`
cp $out/$zip2 $work/finished/passion_custom_`date +%y.%j`.zip
## restore backup and cleanup
mv $out/$zip1.bak $out/$zip1
rm -rf $work/temp/*
rm -f $out/update*
}
#****************************************************************
setup
#gapps
rsync
clobb
prep_build
build
prep_customize
customize
squish
clean_up
#!/bin/bash
#
#****************************************************************
## set shortcuts
out=~/android/system/out/target/product/passion
work=~/Desktop/custom_nexus
## Remove app list
rm_apk_list="AndroidTerm.apk CarHomeGoogle.apk CarHomeLauncher.apk Development.apk Facebook.apk Gmail.apk GoogleQuickSearchBox.apk googlevoice.apk HtcCopyright.apk HtcEmailPolicy.apk HtcSettings.apk LatinImeTutorial.apk Maps.apk Protips.apk Street.apk Superuser.apk Twitter.apk VoiceSearch.apk YouTube.apk"
#****************************************************************
setup () {
cd ~/android/system
clear
echo "Do you want to clobber the /out directory?"
echo "Clobbering may prevent errors with the build, but it will make the build take much longer."
echo "If you are not experiencing issues, there is no need to clobber."
echo "'yes' to clobber, anything else to not clobber"
read clob
echo "Do you want to sync repo?"
echo "Syncing repo will give you the latest updates, but it can take a while."
echo "If you haven't synced in a day or two, you should probably sync."
echo "'yes' to sync repo, anything else to skip syncing repo."
read rs
}
#****************************************************************
gapps () {
cd ~/android/system/vendor/cyanogen
./get-google-files -v hdpi #needed to be fixed in source, manually fix and run for now
}
#****************************************************************
rsync () {
if [ "$rs" == "yes" ]; then
repo sync
fi
}
#****************************************************************
clobb () {
if [ "$clob" == "yes" ]; then
make clobber
fi
}
#****************************************************************
prep_build () {
clear
cd ~/android/system
cp ./vendor/cyanogen/products/cyanogen_passion.mk ./buildspec.mk
. build/envsetup.sh
lunch cyanogen_passion-eng
}
#****************************************************************
build () {
clear
make -j`grep 'processor' /proc/cpuinfo | wc -l` CYANOGEN_WITH_GOOGLE=true CYANOGEN_NIGHTLY=true otapackage
}
#****************************************************************
prep_customize () {
## copy finished .zip to work directory
zip1=`ls $out | grep ota | grep -v md5`
cp $out/$zip1 $work/temp/$zip1
## unzip and clean up
cd $work/temp
unzip $zip1
rm $zip1
}
#****************************************************************
customize () {
## Add apps
cp $work/add_apk/* $work/temp/system/app/
## Replace default audio
rm -rf $work/temp/system/media/audio
cp -R $work/replace_media/audio $work/temp/system/media/
## Remove unwanted apps (from Remove app list)
for apk in $rm_apk_list; do
echo " Removing $apk"
rm $work/temp/system/app/$apk
done
## Zip
cd $work/temp/
zip -r $zip1 *
}
#****************************************************************
squish () {
## make backup of 'orginial' .zip (this will make it easier/faster/cleaner to make subsequent builds)
cp $out/$zip1 $out/$zip1.bak
## move to /out and squish
cp $work/temp/$zip1 $out/$zip1
~/android/system/vendor/cyanogen/tools/squisher
}
#****************************************************************
clean_up () {
## move and rename finished file
zip2=`ls $out | grep update | grep -v md5`
cp $out/$zip2 $work/finished/passion_custom_`date +%y.%j`.zip
## restore backup and cleanup
mv $out/$zip1.bak $out/$zip1
rm -rf $work/temp/*
rm -f $out/update*
}
#****************************************************************
setup
#gapps
rsync
clobb
prep_build
build
prep_customize
customize
squish
clean_up
Edited by pconwell, 30 October 2010 - 08:43 PM.














