Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/tigervnc/vnc.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

mcore-src/trunk/mcore-tools/daemon/client/include/vnc.client.class revision 1263 by niro, Fri Feb 4 20:06:54 2011 UTC mcore-src/trunk/mcore-tools/src/modules/tigervnc/vnc.client.class.in revision 2269 by niro, Tue Jan 14 10:34:57 2014 UTC
# Line 3  Line 3 
3  provide x0vnc  provide x0vnc
4  require basic-video  require basic-video
5    
6  help_vnc_enable()  help_vnc_service()
7  {  {
8   mecho "Enable vnc for the X0 display"   mecho "get vnc.service"
9   mecho "X11 restart required!"   mecho " Shows X0-VNC facility status."
10  }   mecho
11     mecho "set vnc.service [command]"
12  help_vnc_disable()   mecho " Controls the X0-VNC facility."
13  {   mecho " Commands:"
14   mecho "Disable vnc for the X0 display"   mecho "   enable  - Enable vnc for the X0 display"
15   mecho "X11 restart required!"   mecho "   disable - Disable vnc for the X0 display"
16     mecho
17     mecho " X11 restart is required!"
18  }  }
19    
20  help_vnc_passwd()  help_vnc_passwd()
21  {  {
22     mecho "get vnc.passwd"
23     mecho " Shows if a vnc password was set."
24     mecho
25   mecho "set vnc.passwd [password]"   mecho "set vnc.passwd [password]"
26   mecho " Sets given password for X0 display vnc."   mecho " Sets given vnc password for remote connections."
27  }  }
28    
29  set_vnc_enable()  helper_vnc_enable()
30  {  {
31   # add to module section   # add to module section
32   local CONFIG="${MCORE_CONFIG_PATH}/xorg/module/99-vnc.conf"   local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/module/99-vnc.conf"
33   clearconfig   clearconfig
34   addconfig ' Load "vnc"'   addconfig ' Load "vnc"'
35    
36   # add to screen section   # add to screen section
37   local CONFIG="${MCORE_CONFIG_PATH}/xorg/screen/99-vnc.conf"   local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/99-vnc.conf"
38   clearconfig   clearconfig
39   addconfig ' Option "SecurityTypes" "VncAuth"'   addconfig ' Option "SecurityTypes" "VncAuth"'
40          addconfig ' Option "UserPasswdVerifier" "VncAuth"'   addconfig ' Option "UserPasswdVerifier" "VncAuth"'
41          addconfig ' Option "PasswordFile" "/root/.vncpasswd"'   addconfig ' Option "PasswordFile" "/root/.vnc/passwd"'
42    
43   # requires graphic!   # requires graphic!
44   helper_graphic_rebuild_xorg_conf_d   helper_graphic_rebuild_xorg_conf_d
# Line 41  set_vnc_enable() Line 46  set_vnc_enable()
46   mecho "Done but X11 restart required!"   mecho "Done but X11 restart required!"
47  }  }
48    
49  set_vnc_disable()  helper_vnc_disable()
50  {  {
51   local CONFIG="${MCORE_CONFIG_PATH}/xorg/screen/99-vnc.conf"   local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/screen/99-vnc.conf"
52   clearconfig   clearconfig
53    
54   local CONFIG="${MCORE_CONFIG_PATH}/xorg/module/99-vnc.conf"   local CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/xorg/module/99-vnc.conf"
55   clearconfig   clearconfig
56    
57   # requires graphic!   # requires graphic!
# Line 55  set_vnc_disable() Line 60  set_vnc_disable()
60   mecho "Done but X11 restart required!"   mecho "Done but X11 restart required!"
61  }  }
62    
63    get_vnc_service()
64    {
65     if [ -f ${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-module.conf ]
66     then
67     if [[ -n $(grep 'Load.*vnc' ${MROOT}@@SYSCONFDIR@@/X11/xorg.conf.d/25-module.conf) ]]
68     then
69     mecho "VNC facility is enabled."
70     rvecho "1"
71     else
72     mecho "VNC facility is disabled."
73     rvecho "0"
74     fi
75     else
76     mecho "VNC facility not configured yet."
77     rvecho "0"
78     fi
79    }
80    
81    set_vnc_service()
82    {
83     local action="${CLASS_ARGV[0]}"
84     if [[ -z ${action} ]]
85     then
86     help_vnc_service
87     return 1
88     fi
89    
90     case ${action} in
91     enable) helper_vnc_enable ;;
92     disable) helper_vnc_disable ;;
93     *) help_vnc_service && return 1 ;;
94     esac
95    }
96    
97    get_vnc_passwd()
98    {
99     if [ -s ${MROOT}/root/.vnc/passwd ]
100     then
101     mecho "A VNC password was set."
102     rvecho "1"
103     else
104     mecho "No VNC password was set yet."
105     rvecho "0"
106     fi
107    }
108    
109  set_vnc_passwd()  set_vnc_passwd()
110  {  {
111   local pass="$1"   local pass="${CLASS_ARGV[0]}"
112   local vncpasswd="/root/.vncpasswd"   local vncconfigdir="${MROOT}/root/.vnc"
113     local vncpasswd="${vncconfigdir}/passwd"
114   [[ -z ${pass} ]] && help_vnc_passwd && return 1   [[ -z ${pass} ]] && help_vnc_passwd && return 1
115     [ -d ${vncconfigdir} ] || install -d ${vncconfigdir}
116    
117   vncpasswd "${vncpasswd}" > /dev/null << EOF   vncpasswd "${vncpasswd}" > /dev/null << EOF
118  ${pass}  ${pass}

Legend:
Removed from v.1263  
changed lines
  Added in v.2269