ef31a4c57d
Story: 2003389 Task: 26436 new systemd depends on lz4. And systemd is included in squashfs, so need to add lz4 to squashfs also. Removed rpms and rt kernel from the image, since they are not used. Change-Id: Ic0d8be91b747369bb9a068f41e7c4785d29f8881 Signed-off-by: slin14 <shuicheng.lin@intel.com>
276 lines
8.9 KiB
Bash
Executable File
276 lines
8.9 KiB
Bash
Executable File
#!/bin/bash -e
|
|
## this script is to update pxeboot images (vmlinuz, initrd.img and squashfs.img).
|
|
## based on RPMs generated by "build-pkgs" and "build-iso"
|
|
## created by Yong Hu (yong.hu@intel.com), 05/24/2018
|
|
|
|
|
|
echo "Start to update pxe-network-installer images .... "
|
|
timestamp=$(date +%F_%H%M)
|
|
cur_dir=$PWD
|
|
|
|
pxe_network_installer_dir=$MY_BUILD_DIR/pxe-network-installer
|
|
if [ ! -d $pxe_network_installer_dir ];then
|
|
mkdir -p $pxe_network_installer_dir
|
|
fi
|
|
|
|
cd $pxe_network_installer_dir
|
|
|
|
echo "step 1: copy original images: vmlinuz, initrd.img, squashfs.img"
|
|
CENTOS_REPO="cgcs-centos-repo"
|
|
orig_img_dir="orig"
|
|
if [ ! -d $orig_img_dir ];then
|
|
mkdir -p $orig_img_dir
|
|
fi
|
|
|
|
orig_initrd_img="$MY_REPO/$CENTOS_REPO/Binary/images/pxeboot/initrd.img"
|
|
if [ -f $orig_initrd_img ]; then
|
|
cp -f $orig_initrd_img $pxe_network_installer_dir/$orig_img_dir/.
|
|
else
|
|
echo "$orig_initrd_img does not exit"
|
|
exit -1
|
|
fi
|
|
|
|
orig_squashfs_img="$MY_REPO/$CENTOS_REPO/Binary/LiveOS/squashfs.img"
|
|
if [ -f $orig_squashfs_img ]; then
|
|
cp -f $orig_squashfs_img $pxe_network_installer_dir/$orig_img_dir/.
|
|
else
|
|
echo "$orig_squashfs_img does not exit"
|
|
exit -1
|
|
fi
|
|
|
|
echo ""
|
|
echo "step 2: prepare necessary kernel RPMs"
|
|
echo ""
|
|
kernel_rpms_std="$pxe_network_installer_dir/kernel-rpms/std"
|
|
kernel_rpms_rt="$pxe_network_installer_dir/kernel-rpms/rt"
|
|
|
|
echo "--> get $kernel_rpms_std ready"
|
|
echo "--> get $kernel_rpms_rt ready"
|
|
|
|
if [ -d $kernel_rpms_std ];then
|
|
mv $kernel_rpms_std $kernel_rpms_std-bak-$timestamp
|
|
fi
|
|
mkdir -p $kernel_rpms_std
|
|
|
|
if [ -d $kernel_rpms_rt ];then
|
|
mv $kernel_rpms_rt $kernel_rpms_rt-bak-$timestamp
|
|
fi
|
|
mkdir -p $kernel_rpms_rt
|
|
|
|
echo " -------- start to search standard kernel rpm and related kernel modules --------"
|
|
echo " --> find standard kernel rpm"
|
|
std_kernel=$(find $MY_BUILD_DIR/export/dist/isolinux/Packages/ -type f -name "kernel-[0-9]*.x86_64.rpm")
|
|
if [ -n $std_kernel ] && [ -f $std_kernel ];then
|
|
cp -f $std_kernel $kernel_rpms_std/.
|
|
else
|
|
echo "ERROR: failed to find kernel RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find e1000e kernel module"
|
|
e1000e_module=$(find $MY_BUILD_DIR/std/rpmbuild/RPMS -type f -name "kmod-e1000e-[0-9]*.x86_64.rpm")
|
|
if [ -n $e1000e_module ] && [ -f $e1000e_module ];then
|
|
cp -f $e1000e_module $kernel_rpms_std/.
|
|
else
|
|
echo "ERROR: failed to find e1000e kernel module RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find i40e kernel module"
|
|
i40e_module=$(find $MY_BUILD_DIR/std/rpmbuild/RPMS -type f -name "kmod-i40e-[0-9]*.x86_64.rpm")
|
|
if [ -n $i40e_module ] && [ -f $i40e_module ];then
|
|
cp -f $i40e_module $kernel_rpms_std/.
|
|
else
|
|
echo "ERROR: failed to find i40e kernel module RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find ixgbe kernel module"
|
|
ixgbe_module=$(find $MY_BUILD_DIR/std/rpmbuild/RPMS -type f -name "kmod-ixgbe-[0-9]*.x86_64.rpm")
|
|
if [ -n $ixgbe_module ] && [ -f $ixgbe_module ];then
|
|
cp -f $ixgbe_module $kernel_rpms_std/.
|
|
else
|
|
echo "ERROR: failed to find ixgbe kernel module RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find tpm kernel module"
|
|
tpm_module=$(find $MY_BUILD_DIR/std/rpmbuild/RPMS -type f -name "kmod-tpm-[0-9]*.x86_64.rpm")
|
|
if [ -n $tpm_module ] && [ -f $tpm_module ];then
|
|
cp -f $tpm_module $kernel_rpms_std/.
|
|
else
|
|
echo "ERROR: failed to find tpm kernel module RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find mlnx-ofa_kernel_modules"
|
|
mlnx_ofa_kernel_modules=$(find $MY_BUILD_DIR/std/rpmbuild/RPMS -type f -name "mlnx-ofa_kernel-modules-[0-9]*.x86_64.rpm")
|
|
if [ -n $mlnx_ofa_kernel_modules ] && [ -f $mlnx_ofa_kernel_modules ];then
|
|
cp -f $mlnx_ofa_kernel_modules $kernel_rpms_std/.
|
|
else
|
|
echo "ERROR: failed to find mlnx-ofa_kernel-modules RPM!"
|
|
exit -1
|
|
fi
|
|
echo " -------- successfully found standard kernel rpm and related kernel modules --------"
|
|
echo ""
|
|
|
|
rootfs_rpms="$pxe_network_installer_dir/rootfs-rpms"
|
|
if [ -d $rootfs_rpms ];then
|
|
mv $rootfs_rpms $rootfs_rpms-bak-$timestamp
|
|
fi
|
|
mkdir -p $rootfs_rpms
|
|
|
|
echo " step 3: start to search rpms for rootfs"
|
|
echo "--> find anaconda rpm"
|
|
anaconda=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "anaconda-[0-9]*.x86_64.rpm")
|
|
if [ -n $anaconda ] && [ -f $anaconda ];then
|
|
cp -f $anaconda $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find anaconda RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find anaconda-core rpm"
|
|
anaconda_core=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "anaconda-core-[0-9]*.x86_64.rpm")
|
|
if [ -n $anaconda_core ] && [ -f $anaconda_core ];then
|
|
cp -f $anaconda_core $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find anaconda-core RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find anaconda-tui rpm"
|
|
anaconda_tui=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "anaconda-tui-[0-9]*.x86_64.rpm")
|
|
if [ -n $anaconda_tui ] && [ -f $anaconda_tui ];then
|
|
cp -f $anaconda_tui $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find anaconda-tui RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find anaconda-widgets rpm"
|
|
anaconda_widgets=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "anaconda-widgets-[0-9]*.x86_64.rpm")
|
|
if [ -n $anaconda_widgets ] && [ -f $anaconda_widgets ];then
|
|
cp -f $anaconda_widgets $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find anaconda-widgets RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find rpm-xx.x86_64 rpm"
|
|
rpm_rpm=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "rpm-[0-9]*.x86_64.rpm")
|
|
if [ -n $rpm_rpm ] && [ -f $rpm_rpm ];then
|
|
cp -f $rpm_rpm $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find rpm-xx.x86_64 RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find rpm-build rpm"
|
|
rpm_build=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "rpm-build-[0-9]*.x86_64.rpm")
|
|
if [ -n $rpm_build ] && [ -f $rpm_build ];then
|
|
cp -f $rpm_build $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find rpm-build RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find rpm-build-libs rpm"
|
|
rpm_build_libs=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "rpm-build-libs-[0-9]*.x86_64.rpm")
|
|
if [ -n $rpm_build_libs ] && [ -f $rpm_build_libs ];then
|
|
cp -f $rpm_build_libs $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find rpm-build-libs RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find rpm-libs rpm"
|
|
rpm_libs=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "rpm-libs-[0-9]*.x86_64.rpm")
|
|
if [ -n $rpm_libs ] && [ -f $rpm_libs ];then
|
|
cp -f $rpm_libs $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find rpm-libs RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find rpm-plugin-systemd-inhibit rpm"
|
|
rpm_plugin_systemd_inhibit=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "rpm-plugin-systemd-inhibit-[0-9]*.x86_64.rpm")
|
|
if [ -n $rpm_plugin_systemd_inhibit ] && [ -f $rpm_plugin_systemd_inhibit ];then
|
|
cp -f $rpm_plugin_systemd_inhibit $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find rpm-plugin-systemd-inhibit RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find rpm-python rpm"
|
|
rpm_python=$(find $MY_BUILD_DIR/installer/rpmbuild/RPMS -type f -name "rpm-python-[0-9]*.x86_64.rpm")
|
|
if [ -n $rpm_python ] && [ -f $rpm_python ];then
|
|
cp -f $rpm_python $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find rpm-python RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find systemd rpm"
|
|
systemd=$(find $MY_BUILD_DIR/export/dist/isolinux/Packages -type f -name "systemd-[0-9]*.x86_64.rpm")
|
|
if [ -n $systemd ] && [ -f $systemd ];then
|
|
cp -f $systemd $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find systemd RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find systemd-libs rpm"
|
|
systemd_libs=$(find $MY_BUILD_DIR/export/dist/isolinux/Packages -type f -name "systemd-libs-[0-9]*.x86_64.rpm")
|
|
if [ -n $systemd_libs ] && [ -f $systemd_libs ];then
|
|
cp -f $systemd_libs $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find systemd-libs RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find systemd-sysv rpm"
|
|
systemd_sysv=$(find $MY_BUILD_DIR/export/dist/isolinux/Packages -type f -name "systemd-sysv-[0-9]*.x86_64.rpm")
|
|
if [ -n $systemd_sysv ] && [ -f $systemd_sysv ];then
|
|
cp -f $systemd_sysv $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find systemd-sysv RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find lz4 rpm"
|
|
lz4_rpm=$(find $MY_BUILD_DIR/export/dist/isolinux/Packages -type f -name "lz4-[0-9]*.x86_64.rpm")
|
|
if [ -n $lz4_rpm ] && [ -f $lz4_rpm ];then
|
|
cp -f $lz4_rpm $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find lz4_rpm RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find bind-utils rpm"
|
|
bind_utils=$(find $MY_BUILD_DIR/export/dist/isolinux/Packages -type f -name "bind-utils-[0-9]*.x86_64.rpm")
|
|
if [ -n $bind_utils ] && [ -f $bind_utils ];then
|
|
cp -f $bind_utils $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find bind-utils RPM!"
|
|
exit -1
|
|
fi
|
|
|
|
echo "--> find ima-evm-utils rpm"
|
|
ima_evm_utils=$(find $MY_BUILD_DIR/export/dist/isolinux/Packages -type f -name "ima-evm-utils-[0-9]*.x86_64.rpm")
|
|
if [ -n $ima_evm_utils ] && [ -f $ima_evm_utils ];then
|
|
cp -f $ima_evm_utils $rootfs_rpms/.
|
|
else
|
|
echo "ERROR: failed to find ima-evm-utils RPM!"
|
|
exit -1
|
|
fi
|
|
echo " ---------------- successfully found rpms for rootfs --------------------------------"
|
|
|
|
echo "step 4: make installer images in this work dir"
|
|
same_folder="$(dirname ${BASH_SOURCE[0]})"
|
|
mk_images_tool="$same_folder/make-installer-images.sh"
|
|
sudo $mk_images_tool $pxe_network_installer_dir
|
|
|
|
cd $cur_dir
|
|
echo "updating pxe-network-installer images -- done!"
|