vendor: Improve preinstall script

Change-Id: I1191cf397df919b8b0d5d49a28046ba7d60dc0cd