Commit 97d5f9c3 authored by Antoine Catton's avatar Antoine Catton

Add kinda lock file for rootfs downloading

parent b7c1d8bb
...@@ -109,11 +109,13 @@ class Recipe(GenericSlapRecipe): ...@@ -109,11 +109,13 @@ class Recipe(GenericSlapRecipe):
config.add_section('rootfs') config.add_section('rootfs')
config.set('rootfs', 'directory', self.options['rootfs']) config.set('rootfs', 'directory', self.options['rootfs'])
config.set('rootfs', 'tmp', self.options['tmp-dir']) config.set('rootfs', 'tmp', self.options['tmp-dir'])
config.set('rootfs', 'complete', self.options['archive-complete'])
config.add_section('config') config.add_section('config')
config.set('config', 'file', self.options['config-file']) config.set('config', 'file', self.options['config-file'])
config.add_section('tar') config.add_section('tar')
config.set('tar', 'binary', self.options['tar-binary']) config.set('tar', 'binary', self.options['tar-binary'])
config.set('tar', 'path', self.options['tar-path']) config.set('tar', 'path', self.options['tar-path'])
config.set('tar', 'archive', self.options['archive'])
config_filename = self.options['config'] config_filename = self.options['config']
with open(config_filename, 'w') as config_file: with open(config_filename, 'w') as config_file:
......
...@@ -26,14 +26,17 @@ ...@@ -26,14 +26,17 @@
############################################################################## ##############################################################################
import os import os
import subprocess
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
from slapos.recipe.librecipe.execute import execute
def service(args): def service(args):
if not os.path.exists(args['rootfs']) and \ if not os.path.exists(args['confirm']):
not os.path.exists(args['output']): subprocess.check_call([args['wget'], args['archive'],
execute([args['wget'], args['archive'], '-O', args['output']]) '-O', args['output']])
open(args['confirm'], 'w').close()
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
...@@ -48,7 +51,7 @@ class Recipe(GenericBaseRecipe): ...@@ -48,7 +51,7 @@ class Recipe(GenericBaseRecipe):
'wget': self.options['wget-binary'], 'wget': self.options['wget-binary'],
'archive': self.options['archive-url'], 'archive': self.options['archive-url'],
'output': self.options['downloaded-archive'], 'output': self.options['downloaded-archive'],
'rootfs': self.options['rootfs'] 'confirm': self.options['downloaded-archive-complete']
} }
) )
) )
......
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