Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Created April 21, 2015 19:59
Show Gist options
  • Save invisiblek/106f7b353ca98bdd1546 to your computer and use it in GitHub Desktop.
Save invisiblek/106f7b353ca98bdd1546 to your computer and use it in GitHub Desktop.
#!/bin/bash
cmversion=12.1
twrpversion=5.1
tags='+(linaro|twrp)'
shopt -s extglob
while [ $# -gt 0 ]; do
case $1 in
careful) set -e;;
$tags) eval $1="true";;
11.0) cmversion=$1; twrpversion=4.4;;
12.0) cmversion=$1; twrpversion=5.0;;
12.1) cmversion=$1; twrpversion=5.1;;
*) ;;
esac
shift
done
source build/envsetup.sh > /dev/null
rm -f ~/.bin/repopicks-tmp
touch ~/.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-$cmversion
cp ~/.bin/repopicks-tmp ~/.bin/repopicks-$cmversion
rm -f ~/.bin/repopicks-tmp
while read line; do
[[ ${line:0:1} == '#' ]] && continue;
[ "$line" == "" ] && continue
dir=`echo $line | awk '{print $1}'`
case $dir in
skip) continue;;
$tags) if [[ $(eval echo \$$dir) == "true" ]]; then
dir=`echo $line | awk '{print $2}'`
commit=`echo $line | awk '{print $3}'`
else
continue;
fi;;
*) commit=`echo $line | awk '{print $2}'`;;
esac
cd $dir
git cherry-pick $commit
cd -
done < ~/.bin/cherrypicks-$cmversion
if [ "$twrp" == "true" ]; then
cd bootable/recovery
git fetch twrp
git reset --hard twrp/android-$twrpversion
cd -
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment