# $Id$ provide x0vnc require basic-video help_vnc_service() { mecho "get vnc.service" mecho " Shows X0-VNC facility status." mecho mecho "set vnc.service [command]" mecho " Controls the X0-VNC facility." mecho " Commands:" mecho " enable - Enable vnc for the X0 display" mecho " disable - Disable vnc for the X0 display" mecho mecho " X11 restart is required!" } help_vnc_passwd() { mecho "get vnc.passwd" mecho " Shows if a vnc password was set." mecho mecho "set vnc.passwd [password]" mecho " Sets given vnc password for remote connections." } helper_vnc_enable() { # add to module section local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/module/99-vnc.conf" clearconfig addconfig ' Load "vnc"' # add to screen section local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/99-vnc.conf" clearconfig addconfig ' Option "SecurityTypes" "VncAuth"' addconfig ' Option "UserPasswdVerifier" "VncAuth"' addconfig ' Option "PasswordFile" "/root/.vnc/passwd"' # requires graphic! helper_graphic_rebuild_xorg_conf_d mecho "Done but X11 restart required!" } helper_vnc_disable() { local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/99-vnc.conf" clearconfig local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/module/99-vnc.conf" clearconfig # requires graphic! helper_graphic_rebuild_xorg_conf_d mecho "Done but X11 restart required!" } get_vnc_service() { if [ -f ${MROOT}/etc/X11/xorg.conf.d/25-module.conf ] then if [[ -n $(grep 'Load.*vnc' ${MROOT}/etc/X11/xorg.conf.d/25-module.conf) ]] then mecho "VNC facility is enabled." rvecho "1" else mecho "VNC facility is disabled." rvecho "0" fi else mecho "VNC facility not configured yet." rvecho "0" fi } set_vnc_service() { local action="$1" if [[ -z ${action} ]] then help_vnc_service return 1 fi case ${action} in enable) helper_vnc_enable ;; disable) helper_vnc_disable ;; *) help_vnc_service && return 1 ;; esac } get_vnc_passwd() { if [ -s ${MROOT}/root/.vnc/passwd ] then mecho "A VNC password was set." rvecho "1" else mecho "No VNC password was set yet." rvecho "0" fi } set_vnc_passwd() { local pass="$1" local vncconfigdir="${MROOT}/root/.vnc" local vncpasswd="${vncconfigdir}/passwd" [[ -z ${pass} ]] && help_vnc_passwd && return 1 [ -d ${vncconfigdir} ] || install -d ${vncconfigdir} vncpasswd "${vncpasswd}" > /dev/null << EOF ${pass} ${pass} EOF }