mirror of
https://pagure.io/fedora-qa/createhdds.git
synced 2024-11-21 23:03:08 +00:00
split createhdds.sh into functions, bump Fedora release
This commit is contained in:
parent
269dbbe004
commit
5579572db5
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
function disk_full {
|
||||||
echo "Creating disk_full.img..."
|
echo "Creating disk_full.img..."
|
||||||
guestfish <<_EOF_
|
guestfish <<_EOF_
|
||||||
sparse disk_full.img 10G
|
sparse disk_full.img 10G
|
||||||
@ -15,7 +16,9 @@ mount /dev/sda2 /
|
|||||||
write /testfile "Oh, hi Mark"
|
write /testfile "Oh, hi Mark"
|
||||||
umount /
|
umount /
|
||||||
_EOF_
|
_EOF_
|
||||||
|
}
|
||||||
|
|
||||||
|
function disk_freespace {
|
||||||
echo "Creating disk_freespace.img..."
|
echo "Creating disk_freespace.img..."
|
||||||
guestfish <<_EOF_
|
guestfish <<_EOF_
|
||||||
sparse disk_freespace.img 10G
|
sparse disk_freespace.img 10G
|
||||||
@ -26,14 +29,16 @@ mkfs ext4 /dev/sda1
|
|||||||
mount /dev/sda1 /
|
mount /dev/sda1 /
|
||||||
write /testfile "Hello, world!"
|
write /testfile "Hello, world!"
|
||||||
_EOF_
|
_EOF_
|
||||||
|
}
|
||||||
|
|
||||||
echo "Creating disk_f21_minimal.img..."
|
function disk_f22_minimal {
|
||||||
virt-builder fedora-21 -o disk_f21_minimal.img --update --selinux-relabel --root-password password:weakpassword > /dev/null
|
echo "Creating disk_f22_minimal.img..."
|
||||||
|
virt-builder fedora-22 -o disk_f22_minimal.img --update --selinux-relabel --root-password password:weakpassword > /dev/null
|
||||||
expect <<_EOF_
|
expect <<_EOF_
|
||||||
log_user 0
|
log_user 0
|
||||||
set timeout -1
|
set timeout -1
|
||||||
|
|
||||||
spawn qemu-kvm -m 2G -nographic disk_f21_minimal.img
|
spawn qemu-kvm -m 2G -nographic disk_f22_minimal.img
|
||||||
|
|
||||||
expect "localhost login:"
|
expect "localhost login:"
|
||||||
send "root\r"
|
send "root\r"
|
||||||
@ -43,20 +48,22 @@ expect "~]#"
|
|||||||
send "poweroff\r"
|
send "poweroff\r"
|
||||||
expect "reboot: Power down"
|
expect "reboot: Power down"
|
||||||
_EOF_
|
_EOF_
|
||||||
|
}
|
||||||
|
|
||||||
echo "Creating disk_f21_desktop.img..."
|
function disk_f22_desktop {
|
||||||
|
echo "Creating disk_f22_desktop.img..."
|
||||||
# these steps are required
|
# these steps are required
|
||||||
# 1. remove firewalld - firewalld configuration in minimal and desktop are conflicting
|
# 1. remove firewalld - firewalld configuration in minimal and desktop are conflicting
|
||||||
# 2. update fedora
|
# 2. update fedora
|
||||||
# 3. install @Fedora Workstation group
|
# 3. install @Fedora Workstation group
|
||||||
# 4. add new user on first boot
|
# 4. add new user on first boot
|
||||||
# 5. use expect to do selinux relabelling and to set password for user
|
# 5. use expect to do selinux relabelling and to set password for user
|
||||||
virt-builder fedora-21 -o disk_f21_desktop.img --size 10G --run-command "yum -y remove firewalld*" --update --selinux-relabel --install "@^workstation-product-environment" --root-password password:weakpassword --firstboot-command 'useradd -m -p "" ejohn' > /dev/null
|
virt-builder fedora-22 -o disk_f22_desktop.img --size 10G --run-command "yum -y remove firewalld*" --update --selinux-relabel --install "@^workstation-product-environment" --root-password password:weakpassword --firstboot-command 'useradd -m -p "" ejohn' > /dev/null
|
||||||
expect <<_EOF_
|
expect <<_EOF_
|
||||||
log_user 0
|
log_user 0
|
||||||
set timeout -1
|
set timeout -1
|
||||||
|
|
||||||
spawn qemu-kvm -m 2G -nographic disk_f21_desktop.img
|
spawn qemu-kvm -m 2G -nographic disk_f22_desktop.img
|
||||||
|
|
||||||
expect "localhost login:"
|
expect "localhost login:"
|
||||||
send "root\r"
|
send "root\r"
|
||||||
@ -68,7 +75,9 @@ send "echo 'ejohn:weakpassword' | chpasswd\r"
|
|||||||
send "poweroff\r"
|
send "poweroff\r"
|
||||||
expect "reboot: Power down"
|
expect "reboot: Power down"
|
||||||
_EOF_
|
_EOF_
|
||||||
|
}
|
||||||
|
|
||||||
|
function disk_ks {
|
||||||
echo "Creating disk_ks.img..."
|
echo "Creating disk_ks.img..."
|
||||||
curl --silent -o "/tmp/root-user-crypted-net.ks" "https://jskladan.fedorapeople.org/kickstarts/root-user-crypted-net.ks" > /dev/null
|
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_
|
||||||
@ -80,3 +89,33 @@ mkfs ext4 /dev/sda1
|
|||||||
mount /dev/sda1 /
|
mount /dev/sda1 /
|
||||||
upload /tmp/root-user-crypted-net.ks /root-user-crypted-net.ks
|
upload /tmp/root-user-crypted-net.ks /root-user-crypted-net.ks
|
||||||
_EOF_
|
_EOF_
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$#" -eq 0 ]; then
|
||||||
|
disk_full
|
||||||
|
disk_freespace
|
||||||
|
disk_f22_minimal
|
||||||
|
disk_f22_desktop
|
||||||
|
disk_ks
|
||||||
|
else
|
||||||
|
case $1 in
|
||||||
|
full)
|
||||||
|
disk_full
|
||||||
|
;;
|
||||||
|
freespace)
|
||||||
|
disk_freespace
|
||||||
|
;;
|
||||||
|
minimal)
|
||||||
|
disk_f22_minimal
|
||||||
|
;;
|
||||||
|
desktop)
|
||||||
|
disk_f22_desktop
|
||||||
|
;;
|
||||||
|
ks)
|
||||||
|
disk_ks
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$0 [full|freespace|minimal|desktop|ks]"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user