diff --git a/plugins/sed/__init__.py b/plugins/sed/__init__.py new file mode 100644 index 0000000..e020769 --- /dev/null +++ b/plugins/sed/__init__.py @@ -0,0 +1,11 @@ + + +def tasks(tasklist, manifest): + import tasks + tasklist.add(tasks.DoSeds()) + + +def validate_manifest(data, schema_validate): + from os import path + schema_path = path.normpath(path.join(path.dirname(__file__), 'manifest-schema.json')) + schema_validate(data, schema_path) diff --git a/plugins/sed/manifest-schema.json b/plugins/sed/manifest-schema.json new file mode 100644 index 0000000..df71755 --- /dev/null +++ b/plugins/sed/manifest-schema.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Backports setup and package install", + "type": "object", + "properties": { + "plugins": { + "type": "object", + "properties": { + "sed": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "find": { + "type": "string" + }, + "replace": { + "type": "string" + } + } + } + }, + "required": ["sed"] + } + }, + "required": ["plugins"] +} diff --git a/plugins/sed/tasks.py b/plugins/sed/tasks.py new file mode 100644 index 0000000..b197121 --- /dev/null +++ b/plugins/sed/tasks.py @@ -0,0 +1,19 @@ +from base import Task +from common import phases +from common.tasks.apt import AptUpgrade +from common.tools import sed_i +import os + + +class DoSeds(Task): + description = 'Sedding files' + phase = phases.system_modification + after = [AptUpgrade] + def run(self, info): + + chroot_path = os.path.join(info.root, info.manifest.plugins['sed']['file']) + print chroot_path + print info.manifest.plugins['sed']['file'] + print info.manifest.plugins['sed']['find'] + print info.manifest.plugins['sed']['replace'] + sed_i(chroot_path, info.manifest.plugins['sed']['find'], info.manifest.plugins['sed']['replace']) diff --git a/plugins/sed/temp b/plugins/sed/temp new file mode 100644 index 0000000..0f9f99a --- /dev/null +++ b/plugins/sed/temp @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Backports setup and package install", + "type": "object", + "properties": { + "plugins": { + "type": "object", + "properties": { + "sed": { + "type": "array", + "items": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "find": { + "type": "string" + }, + "replace": { + "type": "string" + } + } + } + } + }, + "required": ["sed"] + } + }, + "required": ["plugins"] +}