#!/bin/bash

virtio=`cat /proc/cmdline | sed 's/.*virtio=\([^ ]*\).*/\1/'`
if [ $virtio == "true" ];then
	source ./functions
	mkdir -p $TARGET/redpatch_kernel
	cp /Rocky/redpatch_kernel/*.tar.gz  $TARGET/redpatch_kernel
	cp /usr/lib/new_install/operation/finish_install/exec_install_redpatch_kernel.sh $TARGET/opt/
	chmod +x $TARGET/opt/exec_install_redpatch_kernel.sh
	chroot $TARGET  /opt/exec_install_redpatch_kernel.sh  >> $LOG_FILE 2>&1 && rm -rf $TARGET/opt/exec_install_redpatch_kernel.sh $TARGET/redpatch_kernel

	mount -obind /dev $TARGET/dev
   	mount -obind /proc $TARGET/proc
   	mount -obind /sys $TARGET/sys
   	chroot $TARGET update-grub > /dev/null 2>&1
	for mp in /dev /proc /sys
	do
		umount $mp
	done

fi
