Cherry-picked apply-patches.sh and patches from opower-1.2.8 branch

@alexandre-normand