~ubuntu-branches/ubuntu/saucy/ebox/saucy

« back to all changes in this revision

Viewing changes to debian/patches/12_ebox_init.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2008-04-07 10:13:48 UTC
  • Revision ID: james.westby@ubuntu.com-20080407101348-0prtgjqhgo3p75rp
Tags: 0.11.99-0ubuntu8
* debian/patches/11_progress_indicator_cleanup.dpatch
  - Clean up file descriptiors before running exec in progress indicator.
* debian/patches/12_ebox_init.dpatch
  - use /lib/lsb/init-functions to log start/stop fucntions.
* debian/patches/13_backup_configured_modules.dpatch
  - Backup only configured modules.
* Add preinst script to fetch from eBox's apache port and set it in debconf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 12_ebox_init.dpatch by Javier Uruen Val <javi@warp.es>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: Backport 0.11.100 patch to use 
 
6
## DP: /lib/lsb/init-functions to log start/stop actions
 
7
 
 
8
@DPATCH@
 
9
 
 
10
Index: ebox/tools/ebox
 
11
===================================================================
 
12
--- ebox/tools/ebox     (revisión: 9763)
 
13
+++ ebox/tools/ebox     (copia de trabajo)
 
14
@@ -53,6 +53,11 @@
 
15
     exit 2;
 
16
   }
 
17
 
 
18
+  # Do not restart apache if we are run under ebox-software
 
19
+  if ($actionName eq 'restart' and $modname eq 'apache' ) {
 
20
+       return if (exists $ENV{'EBOX_SOFTWARE'} and $ENV{'EBOX_SOFTWARE'} == 1 );
 
21
+  }
 
22
+
 
23
   if ($actionName eq 'start' and $modname eq 'network' and $mod->isEnabled()) {
 
24
       try {
 
25
         EBox::Sudo::root("/etc/init.d/networking stop");
 
26
@@ -63,11 +68,11 @@
 
27
   my $errorMsg;
 
28
   try {
 
29
     $mod->$action();
 
30
-    $success = 1;
 
31
+    $success = 0;
 
32
   } 
 
33
   catch EBox::Exceptions::Base with {
 
34
       my $ex = shift;
 
35
-      $success = 0;
 
36
+      $success = 1;
 
37
       $errorMsg =  $ex->text;
 
38
   };
 
39
 
 
40
@@ -95,14 +100,24 @@
 
41
 
 
42
 }
 
43
 
 
44
+sub _logActionFunction
 
45
+{
 
46
+       my ($action, $success) = @_;
 
47
+       system(". /lib/lsb/init-functions; " . 
 
48
+              " log_begin_msg \"$action\"; log_end_msg $success");
 
49
+}
 
50
+
 
51
+
 
52
+
 
53
 sub printModuleMessage
 
54
 {
 
55
   my ($modname, $action, $success, $errorMsg) = @_;
 
56
+  
 
57
+  my %actions = ( 'start' => 'Starting', 'stop' => 'Stopping', 
 
58
+                 'restart' => 'Restarting' );
 
59
 
 
60
-  my $successMsg = $success ?  '   [ OK ]' : '[ ERROR ]';
 
61
-
 
62
-  print STDOUT "EBox: $action $modname:\t\t\t$successMsg\n";
 
63
-
 
64
+  my $msg = $actions{$action} . " eBox module: $modname";
 
65
+  _logActionFunction($msg, $success);
 
66
   if ($errorMsg) {
 
67
     print STDERR $errorMsg, "\n";
 
68
   }