From 4b77522b03959ab88412686f4ac53e8254f05e09 Mon Sep 17 00:00:00 2001 From: Garret Raziel Date: Fri, 10 Jul 2015 15:34:32 +0200 Subject: [PATCH] use qemu and expect to do selinux relabelling on created disk image Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D428 --- createhdds.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/createhdds.sh b/createhdds.sh index b17f36b..1b8b4ee 100755 --- a/createhdds.sh +++ b/createhdds.sh @@ -28,13 +28,24 @@ write /testfile "Hello, world!" _EOF_ echo "Creating disk_f21_minimal.img..." -# TODO: it should be possible to create updated image, but there is a bug, see https://bugzilla.redhat.com/show_bug.cgi?id=1084221 -# so you are required to manually boot this image and run 'yum -y update' -#virt-builder fedora-21 -o disk_f21_minimal.img --update --selinux-relabel --root-password password:weakpassword -virt-builder fedora-21 -o disk_f21_minimal.img --root-password password:weakpassword +virt-builder fedora-21 -o disk_f21_minimal.img --update --selinux-relabel --root-password password:weakpassword > /dev/null +expect <<_EOF_ +log_user 0 +set timeout -1 + +spawn qemu-kvm -m 2G -nographic disk_f21_minimal.img + +expect "localhost login:" +send "root\r" +expect "Password:" +send "weakpassword\r" +expect "~]#" +send "poweroff\r" +expect "reboot: Power down" +_EOF_ echo "Creating disk_ks.img..." -curl -o "/tmp/root-user-crypted-net.ks" "https://jskladan.fedorapeople.org/kickstarts/root-user-crypted-net.ks" +curl --silent -o "/tmp/root-user-crypted-net.ks" "https://jskladan.fedorapeople.org/kickstarts/root-user-crypted-net.ks" > /dev/null guestfish <<_EOF_ sparse disk_ks.img 100MB run