patch-and-statics.sh: remove duplicated code.