prepare: Refactor to fix OS detection on el7