~ubuntu-branches/ubuntu/trusty/prey/trusty

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Description: Modules are installed in /var/lib/prey/modules,
 set a global var pointing to that.
Author: Alessio Treglia <alessio@debian.org>
---
 core/modules |   10 +++++-----
 prey.sh      |    1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

--- prey.orig/core/modules
+++ prey/core/modules
@@ -7,7 +7,7 @@
 
 # mac/linux only. windows has another method of de/activating modules
 is_module_active(){
-	if [ -x "$base_path/modules/$1/core/run" ]; then
+	if [ -x "$modules_path/$1/core/run" ]; then
 		echo 1
 	else
 		return 0
@@ -15,8 +15,8 @@ is_module_active(){
 }
 
 get_active_modules_from_filesystem(){
-	for module in `find "$base_path/modules" -maxdepth 1 -mindepth 1 -type d`; do
-		local module_name=`echo $module | sed 's/.*[\\|\/]\([a-z_-]*\)$/\1/'`
+	for module_name in `find "$modules_path" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;`
+	do
 		if [ `is_module_active "$module_name"` ]; then
 			initialize_module $module_name
 			active_modules="$active_modules $module_name"
@@ -27,7 +27,7 @@ get_active_modules_from_filesystem(){
 # gets the module name ($1) and optionally the upstream version ($2)
 setup_module(){
 
-	module_path="$base_path/modules/$1"
+	module_path="$modules_path/$1"
 	upstream_version=$2
 
 	# automatic updates are disabled
@@ -75,7 +75,7 @@ initialize_module(){
 #}
 
 set_module_paths_for(){
-	module_path="$base_path/modules/$1"
+	module_path="$modules_path/$1"
 	module_platform_path="$module_path/platform/$os"
 }
 
--- prey.orig/prey.sh
+++ prey/prey.sh
@@ -7,6 +7,7 @@
 
 PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
 readonly base_path=`dirname "$0"`
+readonly modules_path='/var/lib/prey/modules'
 
 ####################################################################
 # base files inclusion