mirror of
https://github.com/rocky-linux/createhdds.git
synced 2024-12-22 01:58:30 +00:00
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:
parent
acac8a2f5e
commit
4b77522b03
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user