Install and configure dispmanx_vnc server on osmc (raspberry pi).

    More Infos:
     * https://github.com/patrikolausson/dispmanx_vnc
     * https://discourse.osmc.tv/t/howto-install-a-vnc-server-on-the-raspberry-pi/1517
     * tightvnc:
       * http://raspberry.tips/raspberrypi-einsteiger/raspberry-pi-einsteiger-guide-vnc-einrichten-teil-4/
       * http://jankarres.de/2012/08/raspberry-pi-vnc-server-installieren/

def vnc_raspi_osmc():
    '''Install and configure dispmanx_vnc server on osmc (raspberry pi).

    More Infos:
     * https://github.com/patrikolausson/dispmanx_vnc
     * https://discourse.osmc.tv/t/howto-install-a-vnc-server-on-the-raspberry-pi/1517
     * tightvnc:
       * http://raspberry.tips/raspberrypi-einsteiger/raspberry-pi-einsteiger-guide-vnc-einrichten-teil-4/
       * http://jankarres.de/2012/08/raspberry-pi-vnc-server-installieren/
    '''
    print(blue('Install dependencies'))
    install_packages([
            'git',
            'build-essential',
            'rbp-userland-dev-osmc',
            'libvncserver-dev',
            'libconfig++-dev',
    ])

    print(blue('Build vnc server for raspberry pi using dispmanx '
               '(dispmanx_vnc)'))
    checkup_git_repo_legacy(
        url='https://github.com/patrikolausson/dispmanx_vnc.git')
    run('mkdir -p ~/repos')
    run('cd ~/repos/dispmanx_vnc  &&  make')

    print(blue('set up dispmanx_vnc as a service'))
    with warn_only():
        run('sudo systemctl  stop  dispmanx_vncserver.service')
    username = env.user
    builddir = flo('/home/{username}/repos/dispmanx_vnc')
    run(flo('sudo  cp  {builddir}/dispmanx_vncserver  /usr/bin'))
    run('sudo  chmod +x  /usr/bin/dispmanx_vncserver')
    fabfile_data_dir = FABFILE_DATA_DIR
    put('{fabfile_data_dir}/files/etc/dispmanx_vncserver.conf', '/tmp/')
    run('sudo mv  /tmp/dispmanx_vncserver.conf  /etc/dispmanx_vncserver.conf')
    put('{fabfile_data_dir}/files/etc/systemd/system/dispmanx_vncserver.service',
        '/tmp/')
    run('sudo mv  /tmp/dispmanx_vncserver.service  '
        '/etc/systemd/system/dispmanx_vncserver.service')
    run('sudo systemctl start dispmanx_vncserver.service')
    run('sudo systemctl enable dispmanx_vncserver.service')
    run('sudo systemctl daemon-reload')