aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-security
AgeCommit message (Expand)Author
2022-05-03tomoyo-tools: Drop md5sumKhem Raj
2022-05-03tomoyo-tools: Define SBINDIRKhem Raj
2022-04-18audit: Upgrade 3.0.6 -> 3.0.7Alex Kiernan
2022-03-29usbguard: package simplificationAnu Deepthika, Nandipati
2022-03-24usbguard: Add inital recipeAnu Deepthika, Nandipati
2022-03-04recipes: Update LICENSE variable to use SPDX license identifiersKhem Raj
2021-11-03recipes: Update SRC_URI branch and protocolsRichard Purdie
2021-10-19audit: upgrade 3.0.5 -> 3.0.6Yi Zhao
2021-10-14keyutils: fix install pathAlexander Thoma
2021-08-19audit: upgrade 3.0.4 -> 3.0.5Yi Zhao
2021-08-11audit: upgrade 3.0.3 -> 3.0.4Yi Zhao
2021-08-06audit: fix compile error for 2.8.5Yi Zhao
2021-08-03Convert to new override syntaxMartin Jansa
2021-08-03audit: upgrade 3.0.2 -> 3.0.3Yi Zhao
2021-07-08audit: upgrade 3.0.1 -> 3.0.2Yi Zhao
2021-05-12audit: migrate from meta-selinuxArmin Kuster
2021-05-11nmap: change shebang to python3Changqing Li
2021-02-17softhsm: update to 2.6.1 and alignakuster
2020-05-31passwdqc: remove double modify operationKonrad Weihmann
2020-02-15nmap: make ndiff support python3Mingli Yu
2020-01-24nmap: Use py3 in depends/rdependsKhem Raj
2020-01-22meta-oe: Remove using python2Khem Raj
2020-01-15keyutils: upgrade 1.6 -> 1.6.1Mingde (Matthew) Zeng
2019-11-22softhsm: add recipeJan Luebbe
2019-11-21recipes: rename distro_features_check to features_checkDenys Dmytriyenko
2019-10-25passwdqc: Clarify BSD license variantChristophe PRIOUZEAU
2019-09-25keyutils: Fix installed-vs-shipped for nativesdkRobert Yang
2019-09-23nmap: Update to 7.80Peiran Hong
2019-08-29Adapt to the lsb -> lsb-release change in OE-coreAdrian Bunk
2019-07-10keyutils: move recipe and patches from meta-security to meta-oeYongxin Liu
2019-03-07nmap: Fix build on RISC-VKhem Raj
2019-02-03nmap: Include additional FILES path for certsScott Ellis
2019-02-03nmap: Fix typo in pcre PACKAGECONFIGScott Ellis
2019-01-28nmap: Fix build with clang8/musl/libc++Khem Raj
2018-08-22nmap: install ndiffMingli Yu
2018-07-12nmap: update to 7.70Armin Kuster
2018-06-01nmap: move recipe from meta-security to meta-oeArmin Kuster
2018-03-29leveldb: move to recipes-dbsArmin Kuster
2018-03-05samba, openwsman, pam-ssh-agent-auth, sblim-sfcb, passwdqc, python-pam, smbne...Martin Jansa
2018-03-01passwdqc: move to recipes-securityArmin Kuster
2018-03-01leveldb: move to recipes-securityArmin Kuster
2018-03-01tomoyo-tools: move to recipes-secuityArmin Kuster
py3 OpenEmbedded Core user contribution treesGrokmirror user
aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/pluginbase.py
blob: ee8fe95c6f55f6dd4a97ca9290f3247ec149bf40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env python -tt
#
# Copyright (c) 2011 Intel, Inc.
#
# 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; version 2 of the License
#
# 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 wic import msger

class _Plugin(object):
    class __metaclass__(type):
        def __init__(cls, name, bases, attrs):
            if not hasattr(cls, 'plugins'):
                cls.plugins = {}

            elif 'wic_plugin_type' in attrs:
                if attrs['wic_plugin_type'] not in cls.plugins:
                    cls.plugins[attrs['wic_plugin_type']] = {}

            elif hasattr(cls, 'wic_plugin_type') and 'name' in attrs:
                cls.plugins[cls.wic_plugin_type][attrs['name']] = cls

        def show_plugins(cls):
            for cls in cls.plugins[cls.wic_plugin_type]:
                print cls

        def get_plugins(cls):
            return cls.plugins


class ImagerPlugin(_Plugin):
    wic_plugin_type = "imager"


class SourcePlugin(_Plugin):
    wic_plugin_type = "source"
    """
    The methods that can be implemented by --source plugins.

    Any methods not implemented in a subclass inherit these.
    """

    @classmethod
    def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
                        bootimg_dir, kernel_dir, native_sysroot):
        """
        Called after all partitions have been prepared and assembled into a
        disk image.  This provides a hook to allow finalization of a
        disk image e.g. to write an MBR to it.
        """
        msger.debug("SourcePlugin: do_install_disk: disk: %s" % disk_name)

    @classmethod
    def do_stage_partition(cls, part, source_params, creator, cr_workdir,
                           oe_builddir, bootimg_dir, kernel_dir,
                           native_sysroot):
        """
        Special content staging hook called before do_prepare_partition(),
        normally empty.

        Typically, a partition will just use the passed-in parame e.g
        straight bootimg_dir, etc, but in some cases, things need to
        be more tailored e.g. to use a deploy dir + /boot, etc.  This
        hook allows those files to be staged in a customized fashion.
        Not that get_bitbake_var() allows you to acces non-standard
        variables that you might want to use for this.
        """
        msger.debug("SourcePlugin: do_stage_partition: part: %s" % part)

    @classmethod
    def do_configure_partition(cls, part, source_params, creator, cr_workdir,
                               oe_builddir, bootimg_dir, kernel_dir,
                               native_sysroot):
        """
        Called before do_prepare_partition(), typically used to create
        custom configuration files for a partition, for example
        syslinux or grub config files.
        """
        msger.debug("SourcePlugin: do_configure_partition: part: %s" % part)

    @classmethod
    def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
                             oe_builddir, bootimg_dir, kernel_dir, rootfs_dir,
                             native_sysroot):
        """
        Called to do the actual content population for a partition i.e. it
        'prepares' the partition to be incorporated into the image.
        """
        msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part)

def get_plugins(typen):
    plugins = ImagerPlugin.get_plugins()
    if typen in plugins:
        return plugins[typen]
    else:
        return None

__all__ = ['ImagerPlugin', 'SourcePlugin', 'get_plugins']