#!/bin/bash if [ $# -lt 2 ] then echo -e "Usage: $0 \n" echo "Example:" echo -e "\t$0 MyModule mymodule\n" echo "WARNING: directory name must be equal to module name in lowercase" exit 1 fi MODULENAME=$1 DESTDIR=$2 DIST=saucy VERSION=3.4 PKGNAME=$(basename $DESTDIR) mkdir -p $DESTDIR/schemas mkdir -p $DESTDIR/src/EBox/$MODULENAME/Model mkdir -p $DESTDIR/stubs mkdir -p $DESTDIR/src/scripts mkdir -p $DESTDIR/debian cat >$DESTDIR/schemas/$PKGNAME.yaml <$DESTDIR/src/EBox/$MODULENAME.pm < # sub _create { my \$class = shift; my \$self = \$class->SUPER::_create( name => '$PKGNAME', printableName => __('$MODULENAME'), @_ ); bless (\$self, \$class); return \$self; } # Method: menu # # Overrides: # # # sub menu { my (\$self, \$root) = @_; my \$item = new EBox::Menu::Item( url => '$MODULENAME/View/Settings', text => \$self->printableName(), separator => 'Core', order => 1 ); \$root->add(\$item); } # Method: _daemons # # Overrides: # # # sub _daemons { my \$daemons = [ # FIXME: here you can list the daemons to be managed by the module # for upstart daemons only the 'name' attribute is needed # # { # name => 'service', # type => 'init.d', # pidfiles => ['/var/run/service.pid'] # }, ]; return \$daemons; } # Method: _setConf # # Overrides: # # # sub _setConf { my (\$self) = @_; my \$settings = \$self->model('Settings'); my \$booleanValue = \$settings->value('booleanField'); my \$textValue = \$settings->value('textField'); my @params = ( boolean => \$booleanValue, text => \$textValue, ); \$self->writeConfFile( \$CONFFILE, "$PKGNAME/service.conf.mas", \@params, { uid => '0', gid => '0', mode => '644' } ); } 1; EOF cat >$DESTDIR/src/EBox/$MODULENAME/Model/Settings.pm < # sub _table { my (\$self) = @_; my @fields = ( new EBox::Types::Boolean( fieldName => 'booleanField', printableName => __('Example boolean field'), editable => 1, help => __('This field is an example.'), ), new EBox::Types::Text( fieldName => 'textField', printableName => __('Example text field'), editable => 1, size => '8', help => __('This field is another example.'), ), ); my \$dataTable = { tableName => 'Settings', printableTableName => __('Settings'), pageTitle => \$self->parentModule()->printableName(), defaultActions => [ 'editField' ], modelDomain => '$MODULENAME', tableDescription => \@fields, help => __('This is the help of the model'), }; return \$dataTable; } 1; EOF cat >$DESTDIR/src/scripts/enable-module <$DESTDIR/src/scripts/initial-setup <$DESTDIR/stubs/service.conf.mas < \$boolean \$text boolean = <% \$boolean %> text = "<% \$text %>" EOF cat >$DESTDIR/debian/zentyal-$PKGNAME.postrm <$DESTDIR/debian/zentyal-$PKGNAME.postinst <$DESTDIR/debian/rules <$DESTDIR/debian/changelog < Fri, 25 Jan 2013 02:53:07 +0100 EOF cat >$DESTDIR/debian/control < Build-Depends: debhelper (>= 7.0.0), cdbs Standards-Version: 3.9.1 Homepage: http://www.zentyal.org/ Package: zentyal-$PKGNAME Architecture: all Depends: zentyal-core (>= $VERSION~1), \${misc:Depends} Description: Zentyal - $MODULENAME module Zentyal is a Linux small business server that can act as a Gateway, Unified Threat Manager, Office Server, Infrastructure Manager, Unified Communications Server or a combination of them. One single, easy-to-use platform to manage all your network services. . FIXME: description goes here. EOF cat >$DESTDIR/ChangeLog < $DESTDIR/debian/compat