Backport improved ssr-glinject script from the record-schedule branch.