Automatic base directory detection + refactored DEBIAN init script