~ubuntu-branches/ubuntu/karmic/ebox/karmic

« back to all changes in this revision

Viewing changes to tools/ebox

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-01-26 18:21:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090126182118-b8lnqji849rhz3vz
Tags: 0.12.4-0ubuntu1
* New upstream release. (LP: #318710, LP: #310045).
* debian/control:
  - Bump standard version.
  - Depend on an apache2-mpm- rather then apache2 (LP: #225793).
  - Build depend on debconf-updatepo.
* debian/rules:
  - Call debconf-updatepo from clean target.
* debian/copyright:
  - Include section about apache-authcookie code.
* debian/ebox.postrm:
  - Remove ebox log files (LP: #129738).
* debian/ebox.prerm:
  - Stop ebox when the package is removed. (LP: #234912)
* debian/watch:
  - add watch file.
* debian/patches/01_add_apache_authcookie.dpatch
  - Patch to backport AuthCookie authentication for jaunty (LP: #255368).
* debian/patches/02_dbus_gconf.dpatch
  - Patch to make gconf classes work with new gconf using dbus 
    (LP: #314606).
* debian/patches/03_js_libraries.dpatch
  - Patch to use javascript libraries that are already package for
    Jaunty 

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
my $global = EBox::Global->getInstance(1);
21
21
 
22
22
sub usage {
23
 
        print "Usage: $0 start|stop|status|restart\n";
24
 
        print "       $0 <module> start|stop|restart\n";
 
23
        print "Usage: $0 start|stop|restart\n";
 
24
        print "       $0 <module> start|stop|status|enabled|restart\n";
25
25
        exit 1;
26
26
}
27
27
 
53
53
    exit 2;
54
54
  }
55
55
 
 
56
  # Do not restart apache if we are run under ebox-software
 
57
  if ($actionName eq 'restart' and $modname eq 'apache' ) {
 
58
        return if (exists $ENV{'EBOX_SOFTWARE'} and $ENV{'EBOX_SOFTWARE'} == 1 );
 
59
  }
 
60
 
56
61
  if ($actionName eq 'start' and $modname eq 'network' and $mod->isEnabled()) {
57
62
      try {
58
63
        EBox::Sudo::root("/etc/init.d/networking stop");
63
68
  my $errorMsg;
64
69
  try {
65
70
    $mod->$action();
66
 
    $success = 1;
 
71
    $success = 0;
67
72
  } 
68
73
  catch EBox::Exceptions::Base with {
69
74
      my $ex = shift;
70
 
      $success = 0;
 
75
      $success = 1;
71
76
      $errorMsg =  $ex->text;
72
77
  };
73
78
 
90
95
   exit 0;
91
96
  } else {
92
97
   print STDOUT $msg . "[ DISABLED ]\n";
93
 
   exit 1;
 
98
   exit 3;
94
99
  }
95
100
 
96
101
}
97
102
 
 
103
sub _logActionFunction
 
104
{
 
105
        my ($action, $success) = @_;
 
106
        system(". /lib/lsb/init-functions; " . 
 
107
               " log_begin_msg \"$action\"; log_end_msg $success");
 
108
}
 
109
 
 
110
 
 
111
 
98
112
sub printModuleMessage
99
113
{
100
114
  my ($modname, $action, $success, $errorMsg) = @_;
101
 
 
102
 
  my $successMsg = $success ?  '   [ OK ]' : '[ ERROR ]';
103
 
 
104
 
  print STDOUT "EBox: $action $modname:\t\t\t$successMsg\n";
105
 
 
 
115
  
 
116
  my %actions = ( 'start' => 'Starting', 'stop' => 'Stopping', 
 
117
                  'restart' => 'Restarting' );
 
118
 
 
119
  my $msg = $actions{$action} . " eBox module: $modname";
 
120
  _logActionFunction($msg, $success);
106
121
  if ($errorMsg) {
107
122
    print STDERR $errorMsg, "\n";
108
123
  }
150
165
    } 
151
166
    elsif ($action eq 'stop') {
152
167
      moduleStop($modName);
153
 
    } elsif ($action eq 'status') {
 
168
    } elsif ($action eq 'status' or $action eq 'enabled') {
 
169
      # FIXME: Separate enabled and status actions
154
170
      status($modName);
155
171
    } else {
156
172
      usage();