diff options
author | Sebastian Schmelzer | 2008-12-15 13:46:25 +0100 |
---|---|---|
committer | Sebastian Schmelzer | 2008-12-15 13:46:25 +0100 |
commit | 3b70275febad55d69b2180f8bc373f43a65c6fb6 (patch) | |
tree | 3d87866db1fab6f58bba256963d8c0d040878a5b /lib/OpenSLX/DistroUtils/Ubuntu.pm | |
parent | * added descriptions (diff) | |
download | core-3b70275febad55d69b2180f8bc373f43a65c6fb6.tar.gz core-3b70275febad55d69b2180f8bc373f43a65c6fb6.tar.xz core-3b70275febad55d69b2180f8bc373f43a65c6fb6.zip |
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2407 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib/OpenSLX/DistroUtils/Ubuntu.pm')
-rw-r--r-- | lib/OpenSLX/DistroUtils/Ubuntu.pm | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/lib/OpenSLX/DistroUtils/Ubuntu.pm b/lib/OpenSLX/DistroUtils/Ubuntu.pm new file mode 100644 index 00000000..dceae7e4 --- /dev/null +++ b/lib/OpenSLX/DistroUtils/Ubuntu.pm @@ -0,0 +1,88 @@ +# Copyright (c) 2008 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# Ubuntu.pm +# - provides ubuntu specific functions for distro based utils for OpenSLX +# ----------------------------------------------------------------------------- +package OpenSLX::DistroUtils::Ubuntu; + +use strict; +use warnings; +use Switch; + +use base qw(OpenSLX::DistroUtils::Base); + +sub _renderHighlevelConfig { + my $self = shift; + my $initFile = shift; + + my $element; + my $hlc = $initFile->{'configHash'}->{'highlevelConfig'}; + + while ( $element = shift(@$hlc)){ + switch ($element->{type}) { + case 'daemon' { + $element->{binary} =~ m/\/([^\/]*)$/; + my $shortname = $1; + my $tpl = "export %s_PARAMS=\"%s\" \n"; + $tpl .= "[ -f /etc/default/%s ] . /etc/default/%s \n"; + $initFile->addToBlock('head', + sprintf( + $tpl, + uc($shortname), + $element->{parameters}, + $shortname, + $shortname + ) + ); + + + $tpl = "start-stop-daemon --start --quiet --oknodo "; + $tpl .= "--pidfile /var/run/%s.pid --exec %s -- \$%s_PARAMS \n"; + $tpl .= "log_end_msg \$?"; + $initFile->addToBlock('start', + sprintf( + $tpl, + $shortname, + $element->{binary}, + uc($shortname) + ) + ); + + $tpl = "start-stop-daemon --stop --quiet --oknodo "; + $tpl .= "--pidfile /var/run/%s.pid \n"; + $tpl .= "log_end_msg \$?"; + $initFile->addToBlock('stop', + sprintf( + $tpl, + $shortname + ) + ); + + + } + } + } + +} + +sub generateInitFile +{ + my $self = shift; + my $initFile = shift; + + $initFile->addToBlock('head', '#ubuntu test'); + + $self->_renderHighlevelConfig($initFile); + + return $self->SUPER::generateInitFile($initFile); +} + +1;
\ No newline at end of file |