Move index generation from gen.sh to pu.sh (smarter granularity).