public function install( InstalledRepositoryInterface $repo, PackageInterface $package )
    {
        $downloadPath = $this->getInstallPath( $package );
        $fileSystem = new Filesystem();
        if ( !is_dir( $downloadPath ) || $fileSystem->isDirEmpty( $downloadPath ) )
        {
            return parent::install( $repo, $package );
        }

        $actualLegacyDir = $this->ezpublishLegacyDir;
        $this->ezpublishLegacyDir = $this->generateTempDirName();
        if ( $this->io->isVerbose() )
        {
            $this->io->write( "Installing in temporary directory." );
        }

        parent::install( $repo, $package );

        /// @todo the following function does not warn of any failures in copying stuff over. We should probably fix it...
        if ( $this->io->isVerbose() )
        {
            $this->io->write( "Updating new code over existing installation." );
        }
        $fileSystem->copyThenRemove( $this->ezpublishLegacyDir, $actualLegacyDir );

        // if parent::install installed binaries, then the resulting shell/bat stubs will not work. We have to redo them
        if( method_exists($this,'removeBinaries') )
        {
            $this->removeBinaries( $package );
        }
        else
        {
            $this->binaryInstaller->removeBinaries( $package );
        }

        $this->ezpublishLegacyDir = $actualLegacyDir;
        if( method_exists($this,'installBinaries') )
        {
            $this->installBinaries( $package );
        }
        else
        {
            $this->binaryInstaller->installBinaries( $package, $this->getInstallPath( $package ) );
        }
    }