Magellan Linux

Diff of /alx-src/branches/alxconf-060/plugins/rdesktop/plugin.sh

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

revision 3522 by niro, Thu Apr 19 13:27:58 2012 UTC revision 3523 by niro, Mon Apr 23 07:30:59 2012 UTC
# Line 1  Line 1 
1  # this script gets included by config_sessions  # this script gets included by config_sessions
2    
3  PLUGIN_NAME="rdesktop"  PLUGIN_NAME="rdesktop"
4  PLUGIN_MENUITEM_NAME=""  PLUGIN_MENUITEM_NAME="${PLUGIN_NAME}"
5  PLUGIN_MENUITEM_EXEC=""  PLUGIN_MENUITEM_EXEC="${PLUGIN_NAME}"
6  PLUGIN_MENUITEM_PARAM=""  PLUGIN_MENUITEM_PARAM=""
7  PLUGIN_MENUITEM_WORKDIR=""  PLUGIN_MENUITEM_WORKDIR=""
8  PLUGIN_MENUITEM_ICON=""  PLUGIN_MENUITEM_ICON=""
9    
10  PLUGIN_AUTOSTART=0  PLUGIN_AUTOSTART=0
   
11  PLUGIN_PACKAGES="openssl rdesktop"  PLUGIN_PACKAGES="openssl rdesktop"
12    PLUGIN_CONFIG="/etc/alxconfig-ng/plugin-${PLUGIN_NAME}.conf"
13    
14    # include alx functions
15    source /etc/alxconfig-ng/config.rc
16    source /etc/alxconfig-ng/serial
17    source ${ALX_FUNCTIONS}/common
18    source ${ALX_FUNCTIONS}/mysqlfunctions
19    # missing colors
20    COLRED="\033[1;6m\033[31m"
21    COLDEFAULT="\033[0m"
22    
23    die()
24    {
25     echo "Error: $@"
26     echo -e "${COLRED}Plugin \"${PLUGIN_NAME}\" will be disabled.${COLDEFAULT}"
27     [ -f ${PLUGIN_CONFIG} ] && rm ${PLUGIN_CONFIG}
28     exit 1
29    }
30    
31  install_plugin()  install_plugin()
32  {  {
# Line 26  install_plugin() Line 43  install_plugin()
43    
44  setup_plugin()  setup_plugin()
45  {  {
46   if [ ! -f /etc/alxconfig-ng/plugin-${PLUGIN_NAME}.conf ]   local CONFIG
47     local opts
48    
49     evaluate_table plugin_rdesktop
50     # sanitize variables
51     opts=""
52     if [[ -z ${plugin_rdesktop_session_name} ]]
53     then
54     die "session_name variable is missing"
55     fi
56     if [[ -z ${plugin_rdesktop_server} ]]
57     then
58     die "server variable is missing"
59     fi
60     if [[ -z ${plugin_rdesktop_username} ]]
61     then
62     plugin_rdesktop_username=""
63     else
64     opts+=" -u '${plugin_rdesktop_username}'"
65     fi
66     if [[ -z ${plugin_rdesktop_password} ]]
67     then
68     plugin_rdesktop_password=""
69     else
70     opts+=" -p '${plugin_rdesktop_password}'"
71     fi
72     if [[ -z ${plugin_rdesktop_domain} ]]
73     then
74     plugin_rdesktop_domain=""
75     else
76     opts+=" -d '${plugin_rdesktop_domain}'"
77     fi
78     if [[ -z ${plugin_rdesktop_resolution} ]]
79   then   then
80   install /usr/lib/alxconfig-ng/plugins/${PLUGIN_NAME}/plugin-${PLUGIN_NAME}.conf /etc/alxconfig-ng   die "resolution is missing"
81     else
82     case ${plugin_rdesktop_resolution} in
83     fullscreen) opts+=" -f" ;;
84     seamless) opts+=" -A" ;;
85     *) opts+=" -g '${plugin_rdesktop_resolution}'" ;;
86     esac
87     fi
88     if [[ -z ${plugin_rdesktop_keyboard} ]]
89     then
90     plugin_rdesktop_keyboard=""
91     else
92     opts+=" -k '${plugin_rdesktop_keyboard}'"
93     fi
94     if [[ -z ${plugin_rdesktop_shell} ]]
95     then
96     plugin_rdesktop_shell=""
97     else
98     opts+=" -s '${plugin_rdesktop_shell}'"
99     fi
100     if [[ -z ${plugin_rdesktop_runpath} ]]
101     then
102     plugin_rdesktop_runpath=""
103     else
104     opts+=" -c '${plugin_rdesktop_runpath}'"
105   fi   fi
106    
107   return 0   CONFIG="${PLUGIN_CONFIG}"
108     clearconfig
109     addconfig "PLUGIN_CONFIG_SESSION_NAME=\"${plugin_rdesktop_session_name}\""
110     addconfig "PLUGIN_CONFIG_SERVER=\"${plugin_rdesktop_server}\""
111     addconfig "PLUGIN_CONFIG_PARAM=\"${opts}\""
112  }  }
113    
114  # create desktop buttons  # create desktop buttons
115  create_menuitem()  create_menuitem()
116  {  {
117   if [ -f /etc/alxconfig-ng/plugin-rdesktop.conf ]   if [ -f ${PLUGIN_CONFIG} ]
118   then   then
119   source /etc/alxconfig-ng/plugin-rdesktop.conf   source ${PLUGIN_CONFIG}
120   fi   fi
121   [[ -z ${PLUGIN_CONFIG_PARAM} ]] && PLUGIN_CONFIG_PARAM=""   [[ -z ${PLUGIN_CONFIG_PARAM} ]] && PLUGIN_CONFIG_PARAM=""
122   [[ -z ${PLUGIN_CONFIG_SERVER} ]] && PLUGIN_CONFIG_SERVER=""   [[ -z ${PLUGIN_CONFIG_SERVER} ]] && PLUGIN_CONFIG_SERVER=""
123    
124     # no menuentries if egk_scm plugin is installed, this one will be used instead then
125     if [ -f ${SETTINGSPATH}/plugins/egk_scm ]
126     then
127     PLUGIN_MENUITEM_NAME=""
128     PLUGIN_MENUITEM_EXEC=""
129     PLUGIN_MENUITEM_PARAM=""
130     PLUGIN_MENUITEM_WORKDIR=""
131     PLUGIN_MENUITEM_ICON=""
132     else
133     if [[ ! -z ${PLUGIN_CONFIG_SESSION_NAME} ]]
134     then
135     PLUGIN_MENUITEM_NAME="${PLUGIN_CONFIG_SESSION_NAME}"
136     fi
137     fi
138    
139   # don't touch these echo, define variables above   # don't touch these echo, define variables above
140   echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\""   echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\""
141   echo "PLUGIN_MENUITEM_EXEC=\"${PLUGIN_MENUITEM_EXEC}\""   echo "PLUGIN_MENUITEM_EXEC=\"${PLUGIN_MENUITEM_EXEC}\""
# Line 54  create_menuitem() Line 146  create_menuitem()
146    
147  autostart_plugin()  autostart_plugin()
148  {  {
149   echo "PLUGIN_AUTOSTART=\"${PLUGIN_AUTOSTART}\""   # only autostart if plugin config was found
150     if [ -f ${PLUGIN_CONFIG} ]
151     then
152     evaluate_table plugin_rdesktop
153     fi
154     # sanitize variables
155     [[ -z ${plugin_rdesktop_autostart} ]] && plugin_rdesktop_autostart=0
156    
157     echo "PLUGIN_AUTOSTART=\"${plugin_rdesktop_autostart}\""
158   echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\""   echo "PLUGIN_MENUITEM_NAME=\"${PLUGIN_MENUITEM_NAME}\""
159  }  }
160    
161  uninstall_plugin()  uninstall_plugin()
162  {  {
163     [ -f ${PLUGIN_CONFIG} ] && rm ${PLUGIN_CONFIG}
164    
165   local i   local i
166   for i in ${PLUGIN_PACKAGES}   for i in ${PLUGIN_PACKAGES}
167   do   do

Legend:
Removed from v.3522  
changed lines
  Added in v.3523