Update generate.sh with conditional copy.