[CentOS support fix] Create some required files inside chroot

Replaces issue #6. Rebased onto master and some tests added.