Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Created March 5, 2015 19:52
Show Gist options
  • Save invisiblek/86da7cf70e520a76be96 to your computer and use it in GitHub Desktop.
Save invisiblek/86da7cf70e520a76be96 to your computer and use it in GitHub Desktop.
#!/bin/bash
version=12.0
while [ $# -gt 0 ]; do
case $1 in
careful) set -e;;
twrp) twrp=true;;
*) ;;
esac
shift
done
source build/envsetup.sh > /dev/null
rm -f ~/.bin/repopicks-tmp
while read line; do
if [[ ${line:0:1} == '#' ]] || [ "$line" == "" ]; then
echo $line >> ~/.bin/repopicks-tmp
continue
fi
p=`echo $line | awk '{print $1}'`
if [ "$p" != "skip" ]; then
output=`repopick $p`
if [[ "$output" != "${output/'Commit already merged. Skipping the cherry pick.'}" ]]; then
echo "removing $p from the script"
/home/dp/.bin/email "[email protected]" "[email protected]" "Merged cherry pick removed from auto pick script" "\n\n$line" "invisiblek.org" "[email protected]"
continue
fi
fi
echo $line >> ~/.bin/repopicks-tmp
echo ""
done < ~/.bin/repopicks-$version
cp ~/.bin/repopicks-tmp ~/.bin/repopicks-$version
rm -f ~/.bin/repopicks-tmp
while read line; do
if [[ ${line:0:1} == '#' ]] || [ "$line" == "" ]; then
continue
fi
dir=`echo $line | awk '{print $1}'`
if [ "$dir" != "skip" ]; then
if [ "$dir" == "twrp" ]; then
if [ "$twrp" == "true" ]; then
dir=`echo $line | awk '{print $2}'`
commit=`echo $line | awk '{print $3}'`
else
continue
fi
else
commit=`echo $line | awk '{print $2}'`
fi
cd $dir
git cherry-pick $commit
cd -
fi
done < ~/.bin/cherrypicks-$version
if [ "$twrp" == "true" ]; then
cd bootable/recovery
git fetch twrp
git reset --hard twrp/android-5.0
cd -
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment