kiwi-el8/kiwi/boot/image/__init__.py
Marcus Schäfer 368a9b1cbb Call dracut in system root tree
Change BootImageDracut class to call dracut in the specified
system root directory and not in a self prepared new root environment.
dracut reads scripts and dracut module configurations from the
installed system components, e.g kdump. Therefore calling it
from an isolated runtime environment creates an initrd which is
not matching the system components. Fixes bnc#1005246
2016-10-18 12:22:01 +02:00

43 lines
1.4 KiB
Python

# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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.
#
# kiwi 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 kiwi. If not, see <http://www.gnu.org/licenses/>
#
# project
from .kiwi import BootImageKiwi
from .dracut import BootImageDracut
from ...exceptions import (
KiwiBootImageSetupError
)
class BootImage(object):
"""
BootImge factory
"""
def __new__(self, xml_state, target_dir, root_dir=None):
initrd_system = xml_state.build_type.get_initrd_system()
if not initrd_system:
initrd_system = 'kiwi'
if initrd_system == 'kiwi':
return BootImageKiwi(xml_state, target_dir)
elif initrd_system == 'dracut':
return BootImageDracut(xml_state, target_dir, root_dir)
else:
raise KiwiBootImageSetupError(
'Support for %s initrd system not implemented' % initrd_system
)