public static function prepareContext($installDir = null, $event = null)
    {
        // initialize the installation directory
        if (is_null($installDir)) {
            $installDir = getcwd();
        }

        // check if we've a file with the actual version number
        $version = '';
        if (file_exists($filename = $installDir .'/etc/appserver/.release-version')) {
            $version = file_get_contents($filename);
        } else {
            // load the version (GIT) of this package as fallback if called with event instance
            if (!is_null($event)) {
                $version = $event->getComposer()->getPackage()->getPrettyVersion();
            }
        }

        // check if we've a file with the actual release name
        if (file_exists($filename = $installDir .'/etc/appserver/.release-name')) {
            $releaseName = file_get_contents($filename);
        } else {
            // set the release name to 'Unknown' if not
            $releaseName = 'Unknown';
        }

        // prepare the context properties
        $contextProperties = array(
            SetupKeys::VERSION => $version,
            SetupKeys::INSTALL_DIR => $installDir,
            SetupKeys::RELEASE_NAME => $releaseName
        );

        // load the OS signature => sscanf is necessary to detect Windows, e. g. Windows NT for Windows 7
        list($os, ) = sscanf(strtolower(php_uname('s')), '%s %s');

        // check what OS we are running on
        switch ($os) {

            // installation running on Linux
            case SetupKeys::OS_FAMILY_LINUX:

                // get the distribution
                $distribution = Setup::getLinuxDistro();
                // if we cant find one of the supported systems
                if ($distribution == null) {
                    // set debian as default
                    $distribution = SetupKeys::OS_DEBIAN;

                    // write a message to the console if called with event instance
                    if (!is_null($event)) {
                        $event->getIo()->write(
                            sprintf(
                                '<warning>Unknown Linux distribution found, use Debian default values: ' .
                                'Please check user/group configuration in etc/appserver/appserver.xml</warning>'
                            )
                        );
                    }
                }

                // merge the properties for the found Linux distribution
                Setup::prepareProperties($distribution, $contextProperties);

                break;

            // installation running on Mac OS X
            case SetupKeys::OS_FAMILY_DARWIN:

                // merge the properties for Mac OS X
                Setup::prepareProperties($os, $contextProperties);
                break;

            // installation running on Windows
            case SetupKeys::OS_FAMILY_WINDOWS:

                // merge the properties for Windows
                Setup::prepareProperties($os, $contextProperties);
                break;

            // all other OS are NOT supported actually
            default:
                break;
        }
    }