Use classes for setup scripts

Reverts cargomedia/CM#1430

@tomaszdurka please take over