Magellan Linux

Annotation of /alx-src/branches/alxconf-060/functions/config_plugins.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2747 - (hide annotations) (download) (as text)
Thu Aug 11 19:50:58 2011 UTC (12 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 1254 byte(s)
-added rudimentary plugin support
1 niro 2747 # $Id$
2     # install plugins
3    
4     is_installed()
5     {
6     local i
7     local item="$1"
8    
9     for i in ${SETTINGSPATH}/plugins/*
10     do
11     [[ $(basename ${i}) = ${item} ]] && return 1
12     done
13    
14     return 0
15     }
16    
17     config_plugins()
18     {
19     local all_ids
20     local installed_plugins
21    
22     # install needed directories
23     [[ ! -d ${SETTINGSPATH}/plugins ]] && install -d ${SETTINGSPATH}/plugins
24    
25     # get all ids
26     all_ids=$(mysqldo "select id from cfg_plugins where serial='${ALX_SERIAL}'")
27    
28     # install
29     for i in ${all_ids}
30     do
31     evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'"
32    
33     # already installed ?
34     [[ -f ${SETTINGSPATH}/plugins/${cfg_plugins_plugin} ]] && continue
35    
36     if [[ -x ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh ]]
37     then
38     echo " Installing plugin '${cfg_plugins_plugin} ..."
39     ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh install
40     touch ${SETTINGSPATH}/plugins/${cfg_plugins_plugin}
41     fi
42     done
43    
44     # uninstall
45     for i in ${all_ids}
46     do
47     evaluate_table cfg_plugins "where serial='${ALX_SERIAL}' and id='${i}'"
48     if is_installed ${cfg_plugins_plugin}
49     then
50     echo " Uninstalling plugin '${cfg_plugins_plugin} ..."
51     ${ALX_PLUGINS}/${cfg_plugins_plugin}/plugin.sh uninstall
52     rm -f ${SETTINGSPATH}/plugins/${cfg_plugins_plugin}
53     fi
54     done
55     }