use qemu and expect to do selinux relabelling on created disk image

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D428
This commit is contained in:
Garret Raziel 2015-07-10 15:34:32 +02:00
parent acac8a2f5e
commit 4b77522b03

View File

@ -28,13 +28,24 @@ write /testfile "Hello, world!"
_EOF_ _EOF_
echo "Creating disk_f21_minimal.img..." 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 virt-builder fedora-21 -o disk_f21_minimal.img --update --selinux-relabel --root-password password:weakpassword > /dev/null
# so you are required to manually boot this image and run 'yum -y update' expect <<_EOF_
#virt-builder fedora-21 -o disk_f21_minimal.img --update --selinux-relabel --root-password password:weakpassword log_user 0
virt-builder fedora-21 -o disk_f21_minimal.img --root-password password:weakpassword 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..." 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_ guestfish <<_EOF_
sparse disk_ks.img 100MB sparse disk_ks.img 100MB
run run