~ubuntu-branches/ubuntu/saucy/prey/saucy

« back to all changes in this revision

Viewing changes to core/modules

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-30 00:42:23 UTC
  • Revision ID: james.westby@ubuntu.com-20101130004223-66ccximybs6laf4t
Tags: 0.4.4-1
Initial release. (Closes: #577932)

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
# mac/linux only. windows has another method of de/activating modules
9
9
is_module_active(){
10
 
        if [ -x "$base_path/modules/$1/core/run" ]; then
 
10
        if [ -x "$modules_path/$1/core/run" ]; then
11
11
                echo 1
12
12
        else
13
13
                return 0
15
15
}
16
16
 
17
17
get_active_modules_from_filesystem(){
18
 
        for module in `find "$base_path/modules" -maxdepth 1 -mindepth 1 -type d`; do
19
 
                local module_name=`echo $module | sed 's/.*[\\|\/]\([a-z_-]*\)$/\1/'`
 
18
        for module_name in `find "$modules_path" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;`
 
19
        do
20
20
                if [ `is_module_active "$module_name"` ]; then
21
21
                        initialize_module $module_name
22
22
                        active_modules="$active_modules $module_name"
27
27
# gets the module name ($1) and optionally the upstream version ($2)
28
28
setup_module(){
29
29
 
30
 
        module_path="$base_path/modules/$1"
 
30
        module_path="$modules_path/$1"
31
31
        upstream_version=$2
32
32
 
 
33
        # disable automatic updates
33
34
        if [ ! -d "$module_path" ]; then
34
35
                log " !! Module $1 not found!"
35
 
                install_or_update_module $1
36
 
                return $?
37
 
        elif [ -n "$upstream_version" ]; then # module is already there, lets see if the versions match
38
 
 
39
 
                local installed_version=`cat "$module_path/version" 2> /dev/null`
40
 
 
41
 
                if [ `is_greater_than $upstream_version $installed_version` == 1 ]; then
42
 
                        log " -- Updating $module module to version $upstream_version!"
43
 
                        install_or_update_module $1
44
 
                        return $?
45
 
                fi
46
 
 
 
36
                return 1
 
37
        else
 
38
                return 0
47
39
        fi
48
40
}
49
41
 
82
74
#}
83
75
 
84
76
set_module_paths_for(){
85
 
        module_path="$base_path/modules/$1"
 
77
        module_path="$modules_path/$1"
86
78
        module_platform_path="$module_path/platform/$os"
87
79
}
88
80