--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+This project contains dracut modules. They are used for provisioning image from a boot CD.
+This RPM is installed in image.
+During RPM post dracut command is run to generate a provisioning initramfs.
+There are also Dracut modules which support reading configuration from Floppy/DVD header.
+It is also capable of configuring network, and fetcing Production CD over Network (instead of iLO), making CI runs faster.
+
--- /dev/null
+# PUT YOUR CONFIG HERE OR IN separate files named *.conf
+# in /etc/dracut.conf.d
+# SEE man dracut.conf(5)
+
+# Sample dracut config file
+
+logfile=/var/log/dracut.log
+fileloglvl=6
+
+# Exact list of dracut modules to use. Modules not listed here are not going
+# to be included. If you only want to add some optional modules use
+# add_dracutmodules option instead.
+#dracutmodules+=""
+#dracutmodules+="kernel-modules"
+
+# dracut modules to omit
+omit_dracutmodules+=" i18n network ifcfg nfs rootfs-block qemu qemu-net virtfs"
+
+# dracut modules to add to the default
+add_dracutmodules+=" installmedia"
+
+# additional kernel modules to the default
+add_drivers+=" nls_cp437 be2iscsi sg"
+
+install_items+="/lib/udev/rules.d/80-drivers.rules /lib/udev/rules.d/60-persistent-storage.rules"
+
+# list of kernel filesystem modules to be included in the generic initramfs
+#filesystems+=""
+
+# build initrd only to boot current hardware
+#hostonly="yes"
+#
+
+# install local /etc/mdadm.conf
+#mdadmconf="no"
+
+# install local /etc/lvm/lvm.conf
+#lvmconf="no"
+
+# A list of fsck tools to install. If it's not specified, module's hardcoded
+# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
+# xfs_repair e2fsck jfs_fsck reiserfsck btrfsck". The installation is
+# opportunistic, so non-existing tools are just ignored.
+#fscks=""
+
+# inhibit installation of any fsck tools
+#nofscks="yes"
+
+# mount / and /usr read-only by default
+#ro_mnt="no"
+
+# set the directory for temporary files
+# default: /var/tmp
+#tmpdir=/tmp
--- /dev/null
+pythonfiles file is generated with https://github.com/rhinstaller/anaconda/blob/master/dracut/python-deps
--- /dev/null
+#!/bin/bash
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+export SYS_BLOCK="/sys/class/block"
+export CONSOLE_DEV="/dev/tty0"
+export BOOTCD_LOCATION="/run/boot.iso"
+export CLOUD_CONFIGS="/tmp/cloud_configs"
+if (! declare -f warn );then
+ echo "warn function not defined assume running outside of dracut" > $CONSOLE_DEV
+ alias warn=echo
+fi
+
+function is_using_boot_cd(){
+ if [ -a $BOOTCD_LOCATION ];then
+ return 0
+ fi
+ return 1
+}
+
+function logmsg(){
+ message="$@"
+ echo $message > $CONSOLE_DEV
+ warn $message
+}
+
+function run_crit(){
+ OUTPUT=$(echo $@ | /bin/bash)
+ if [ $? -ne 0 ]; then
+ logmsg "Failed to execute $@::$OUTPUT"
+ exit 1
+ fi
+ echo $OUTPUT
+}
+
+function read_devices(){
+ # Get list of block devices on the system
+ device_list=$(ls $SYS_BLOCK)
+ read -r -a hd_devices <<< $device_list
+ export hd_devices
+}
+
+function check_params()
+{
+ if [ $1 -ne $(($#-1)) ];then
+ echo "Not enough params for ${FUNCNAME[ 1 ]}" > $CONSOLE_DEV
+ exit 1
+ fi
+}
+
+function try_mount(){
+ check_params 3 "$@"
+ dev=$1
+ device_mount=$2
+ umount_on_found=$3
+ if [ -e $dev ] && [ -b $dev ];then
+
+ mount -o ro -t iso9660 $dev $device_mount
+ if [ $? -ne 0 ];then
+ return 1
+ else
+ if [ -e "$device_mount/guest-image.img" ];then
+ if ( $umount_on_found ); then
+ umount $device_mount
+ fi
+ return 0
+ else
+ umount $device_mount
+ return 1
+ fi
+ fi
+ else
+ return 1
+ fi
+}
+
+function is_loop(){
+ check_params 1 "$@"
+ device=$1
+ if [ -e $SYS_BLOCK/$device/loop ]; then
+ return 0
+ fi
+ return 1
+}
+
+function is_partition(){
+ check_params 1 "$@"
+ device=$1
+ if [ -e $SYS_BLOCK/$device/partition ];then
+ return 0
+ fi
+ return 1
+}
+
+function is_removable(){
+ check_params 1 "$@"
+ device=$1
+ sysdev=$SYS_BLOCK/$device
+ if ( is_partition $device );then
+ removable=$(readlink -f $sysdev/..)/removable
+ else
+ removable=$sysdev/removable
+ fi
+ if [ -e $removable ] && [ $(cat $removable) -eq 1 ];then
+ return 0
+ else
+ return 1
+ fi
+
+}
+
+function get_config_from_device_end(){
+ check_params 1 "$@"
+ local BOOTDEVICE=$1
+
+ if [ -b $BOOTDEVICE ]; then
+ SKIP=$(($(blockdev --getsize64 $BOOTDEVICE)/2048-32))
+ dd if=$BOOTDEVICE of=/tmp/cloudconf.tgz bs=2k skip=$SKIP
+ if gzip -t /tmp/cloudconf.tgz 2>/dev/null ; then
+ logmsg "Copying cloud configurations to $CLOUD_CONFIGS"
+ mkdir -p $CLOUD_CONFIGS
+ tar xzf /tmp/cloudconf.tgz -C $CLOUD_CONFIGS
+ return $?
+ else
+ return 1
+ fi
+ else
+ return 1
+ fi
+
+}
+
+function find_iso(){
+ check_params 2 "$@"
+ device_mount=$1
+ umount_on_found=$2
+ if [ ! -d $device_mount ];then
+ mkdir -p $device_mount
+ fi
+ read_devices
+ for device in ${hd_devices[@]}; do
+ if ( is_removable $device );then
+ if ( try_mount /dev/$device $device_mount $umount_on_found );then
+ logmsg "installmedia: found image from device $device."
+ export BOOTDEVICE=/dev/${device}
+ return 0
+ fi
+ fi
+ done
+ return 1
+}
--- /dev/null
+#!/bin/sh
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DEVICE_MOUNT="/tmp/installmedia"
+CLOUD_RPMS_DIR="/sysroot/var/cloud/basebuild_rpms"
+USERCONFIG_DIR="/sysroot/etc/userconfig/"
+IMAGE_DIR="/sysroot/opt/images"
+
+source /usr/lib/installmedia-lib.sh
+
+logmsg "Installing OS to HDD"
+
+mkdir -p $DEVICE_MOUNT
+
+if ( is_using_boot_cd );then
+ warn "Must be boot_cd env. Mounting $BOOTCD_LOCATION"
+ run_crit mount -o ro -t iso9660 $BOOTCD_LOCATION $DEVICE_MOUNT
+else
+ find_iso $DEVICE_MOUNT false
+ if [ $? -ne 0 ];then
+ logmsg "No ISO image to install. Cannot proceed!"
+ exit 1
+ fi
+fi
+
+if [ -e $CLOUD_CONFIGS/network_config ];then
+ logmsg "Sourcing network_config"
+ source $CLOUD_CONFIGS/network_config
+fi
+
+if [ -n "${ROOTFS_DISK}" ];then
+ rootdev_by_path=${ROOTFS_DISK}
+else
+ # Find out the disk name where rootfs has to be installed
+ rootdev_by_path=$(python /usr/lib/python2.7/site-packages/hw_detector/local_os_disk.py)
+fi
+
+rootdev=$(readlink -e $rootdev_by_path)
+
+#Wait for the device to appear for 60 seconds and then give up
+while [ -z "${rootdev}" ]; do
+ sleep 3
+ rootdev=$(readlink -e $rootdev_by_path)
+ count=$(( ${count}+1 ))
+ if [ ${count} == 20 ]; then
+ break
+ fi
+
+done
+
+if [ -z ${rootdev} ] || ! [ -b ${rootdev} ]; then
+ logmsg "No matching HDD (${rootdev}) found to install OS image. Cannot proceed!"
+ exit 1
+fi
+if ! [ -e $DEVICE_MOUNT/guest-image.img ]; then
+ logmsg "No guest-image.img in CDROM. Cannot proceed!"
+ exit 1
+fi
+
+logmsg "Matching device found for root disk. Installing image on ${rootdev}"
+
+read_devices
+for hd_dev in ${hd_devices[@]}; do
+ if [ -b /dev/$hd_dev ] && (( is_removable $hd_dev ) || ( is_partition $hd_dev ) || ( is_loop $hd_dev )); then
+ logmsg "Removable, loop or partition $hd_dev. Skipping..."
+ continue
+ elif ! [ -b /dev/$hd_dev ];then
+ continue
+ fi
+ logmsg "Erasing existing GPT and MBR data structures from ${hd_dev}"
+ sgdisk -Z /dev/$hd_dev
+ dd if=/dev/zero of=/dev/$hd_dev bs=1M count=1
+done
+
+logmsg "Dumping $DEVICE_MOUNT/guest-image.img to $rootdev"
+
+# limit the memory usage for qemu-img to 1 GiB
+ulimit -v 1048576
+qemu-img convert -p -t directsync -O host_device $DEVICE_MOUNT/guest-image.img $rootdev > $CONSOLE_DEV
+if [ $? -ne 0 ]; then
+ logmsg "Failed to dump image to disk... Failing installation."
+ exit 255
+fi
+sync
+
+logmsg "${rootdev} dumped successfully!"
+echo "Finishing installation... Please wait." > $CONSOLE_DEV
+
+partprobe ${rootdev}
+# create a new partion for LVMs before rootfs expands till end
+parted ${rootdev} --script -- mkpart primary 50GiB -1
+partprobe ${rootdev}
+
+mount ${rootdev}1 /sysroot/
+if [ $? -ne 0 ];then
+ logmsg "FAILED TO MOUNT SYSROOT. All hope is lost"
+ exit 255
+fi
+
+kernel_cmdline="intel_iommu=on iommu=pt crashkernel=256M"
+# Check if this has a iscsi target if so, add extra cmdline option for HDD boot.
+iscsiadm -m fw >/dev/null 2>&1
+if [[ $? == 0 ]]; then
+ kernel_cmdline="${kernel_cmdline} rd.iscsi.firmware=1 rd.retry=30"
+fi
+if grep -q "^GRUB_CMDLINE_LINUX" /sysroot/etc/default/grub; then
+ sed -i "s/^\(GRUB_CMDLINE_LINUX=.*\)\"$/\1 $kernel_cmdline\"/g" /sysroot/etc/default/grub
+else
+ echo "GRUB_CMDLINE_LINUX=\"$kernel_cmdline\"" >> /sysroot/etc/default/grub
+fi
+
+run_crit mount -o bind /dev /sysroot/dev
+run_crit mount -o bind /proc /sysroot/proc
+run_crit mount -o bind /sys /sysroot/sys
+run_crit chroot /sysroot /bin/bash -c \"/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg\"
+
+logmsg "Extending partition and filesystem size"
+run_crit chroot /sysroot /bin/bash -c \"growpart ${rootdev} 1\"
+run_crit chroot /sysroot /bin/bash -c \"xfs_growfs /\"
+
+logmsg "Copying cloud guest image"
+mkdir -p $IMAGE_DIR
+run_crit cp -f $DEVICE_MOUNT/guest-image.img $IMAGE_DIR
+
+if [ -d $CLOUD_CONFIGS ]; then
+ logmsg "Copying user config"
+ mkdir -p $USERCONFIG_DIR
+ cp -rf $CLOUD_CONFIGS/* $USERCONFIG_DIR
+fi
+
+if [ -e $DEVICE_MOUNT/rpms ]; then
+ logmsg "Copying build base RPMs"
+ mkdir -p $CLOUD_RPMS_DIR
+ echo -n "."
+ for file in $DEVICE_MOUNT/rpms/*;do
+ cp -a $file $CLOUD_RPMS_DIR
+ echo -n "." > $CONSOLE_DEV
+ done
+ echo -n " done" > $CONSOLE_DEV
+ echo > $CONSOLE_DEV
+ echo > $CONSOLE_DEV
+fi
+
+logmsg "Disabling cloud-init services on this node"
+run_crit chroot /sysroot /bin/systemctl --no-reload disable cloud-config.service
+run_crit chroot /sysroot /bin/systemctl --no-reload disable cloud-final.service
+run_crit chroot /sysroot /bin/systemctl --no-reload disable cloud-init.service
+run_crit chroot /sysroot /bin/systemctl --no-reload disable cloud-init-local.service
+
+
+logmsg "Copying installation logs"
+mkdir -p /sysroot/var/log/provisioning-logs
+cp -rf /run/log/ /sysroot/var/log/provisioning-logs/
+cp -rf /run/initramfs/ /sysroot/var/log/provisioning-logs/
+
+
+sync
+umount /sysroot/dev
+umount /sysroot/proc
+umount /sysroot/sys
+umount /sysroot
+umount $DEVICE_MOUNT
+sleep 2
+logmsg "Everything done rebooting!"
+reboot -f
--- /dev/null
+#!/bin/sh
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+warn "load_modules.sh: Loading Disk Drivers"
+
+modprobe -f be2iscsi
+modprobe sr_mod
+modprobe mpt3sas
--- /dev/null
+#!/bin/bash
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ # do not add this module by default
+ return 255
+}
+
+depends ()
+{
+ echo readcdconf readfloppyconf netconfig
+ return 0
+}
+
+installkernel()
+{
+ instmods = sr_mod mpt3sas raid_class scsi_transport_sas weak-updates/be2iscsi/be2iscsi ipmi_msghandler ipmi_devintf ipmi_si
+}
+
+install_python_module() {
+
+ local src dst module
+ if (($# != 3 )); then
+ derror "install_python_module takes 3 arguments"
+ fi
+ src=$1/$3
+ dst=$2/$3
+ module=$3
+ for file in $(find $src -type f -printf "%P\n"); do
+ inst_simple $src/$file $dst/$file
+ done
+}
+
+install() {
+ dracut_install df du partprobe parted gunzip ip gzip fdisk find lsmod loadkeys iscsid iscsiadm sync qemu-img sgdisk python ipmitool
+ inst_hook pre-udev 48 "$moddir/load_modules.sh"
+ inst_hook pre-pivot 53 "$moddir/installmedia.sh"
+ inst_simple "$moddir/installmedia-lib.sh" /usr/lib/installmedia-lib.sh
+ cat "$moddir/python_files" | while read dep; do
+ case "$dep" in
+ *.so) inst_library $dep ;;
+ *.py) inst_simple $dep ;;
+ *) inst $dep ;;
+ esac
+ done
+
+ src_dir="/usr/lib/python2.7/site-packages"
+ dst_dir="/usr/lib/python2.7/site-packages"
+ inst_simple $src_dir/__init__.py $dst_dir/__init__.py
+ install_python_module $src_dir $dst_dir "hw_detector"
+}
+
--- /dev/null
+/usr/lib64/python2.7/config/Makefile
+/usr/include/python2.7/pyconfig-64.h
+/usr/lib64/python2.7/ftplib.py
+/usr/lib64/python2.7/lib-tk/test/test_tkinter/__init__.py
+/usr/lib64/python2.7/lib-dynload/math.so
+/usr/lib64/python2.7/BaseHTTPServer.py
+/usr/lib64/python2.7/encodings/cp862.py
+/usr/lib64/python2.7/weakref.py
+/usr/lib64/python2.7/encodings/iso2022_jp.py
+/usr/lib64/python2.7/distutils/command/bdist_wininst.py
+/usr/lib64/python2.7/unittest/test/test_functiontestcase.py
+/usr/lib64/python2.7/lib-dynload/_struct.so
+/usr/lib64/python2.7/encodings/iso2022_jp_1.py
+/usr/lib64/python2.7/threading.py
+/usr/lib64/python2.7/encodings/iso8859_2.py
+/usr/lib64/python2.7/lib-tk/test/test_ttk/test_functions.py
+/usr/lib64/python2.7/encodings/cp857.py
+/usr/lib64/python2.7/pkgutil.py
+/usr/lib64/python2.7/distutils/msvc9compiler.py
+/usr/lib64/python2.7/distutils/command/bdist_msi.py
+/usr/lib64/python2.7/rfc822.py
+/usr/lib64/python2.7/lib-tk/tkColorChooser.py
+/usr/lib64/python2.7/distutils/cmd.py
+/usr/lib64/python2.7/encodings/cp037.py
+/usr/lib64/python2.7/httplib.py
+/usr/lib64/python2.7/encodings/palmos.py
+/usr/lib64/python2.7/distutils/command/config.py
+/usr/lib64/python2.7/encodings/utf_7.py
+/usr/lib64/python2.7/encodings/cp860.py
+/usr/lib64/python2.7/lib-tk/turtle.py
+/usr/lib64/python2.7/glob.py
+/usr/lib64/python2.7/encodings/utf_16_be.py
+/usr/lib64/python2.7/encodings/uu_codec.py
+/usr/lib64/python2.7/gettext.py
+/usr/lib64/python2.7/encodings/cp865.py
+/usr/lib64/python2.7/lib-dynload/_collectionsmodule.so
+/usr/lib64/python2.7/encodings/iso2022_jp_3.py
+/usr/lib64/python2.7/encodings/cp850.py
+/usr/lib64/python2.7/distutils/command/install.py
+/usr/lib64/python2.7/pickle.py
+/usr/lib64/python2.7/ctypes/macholib/framework.py
+/usr/lib64/python2.7/distutils/command/install_egg_info.py
+/usr/lib64/python2.7/ctypes/macholib/dyld.py
+/usr/lib64/python2.7/dummy_threading.py
+/usr/lib64/python2.7/distutils/version.py
+/usr/lib64/python2.7/lib-dynload/selectmodule.so
+/usr/lib64/python2.7/_abcoll.py
+/usr/lib64/python2.7/unittest/suite.py
+/usr/lib64/python2.7/encodings/iso8859_14.py
+/usr/lib64/python2.7/distutils/emxccompiler.py
+/usr/lib64/python2.7/lib-tk/Canvas.py
+/usr/lib64/python2.7/encodings/cp932.py
+/usr/lib64/python2.7/email/quoprimime.py
+/usr/lib64/python2.7/encodings/iso8859_4.py
+/usr/lib64/python2.7/traceback.py
+/usr/lib64/python2.7/email/feedparser.py
+/usr/lib64/python2.7/encodings/cp852.py
+/usr/lib64/python2.7/email/mime/__init__.py
+/usr/lib64/python2.7/encodings/utf_16_le.py
+/usr/lib64/python2.7/unittest/test/test_loader.py
+/usr/lib64/python2.7/tokenize.py
+/usr/lib64/python2.7/encodings/punycode.py
+/usr/lib64/python2.7/sysconfig.py
+/usr/lib64/python2.7/encodings/mac_greek.py
+/usr/lib64/python2.7/StringIO.py
+/usr/lib64/python2.7/uu.py
+/usr/lib64/python2.7/distutils/__init__.py
+/usr/lib64/python2.7/UserDict.py
+/usr/lib64/python2.7/unittest/__init__.py
+/usr/lib64/python2.7/atexit.py
+/usr/lib64/python2.7/distutils/command/upload.py
+/usr/lib64/python2.7/encodings/cp737.py
+/usr/lib64/python2.7/sre_parse.py
+/usr/lib64/python2.7/encodings/utf_32.py
+/usr/lib64/python2.7/encodings/gbk.py
+/usr/lib64/python2.7/distutils/command/build_scripts.py
+/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_text.py
+/usr/lib64/python2.7/encodings/iso2022_kr.py
+/usr/lib64/python2.7/email/mime/application.py
+/usr/lib64/python2.7/encodings/big5.py
+/usr/lib64/python2.7/copy_reg.py
+/usr/lib64/python2.7/lib-dynload/itertoolsmodule.so
+/usr/lib64/python2.7/lib-dynload/stropmodule.so
+/usr/lib64/python2.7/logging/__init__.py
+/usr/lib64/python2.7/encodings/gb18030.py
+/usr/lib64/python2.7/encodings/shift_jisx0213.py
+/usr/lib64/python2.7/encodings/quopri_codec.py
+/usr/lib64/python2.7/lib-tk/test/test_ttk/__init__.py
+/usr/lib64/python2.7/ctypes/_endian.py
+/usr/lib64/python2.7/lib-dynload/_ssl.so
+/usr/lib64/python2.7/email/mime/message.py
+/usr/lib64/python2.7/keyword.py
+/usr/lib64/python2.7/distutils/archive_util.py
+/usr/lib64/python2.7/email/mime/text.py
+/usr/lib64/python2.7/formatter.py
+/usr/lib64/python2.7/_weakrefset.py
+/usr/lib64/python2.7/pydoc_data/topics.py
+/usr/lib64/python2.7/encodings/euc_jp.py
+/usr/lib64/python2.7/lib-tk/Tkdnd.py
+/usr/lib64/python2.7/unittest/test/test_discovery.py
+/usr/lib64/python2.7/encodings/iso8859_3.py
+/usr/lib64/python2.7/quopri.py
+/usr/lib64/python2.7/encodings/mac_centeuro.py
+/usr/lib64/python2.7/getpass.py
+/usr/lib64/python2.7/inspect.py
+/usr/lib64/python2.7/distutils/sysconfig.py
+/usr/lib64/python2.7/distutils/cygwinccompiler.py
+/usr/lib64/python2.7/encodings/mac_roman.py
+/usr/lib64/python2.7/email/_parseaddr.py
+/usr/lib64/python2.7/email/base64mime.py
+/usr/lib64/python2.7/tempfile.py
+/usr/lib64/python2.7/encodings/zlib_codec.py
+/usr/lib64/python2.7/unittest/result.py
+/usr/lib64/python2.7/distutils/unixccompiler.py
+/usr/lib64/python2.7/encodings/iso8859_7.py
+/usr/lib64/python2.7/encodings/rot_13.py
+/usr/lib64/python2.7/unittest/test/test_program.py
+/usr/lib64/python2.7/optparse.py
+/usr/lib64/python2.7/unittest/loader.py
+/usr/lib64/python2.7/email/mime/audio.py
+/usr/lib64/python2.7/encodings/cp864.py
+/usr/lib64/python2.7/pydoc_data/__init__.py
+/usr/lib64/python2.7/distutils/command/build.py
+/usr/lib64/python2.7/distutils/command/clean.py
+/usr/lib64/python2.7/encodings/iso2022_jp_2.py
+/usr/lib64/python2.7/encodings/iso8859_5.py
+/usr/lib64/python2.7/re.py
+/usr/lib64/python2.7/collections.py
+/usr/lib64/python2.7/distutils/log.py
+/usr/lib64/python2.7/encodings/euc_kr.py
+/usr/lib64/python2.7/encodings/mac_farsi.py
+/usr/lib64/python2.7/ctypes/__init__.py
+/usr/lib64/python2.7/lib-dynload/cStringIO.so
+/usr/lib64/python2.7/unittest/test/test_runner.py
+/usr/lib64/python2.7/ctypes/macholib/__init__.py
+/usr/lib64/python2.7/lib-dynload/readline.so
+/usr/lib64/python2.7/contextlib.py
+/usr/lib64/python2.7/sre_compile.py
+/usr/lib64/python2.7/unittest/test/support.py
+/usr/lib64/python2.7/encodings/koi8_r.py
+/usr/lib64/python2.7/lib-tk/ttk.py
+/usr/lib64/python2.7/logging/config.py
+/usr/lib64/python2.7/distutils/command/install_lib.py
+/usr/lib64/python2.7/unittest/test/test_skipping.py
+/usr/lib64/python2.7/distutils/text_file.py
+/usr/lib64/python2.7/distutils/config.py
+/usr/lib64/python2.7/email/utils.py
+/usr/lib64/python2.7/encodings/ptcp154.py
+/usr/lib64/python2.7/encodings/shift_jis_2004.py
+/usr/lib64/python2.7/lib-tk/Tkconstants.py
+/usr/lib64/python2.7/lib-dynload/_functoolsmodule.so
+/usr/lib64/python2.7/_threading_local.py
+/usr/lib64/python2.7/encodings/utf_32_be.py
+/usr/lib64/python2.7/lib-dynload/termios.so
+/usr/lib64/python2.7/unittest/test/test_break.py
+/usr/lib64/python2.7/dis.py
+/usr/lib64/python2.7/encodings/cp500.py
+/usr/lib64/python2.7/encodings/cp949.py
+/usr/lib64/python2.7/distutils/debug.py
+/usr/lib64/python2.7/genericpath.py
+/usr/lib64/python2.7/distutils/command/register.py
+/usr/lib64/python2.7/linecache.py
+/usr/lib64/python2.7/encodings/cp775.py
+/usr/lib64/python2.7/lib-tk/tkSimpleDialog.py
+/usr/lib64/python2.7/email/encoders.py
+/usr/lib64/python2.7/lib-tk/test/test_ttk/test_widgets.py
+/usr/lib64/python2.7/unittest/runner.py
+/usr/lib64/python2.7/email/__init__.py
+/usr/lib64/python2.7/encodings/shift_jis.py
+/usr/lib64/python2.7/distutils/bcppcompiler.py
+/usr/lib64/python2.7/sre_constants.py
+/usr/lib64/python2.7/encodings/cp1253.py
+/usr/lib64/python2.7/lib-dynload/timemodule.so
+/usr/lib64/python2.7/lib-dynload/fcntlmodule.so
+/usr/lib64/python2.7/ctypes/wintypes.py
+/usr/lib64/python2.7/mimetypes.py
+/usr/lib64/python2.7/unittest/main.py
+/usr/lib64/python2.7/lib-tk/FixTk.py
+/usr/lib64/python2.7/encodings/hex_codec.py
+/usr/lib64/python2.7/encodings/utf_32_le.py
+/usr/lib64/python2.7/_osx_support.py
+/usr/lib64/python2.7/email/mime/image.py
+/usr/lib64/python2.7/lib-dynload/_socketmodule.so
+/usr/lib64/python2.7/distutils/command/bdist_rpm.py
+/usr/lib64/python2.7/distutils/filelist.py
+/usr/lib64/python2.7/encodings/mac_turkish.py
+/usr/lib64/python2.7/ntpath.py
+/usr/lib64/python2.7/lib-dynload/_randommodule.so
+/usr/lib64/python2.7/encodings/cp1255.py
+/usr/lib64/python2.7/encodings/utf_8.py
+/usr/lib64/python2.7/string.py
+/usr/lib64/python2.7/encodings/raw_unicode_escape.py
+/usr/lib64/python2.7/codecs.py
+/usr/lib64/python2.7/encodings/euc_jis_2004.py
+/usr/lib64/python2.7/functools.py
+/usr/lib64/python2.7/distutils/dist.py
+/usr/lib64/python2.7/encodings/cp1250.py
+/usr/lib64/python2.7/posixpath.py
+/usr/lib64/python2.7/nturl2path.py
+/usr/lib64/python2.7/email/generator.py
+/usr/lib64/python2.7/encodings/hp_roman8.py
+/usr/lib64/python2.7/encodings/cp1257.py
+/usr/lib64/python2.7/encodings/cp1140.py
+/usr/lib64/python2.7/lib-tk/SimpleDialog.py
+/usr/lib64/python2.7/encodings/big5hkscs.py
+/usr/lib64/python2.7/os2emxpath.py
+/usr/lib64/python2.7/encodings/bz2_codec.py
+/usr/lib64/python2.7/distutils/extension.py
+/usr/lib64/python2.7/encodings/johab.py
+/usr/lib64/python2.7/email/mime/multipart.py
+/usr/lib64/python2.7/distutils/command/__init__.py
+/usr/lib64/python2.7/lib-dynload/_localemodule.so
+/usr/lib64/python2.7/socket.py
+/usr/lib64/python2.7/ctypes/util.py
+/usr/lib64/python2.7/encodings/iso8859_8.py
+/usr/lib64/python2.7/lib-tk/tkMessageBox.py
+/usr/lib64/python2.7/encodings/cp1252.py
+/usr/lib64/python2.7/lib-dynload/_hashlib.so
+/usr/lib64/python2.7/encodings/euc_jisx0213.py
+/usr/lib64/python2.7/encodings/idna.py
+/usr/lib64/python2.7/encodings/mac_iceland.py
+/usr/lib64/python2.7/lib-tk/test/test_ttk/test_extensions.py
+/usr/lib64/python2.7/encodings/tis_620.py
+/usr/lib64/python2.7/warnings.py
+/usr/lib64/python2.7/types.py
+/usr/lib64/python2.7/logging/handlers.py
+/usr/lib64/python2.7/lib-dynload/operator.so
+/usr/lib64/python2.7/distutils/spawn.py
+/usr/lib64/python2.7/lib-tk/Tkinter.py
+/usr/lib64/python2.7/encodings/utf_16.py
+/usr/lib64/python2.7/distutils/fancy_getopt.py
+/usr/lib64/python2.7/distutils/msvccompiler.py
+/usr/lib64/python2.7/encodings/aliases.py
+/usr/lib64/python2.7/encodings/iso2022_jp_ext.py
+/usr/lib64/python2.7/os.py
+/usr/lib64/python2.7/calendar.py
+/usr/lib64/python2.7/difflib.py
+/usr/lib64/python2.7/encodings/utf_8_sig.py
+/usr/lib64/python2.7/encodings/iso2022_jp_2004.py
+/usr/lib64/python2.7/encodings/mbcs.py
+/usr/lib64/python2.7/unittest/signals.py
+/usr/lib64/python2.7/ctypes/macholib/dylib.py
+/usr/lib64/python2.7/unittest/test/__init__.py
+/usr/lib64/python2.7/pydoc.py
+/usr/lib64/python2.7/opcode.py
+/usr/lib64/python2.7/subprocess.py
+/usr/lib64/python2.7/heapq.py
+/usr/lib64/python2.7/email/charset.py
+/usr/lib64/python2.7/unittest/test/test_result.py
+/usr/lib64/python2.7/distutils/command/install_headers.py
+/usr/lib64/python2.7/encodings/iso8859_11.py
+/usr/lib64/python2.7/encodings/cp1254.py
+/usr/lib64/python2.7/fnmatch.py
+/usr/lib64/python2.7/abc.py
+/usr/lib64/python2.7/distutils/ccompiler.py
+/usr/lib64/python2.7/webbrowser.py
+/usr/lib64/python2.7/unittest/__main__.py
+/usr/lib64/python2.7/encodings/cp874.py
+/usr/lib64/python2.7/site.py
+/usr/lib64/python2.7/encodings/iso8859_9.py
+/usr/lib64/python2.7/encodings/cp1258.py
+/usr/lib64/python2.7/distutils/command/check.py
+/usr/lib64/python2.7/encodings/latin_1.py
+/usr/lib64/python2.7/encodings/koi8_u.py
+/usr/lib64/python2.7/lib-tk/Tix.py
+/usr/lib64/python2.7/lib-tk/Dialog.py
+/usr/lib64/python2.7/lib-tk/ScrolledText.py
+/usr/lib64/python2.7/unittest/test/dummy.py
+/usr/lib64/python2.7/unittest/test/test_setups.py
+/usr/lib64/python2.7/lib-dynload/datetime.so
+/usr/lib64/python2.7/distutils/command/build_ext.py
+/usr/lib64/python2.7/encodings/mac_romanian.py
+/usr/lib64/python2.7/ssl.py
+/usr/lib64/python2.7/email/mime/nonmultipart.py
+/usr/lib64/python2.7/encodings/string_escape.py
+/usr/lib64/python2.7/distutils/errors.py
+/usr/lib64/python2.7/pdb.py
+/usr/lib64/python2.7/hashlib.py
+/usr/lib64/python2.7/lib-tk/test/runtktests.py
+/usr/lib64/python2.7/locale.py
+/usr/lib64/python2.7/getopt.py
+/usr/lib64/python2.7/distutils/command/install_data.py
+/usr/lib64/python2.7/lib-dynload/_tkinter.so
+/usr/lib64/python2.7/lib-dynload/_heapq.so
+/usr/lib64/python2.7/distutils/command/build_py.py
+/usr/lib64/python2.7/encodings/mac_latin2.py
+/usr/lib64/python2.7/pprint.py
+/usr/lib64/python2.7/lib-tk/FileDialog.py
+/usr/lib64/python2.7/encodings/mac_cyrillic.py
+/usr/lib64/python2.7/encodings/cp1251.py
+/usr/lib64/python2.7/encodings/cp1006.py
+/usr/lib64/python2.7/encodings/cp1256.py
+/usr/lib64/python2.7/email/iterators.py
+/usr/lib64/python2.7/distutils/command/sdist.py
+/usr/lib64/python2.7/email/message.py
+/usr/lib64/python2.7/encodings/iso8859_13.py
+/usr/lib64/python2.7/email/parser.py
+/usr/lib64/python2.7/distutils/command/build_clib.py
+/usr/lib64/python2.7/copy.py
+/usr/lib64/python2.7/tty.py
+/usr/lib64/python2.7/encodings/iso8859_16.py
+/usr/lib64/python2.7/lib-tk/test/test_ttk/test_style.py
+/usr/lib64/python2.7/encodings/gb2312.py
+/usr/lib64/python2.7/distutils/dep_util.py
+/usr/lib64/python2.7/_sysconfigdata.py
+/usr/lib64/python2.7/encodings/mac_arabic.py
+/usr/lib64/python2.7/distutils/command/install_scripts.py
+/usr/lib64/python2.7/encodings/__init__.py
+/usr/lib64/python2.7/urlparse.py
+/usr/lib64/python2.7/unittest/test/test_assertions.py
+/usr/lib64/python2.7/encodings/base64_codec.py
+/usr/lib64/python2.7/email/header.py
+/usr/lib64/python2.7/shlex.py
+/usr/lib64/python2.7/unittest/case.py
+/usr/lib64/python2.7/mimetools.py
+/usr/lib64/python2.7/base64.py
+/usr/lib64/python2.7/lib-tk/tkCommonDialog.py
+/usr/lib64/python2.7/encodings/undefined.py
+/usr/lib64/python2.7/encodings/mac_croatian.py
+/usr/lib64/python2.7/encodings/cp861.py
+/usr/lib64/python2.7/lib-dynload/arraymodule.so
+/usr/lib64/python2.7/email/mime/base.py
+/usr/lib64/python2.7/lib-tk/tkFont.py
+/usr/lib64/python2.7/doctest.py
+/usr/lib64/python2.7/encodings/ascii.py
+/usr/lib64/python2.7/urllib.py
+/usr/lib64/python2.7/io.py
+/usr/lib64/python2.7/distutils/command/bdist_dumb.py
+/usr/lib64/python2.7/encodings/cp875.py
+/usr/lib64/python2.7/distutils/file_util.py
+/usr/lib64/python2.7/encodings/cp424.py
+/usr/lib64/python2.7/encodings/unicode_escape.py
+/usr/lib64/python2.7/distutils/core.py
+/usr/lib64/python2.7/encodings/charmap.py
+/usr/lib64/python2.7/dummy_thread.py
+/usr/lib64/python2.7/encodings/iso8859_10.py
+/usr/lib64/python2.7/encodings/iso8859_15.py
+/usr/lib64/python2.7/textwrap.py
+/usr/lib64/python2.7/encodings/cp1026.py
+/usr/lib64/python2.7/distutils/util.py
+/usr/lib64/python2.7/encodings/iso8859_1.py
+/usr/lib64/python2.7/distutils/dir_util.py
+/usr/lib64/python2.7/encodings/cp869.py
+/usr/lib64/python2.7/lib-dynload/binascii.so
+/usr/lib64/python2.7/token.py
+/usr/lib64/python2.7/lib-tk/tkFileDialog.py
+/usr/lib64/python2.7/cmd.py
+/usr/lib64/python2.7/encodings/cp863.py
+/usr/lib64/python2.7/bdb.py
+/usr/lib64/python2.7/unittest/util.py
+/usr/lib64/python2.7/encodings/cp856.py
+/usr/lib64/python2.7/lib-tk/test/test_ttk/support.py
+/usr/lib64/python2.7/distutils/command/bdist.py
+/usr/lib64/python2.7/__future__.py
+/usr/lib64/python2.7/encodings/cp858.py
+/usr/lib64/python2.7/distutils/versionpredicate.py
+/usr/lib64/python2.7/encodings/unicode_internal.py
+/usr/lib64/python2.7/encodings/cp866.py
+/usr/lib64/python2.7/lib-dynload/_io.so
+/usr/lib64/python2.7/random.py
+/usr/lib64/python2.7/encodings/cp855.py
+/usr/lib64/python2.7/unittest/test/test_suite.py
+/usr/lib64/python2.7/encodings/iso8859_6.py
+/usr/lib64/python2.7/repr.py
+/usr/lib64/python2.7/encodings/cp950.py
+/usr/lib64/python2.7/ConfigParser.py
+/usr/lib64/python2.7/email/errors.py
+/usr/lib64/python2.7/SocketServer.py
+/usr/lib64/python2.7/lib-dynload/_ctypes.so
+/usr/lib64/python2.7/encodings/cp437.py
+/usr/lib64/python2.7/encodings/hz.py
+/usr/lib64/python2.7/unittest/test/test_case.py
+/usr/lib64/python2.7/lib-dynload/cPickle.so
+/usr/lib64/python2.7/struct.py
+/usr/lib64/python2.7/lib-tk/test/test_tkinter/test_loadtk.py
+/usr/lib64/python2.7/stat.py
+/usr/lib64/python2.7/encodings/cp720.py
--- /dev/null
+#!/bin/sh
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# intelligent modeprobing of network modules is needed.
+warn "load_net_modules.sh: Loading net drivers"
+modprobe virtio_net
+modprobe be2net
+modprobe ixgbe
+modprobe mlx4_en
+modprobe mlx5_core
+modprobe 8021q
+modprobe tg3
--- /dev/null
+#!/bin/bash
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ # do not add this module by default
+ return 255
+}
+
+installkernel()
+{
+ instmods = 8021q virtio_net be2net mlx4_en mlx4_core mlx5_core mlx4_bi ixgbe mdio dca ptp pps_core tg3
+}
+
+depends() {
+ echo nss-softokn
+ return 0
+}
+
+install() {
+ dracut_install wget curl ping /lib64/libnss_dns.so.2 /etc/nsswitch.conf
+ inst_hook pre-udev 48 "$moddir/load_net_modules.sh"
+ inst_hook pre-pivot 52 "$moddir/net_config_get_iso.sh"
+
+ local _dir _crt _found _lib
+ inst_multiple curl
+ # also install libs for curl https
+ inst_libdir_file "libnsspem.so*"
+ inst_libdir_file "libnsssysinit.so*"
+ inst_libdir_file "libsqlite3.so*"
+
+ for _dir in $libdirs; do
+ [[ -d $_dir ]] || continue
+ for _lib in $_dir/libcurl.so.*; do
+ [[ -e $_lib ]] || continue
+ _crt=$(grep -F --binary-files=text -z .crt $_lib)
+ [[ $_crt ]] || continue
+ [[ $_crt == /*/* ]] || continue
+ if ! inst_simple "$_crt"; then
+ dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
+ continue
+ fi
+ _found=1
+ done
+ done
+ [[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
+}
+
--- /dev/null
+#!/bin/sh
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+source /usr/lib/installmedia-lib.sh
+
+if [ -e /tmp/cloud_configs/network_config ];then
+ warn "net_config_get_iso: Creating local network configurations, to download boot.iso."
+ source /tmp/cloud_configs/network_config
+
+ if [ $VLAN ]; then
+ warn "net_config_get_iso: Configuring VLAN network"
+ ip link add link $DEV name ${DEV}.${VLAN} type vlan id $VLAN
+ ip a a $IP dev ${DEV}.${VLAN}
+ ip link set up dev ${DEV}.${VLAN}
+ ip link set up dev ${DEV}
+ ip r a default via ${DGW} dev ${DEV}.${VLAN}
+ EXT_DEV="${DEV}.${VLAN}"
+ else
+ warn "net_config_get_iso: Configuring non-VLAN network"
+ ip a a $IP dev ${DEV}
+ ip link set up dev ${DEV}
+ ip r a default via ${DGW} dev ${DEV}
+ EXT_DEV="${DEV}"
+ fi
+
+ wait_count=0
+ ip link show ${EXT_DEV} | grep "LOWER_UP" > /dev/null 2>&1
+ while [ $? != 0 ]
+ do
+ sleep 2
+ ((wait_count++))
+ if [[ $wait_count == 10 ]]; then
+ warn "net_config_get_iso: Link on ${EXT_DEV} did not come-up. Cannot proceed!"
+ exit 1
+ fi
+ warn "net_config_get_iso: Waiting for link to come-up on ${EXT_DEV}..."
+ ip link show ${EXT_DEV} | grep "LOWER_UP" > /dev/null 2>&1
+ done
+
+ warn "net_config_get_iso: Link on ${EXT_DEV} came-up. Proceeding."
+
+ if [ ${NAMESERVER} ]; then
+ echo "nameserver ${NAMESERVER}" > /etc/resolv.conf
+ fi
+
+ # Check if DGW is pinging. If not exit. User may want to cross-check his network_config file and network and fix it.
+ warn "net_config_get_iso: Checking if DGW ${DGW} is pinging."
+ ping_wait_count=0
+ gw_ping_status=1
+ while [ ${gw_ping_status} != 0 ]
+ do
+ ((ping_wait_count++))
+ if [[ ${ping_wait_count} == 120 ]]; then
+ warn "net_config_get_iso: Provided default gateway ${DGW} is not pinging. Exiting installation."
+ exit 1
+ fi
+ if [[ ${DGW} = *:* ]]; then
+ ping -6 -c 1 -w 1 ${DGW} > /dev/null 2>&1
+ else
+ ping -c 1 -w 1 ${DGW} > /dev/null 2>&1
+ fi
+ gw_ping_status=$?
+ done
+
+ warn "Downloading Full ISO from URL: ${ISO_URL}"
+ if ! wget --connect-timeout 5 --read-timeout 100 --no-check-certificate ${ISO_URL} --progress=dot:giga -O $BOOTCD_LOCATION; then
+ warn "net_config_get_iso: Failed to download ISO from URL: ${ISO_URL}. Exiting installation."
+ exit 1
+ fi
+fi
--- /dev/null
+#!/bin/sh
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+CONSOLE_DEV="/dev/tty0"
+DEVICE_MOUNT="/tmp/cdrom"
+BOOTDEVICE=""
+CDROMDEV="/dev/sr0"
+mkdir -p $DEVICE_MOUNT
+
+source /usr/lib/installmedia-lib.sh
+
+while [ -z $BOOTDEVICE ]; do
+ find_iso $DEVICE_MOUNT true
+ if [ $? -ne 0 ]; then
+ #For boot_cd
+ if ( get_config_from_device_end $CDROMDEV ); then
+ logmsg "Found config from $CDROMDEV assuming boot_cd install"
+ break
+ fi
+ warn "Could not find install media... Retrying..."
+ echo "Could not find install media... Retrying..." > $CONSOLE_DEV
+ sleep 2
+ else
+ get_config_from_device_end $BOOTDEVICE
+ break
+ fi
+done
+
+warn "copy_cd_config: Found ISO device. Proceeding."
+
--- /dev/null
+#!/bin/sh
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+warn "load_cdrom_modules.sh: Loading CDROM Drivers"
+
+modprobe sr_mod
--- /dev/null
+#!/bin/bash
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ # do not add this module by default
+ return 255
+}
+
+installkernel()
+{
+ instmods = sr_mod
+}
+
+install() {
+ dracut_install blockdev gunzip tar dd
+ inst_hook pre-udev 49 "$moddir/load_cdrom_modules.sh"
+ inst_hook pre-pivot 50 "$moddir/copy_cd_config.sh"
+}
+
--- /dev/null
+#!/bin/sh
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+USER_CONFIG_NAME="user_config.yaml"
+CLOUD_CONFIGS="/tmp/cloud_configs"
+
+source /usr/lib/installmedia-lib.sh
+
+FLOPPYMOUNT="/tmp/floppy"
+
+warn "copy_floppy_config: Checking if there are any floppy devices and cloud user yaml files in it."
+if [ -d ${CLOUD_CONFIGS} ];then
+ warn "copy_floppy_config: Seems Configs are fetched from CD. Returning from this module"
+ return
+fi
+
+mkdir -p $FLOPPYMOUNT
+
+# Define function to copy files to /tmp/cloud_configs
+function copyfilesfromfloppy() {
+ mount -o ro ${floppydev} $FLOPPYMOUNT
+ if [ ! -e "$FLOPPYMOUNT/$USER_CONFIG_NAME" ];then
+ warn "This filesystem does not contain user config... bailing out"
+ umount $FLOPPYMOUNT
+ return 1
+ fi
+ warn "copy files in ${floppydev} to ${CLOUD_CONFIGS}..."
+ mkdir -p ${CLOUD_CONFIGS}
+ cp -rf $FLOPPYMOUNT/* ${CLOUD_CONFIGS}
+ umount $FLOPPYMOUNT
+ return 0
+}
+
+read_devices
+for device in "${hd_devices[@]}"; do
+ if ( is_removable $device ); then
+ #This device is a removable device. Check if it contains user_config
+ floppydev="/dev/${device}"
+ if ( copyfilesfromfloppy ); then
+ warn "copy_floppy_config: Device found on ${floppydev}"
+ break
+ else
+ floppydev=""
+ fi
+ fi
+done
+
+if [ -z ${floppydev} ]; then
+ warn "copy_floppy_config: No floppy device found"
+else
+ warn "copy_floppy_config: Cloud configurations copied to ${CLOUD_CONFIGS}"
+fi
--- /dev/null
+#!/bin/bash
+
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ # do not add this module by default
+ return 255
+}
+
+install() {
+ inst_hook pre-pivot 51 "$moddir/copy_floppy_config.sh"
+}
+
--- /dev/null
+# Copyright 2019 Nokia
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+Name: image-provision
+Version: %{_version}
+Release: 1%{?dist}
+Summary: Contains dracut modules used for provisioning master image from a boot CD.
+License: %{_platform_licence}
+Source0: %{name}-%{version}.tar.gz
+Vendor: %{_platform_vendor}
+BuildArch: noarch
+
+BuildRequires: rsync
+Requires: cloud-init, dracut, coreutils, parted, gzip, iproute, util-linux, findutils, kmod, kbd, iscsi-initiator-utils, qemu-img-ev, gdisk, tar, wget, curl, glibc, hw-detector
+
+%description
+This RPM contains dracut modules. They are used for provisioning master image from a boot CD.
+
+%prep
+%autosetup
+
+%build
+
+%install
+mkdir -p %{buildroot}/usr/lib/dracut/modules.d/
+mkdir -p %{buildroot}/etc/
+
+rsync -av dracut/modules/00installmedia %{buildroot}/usr/lib/dracut/modules.d/
+rsync -av dracut/modules/00readfloppyconf %{buildroot}/usr/lib/dracut/modules.d/
+rsync -av dracut/modules/00readcdconf %{buildroot}/usr/lib/dracut/modules.d/
+rsync -av dracut/modules/00netconfig %{buildroot}/usr/lib/dracut/modules.d/
+rsync -av dracut/conf/dracut-provision.conf %{buildroot}/etc/
+
+%files
+%defattr(0755,root,root)
+/etc/dracut-provision.conf
+/usr/lib/dracut/modules.d/00installmedia
+/usr/lib/dracut/modules.d/00readfloppyconf
+/usr/lib/dracut/modules.d/00readcdconf
+/usr/lib/dracut/modules.d/00netconfig
+
+%pre
+
+%post
+# Get the lateset kernel version, and prepare provisioning initrd based on it.
+KVER=`ls --sort=v /boot/vmlinuz-* |grep -v rescue| tail -n1 |awk -F '/boot/vmlinuz-' '{print $2}'`
+/usr/bin/dracut --nostrip --local --keep -f /boot/initrd-provisioning.img -M --nofscks --nomdadmconf --tmpdir /tmp --libdirs "/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64" --conf /etc/dracut-provision.conf --kver $KVER --confdir /usr/lib/dracut/dracut.conf.d/
+
+#Disable network service. This is delaying boot due to dhcp retries. Normally ifcfg is good enough for single tries.
+/bin/systemctl --no-reload disable network.service >/dev/null 2>&1 || :
+
+# Diabling cloud-init services as we don't need any metadata quiery as done by cloud-init.
+# We use cloud-init libraries to do growpart and resizefs. So we need clould-init packages still.
+#/bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
+#/bin/systemctl --no-reload disable cloud-final.service >/dev/null 2>&1 || :
+#/bin/systemctl --no-reload disable cloud-init.service >/dev/null 2>&1 || :
+#/bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
+
+# This is a temporary fix, for udev net rename rules. The guest image choosen as base image, removes the below file.
+# When we build our own guest image, we can remove this fix from here.
+if [ -h /etc/udev/rules.d/80-net-name-slot.rules ];then
+ unlink /etc/udev/rules.d/80-net-name-slot.rules
+fi
+
+grep -q "net.ifnames=0" /etc/default/grub
+if [[ $? == 0 ]];then
+ sed -i 's/net.ifnames=0 //' /etc/default/grub
+ grub2-mkconfig > /etc/grub2.cfg
+fi
+
+
+echo "%{_name} has been succesfully installed"
+
+%preun
+
+%postun
+
+%clean
+rm -rf %{buildroot}
+
+# TIPS:
+# File /usr/lib/rpm/macros contains useful variables which can be used for example to define target directory for man page.
--- /dev/null
+addFilter("E: hardcoded-library-path")