ppp: backport use a more reliable way to set script environment