Cherry pick modifications to make shell script from other branch.