script improvements

This is to help ocaml/opam#1035 support