Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Applies a certain patch (cherry) to multiple CyanogenMod kernels and pushes the patch to review.cyanogenmod.org
#!/bin/bash
set -o errexit
cherry="680ff7911e5d0701e81cd0d0d5235b300ce44a86"
patchname="gadget_cdrom"
changeid="Idf83c74815b1ad370428ab9d3e5503d5f7bcd3b6"
branch="cm-11.0"
broken_kernels=(acer_t20-common acer_t30 amazon_bowser-common amazon_otter-common samsung_msm8930-common samsung_piranha samsung_smdk4412 samsung_t1 samsung_tuna sony_mam7x27a-legacy sony_msm7x27a-legacy sony_msm8660)
kernels=(asus_grouper asus_tf101 asus_tf201 asus_tf300t asus_tf700t asus_tf701t bn_acclaim bn_encore bn_omap goldfish google_msm google_steelhead htc_endeavoru htc_enrc2b htc_m7 htc_msm8660 htc_msm8960 htc_msm8974 lge_hammerhead lge_ls970 lge_msm8974 lge_v500 lge_v909 motorola_msm8226 motorola_msm8960-common motorola_msm8960dt-common motorola_omap4-common motorola_omap4-kexec-common oneplus_msm8974 oppo_find5 oppo_n1 samsung_aries samsung_crespo samsung_d2 samsung_epicmtd samsung_espresso10 samsung_exynos5410 samsung_galaxytab-cdma samsung_hlte samsung_jf samsung_manta samsung_mondrianwifi samsung_msm8660-common samsung_msm8660-q1 samsung_n1 samsung_p1 samsung_p4 samsung_smdk4210 samsung_victory sony_apq8064 sony_msm7x27a sony_msm8930 sony_msm8960t sony_msm8974 sony_msm8974pro sony_msm8x60 toshiba_betelgeuse xiaomi_aries)
for kernel in ${kernels[@]}
do
git remote add cm_${kernel} git://github.com/CyanogenMod/android_kernel_${kernel} 2> /dev/null || true
if ! git fetch cm_${kernel}; then
echo "Failed to fetch cm_${kernel}: cancel"
continue
fi
if ! git show-ref --quiet remotes/cm_${kernel}/${branch} > /dev/null 2>&1; then
echo "Branch ${branch} not found for cm_${kernel}"
continue
fi
if [ "$(git --no-pager log --quiet --grep="Change-Id: ${changeid}" --oneline cm_${kernel}/${branch})" != "" ]; then
echo "Already patched cm_${kernel}/${branch}: cancel"
continue
fi
git branch -D cm_${kernel}_${branch}_${patchname} > /dev/null 2>&1 || true
git branch cm_${kernel}_${branch}_${patchname} cm_${kernel}/${branch} > /dev/null 2>&1 || true
if ! git checkout cm_${kernel}_${branch}_${patchname} > /dev/null 2>&1; then
echo "Failed to checkout to branch cm_${kernel}_${branch}_${patchname}: cancel"
continue
fi
if ! git cherry-pick "${cherry}" > /dev/null 2> /dev/null; then
echo "Failed to cherry-pick on cm_${kernel}_${branch}_${patchname}"
git cherry-pick --abort
continue
fi
echo "Success cm_${kernel}_${branch}_${patchname}"
git push ssh://FrozenCow@review.cyanogenmod.org:29418/CyanogenMod/android_kernel_${kernel} HEAD:refs/for/${branch} || true
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.