Commit f4c14b98 authored by Romain Courteaud's avatar Romain Courteaud

Add xvfb recipe.

It allows to start a X server inside a slapos instance.
Provide an hook to do a screenshot of the X session.
parent 58462c24
......@@ -62,6 +62,7 @@ setup(name=name,
'generic.onetimeupload = slapos.recipe.generic_onetimeupload:Recipe',
'helloworld = slapos.recipe.helloworld:Recipe',
'generic.cloudooo = slapos.recipe.generic_cloudooo:Recipe',
'firefox = slapos.recipe.firefox:Recipe',
'fontconfig = slapos.recipe.fontconfig:Recipe',
'java = slapos.recipe.java:Recipe',
'kumofs = slapos.recipe.kumofs:Recipe',
......@@ -112,6 +113,7 @@ setup(name=name,
'urlparse = slapos.recipe._urlparse:Recipe',
'vifib = slapos.recipe.vifib:Recipe',
'waitfor = slapos.recipe.waitfor:Recipe',
'xvfb = slapos.recipe.xvfb:Recipe',
'xwiki = slapos.recipe.xwiki:Recipe',
'zabbixagent = slapos.recipe.zabbixagent:Recipe',
'generic.zope = slapos.recipe.generic_zope:Recipe',
......
##############################################################################
#
# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
config = {
'xvfb_binary': self.options['xvfb-path'],
'shell_path': self.options['shell-path'],
'fbdir_path': self.options['fbdir-path'],
'tmp_path': self.options['tmp-path'],
}
xvfb_path = self.createExecutable(
self.options['runner-path'],
self.substituteTemplate(self.getTemplateFilename('xvfb_run.in'),
config))
result = [xvfb_path]
# Allow to take screenshot if needed
if ('xwd-path' in self.options) and ('xwd-hook-path' in self.options):
config['xwd_binary'] = self.options['xwd-path']
result.append(self.createExecutable(
self.options['xwd-hook-path'],
self.substituteTemplate(self.getTemplateFilename('xwd_run.in'),
config)))
return result
#!%(shell_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
export TMPDIR=%(tmp_path)s
exec %(xvfb_binary)s -screen 0 1024x768x24 -fbdir %(fbdir_path)s
#!%(shell_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
export TMPDIR=%(tmp_path)s
exec %(xwd_binary)s -root -out $1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment