add guided shrink test - config and disk creation

Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D560
This commit is contained in:
Jan Sedlák 2015-09-08 15:53:12 +02:00
parent 86999701d3
commit 08a84b73cc

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
function disk_full { function disk_full {
echo "Creating disk_full.img..." diskname="disk_full"
echo "Creating $diskname.img..."
guestfish <<_EOF_ guestfish <<_EOF_
sparse disk_full.img 10G sparse $diskname.img 10G
run run
part-init /dev/sda mbr part-init /dev/sda mbr
part-add /dev/sda p 1 10485760 part-add /dev/sda p 1 10485760
@ -20,9 +21,10 @@ _EOF_
} }
function disk_freespace { function disk_freespace {
echo "Creating disk_freespace.img..." diskname="disk_freespace"
echo "Creating $diskname.img..."
guestfish <<_EOF_ guestfish <<_EOF_
sparse disk_freespace.img 10G sparse $diskname.img 10G
run run
part-init /dev/sda mbr part-init /dev/sda mbr
part-add /dev/sda p 4096 2097152 part-add /dev/sda p 4096 2097152
@ -86,10 +88,11 @@ _EOF_
} }
function disk_ks { function disk_ks {
echo "Creating disk_ks.img..." diskname="disk_ks"
echo "Creating $diskname.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_
sparse disk_ks.img 100MB sparse $diskname.img 100MB
run run
part-init /dev/sda mbr part-init /dev/sda mbr
part-add /dev/sda p 4096 -1 part-add /dev/sda p 4096 -1
@ -100,10 +103,11 @@ _EOF_
} }
function disk_updates_img { function disk_updates_img {
echo "Creating disk_updates_img.img..." diskname="disk_updates_img"
echo "Creating $diskname.img..."
curl --silent -o "/tmp/updates.img" "https://fedorapeople.org/groups/qa/updates/updates-unipony.img" > /dev/null curl --silent -o "/tmp/updates.img" "https://fedorapeople.org/groups/qa/updates/updates-unipony.img" > /dev/null
guestfish <<_EOF_ guestfish <<_EOF_
sparse disk_updates_img.img 100MB sparse $diskname.img 100MB
run run
part-init /dev/sda mbr part-init /dev/sda mbr
part-add /dev/sda p 4096 -1 part-add /dev/sda p 4096 -1
@ -113,6 +117,21 @@ upload /tmp/updates.img /updates.img
_EOF_ _EOF_
} }
function disk_shrink {
fstype=$1
diskname="disk_shrink_$fstype"
echo "Creating $diskname.img..."
guestfish <<_EOF_
sparse $diskname.img 10G
run
part-init /dev/sda mbr
part-add /dev/sda p 4096 -1
mkfs $fstype /dev/sda1
mount /dev/sda1 /
write /testfile "Hello, world!"
_EOF_
}
if [[ "$1" != "" ]]; then if [[ "$1" != "" ]]; then
VERSION="$1" VERSION="$1"
shift shift
@ -125,6 +144,8 @@ if [[ "$1" != "" ]]; then
disk_desktop ${VERSION} "i686" disk_desktop ${VERSION} "i686"
disk_ks disk_ks
disk_updates_img disk_updates_img
disk_shrink "ext4"
disk_shrink "ntfs"
else else
case $1 in case $1 in
full) full)
@ -151,13 +172,19 @@ if [[ "$1" != "" ]]; then
updates) updates)
disk_updates_img disk_updates_img
;; ;;
shrink_ext4)
disk_shrink "ext4"
;;
shrink_ntfs)
disk_shrink "ntfs"
;;
*) *)
echo "name not in [full|freespace|minimal_64bit|minimal_32bit|desktop_64bit|desktop_32bit|ks|updates]" echo "name not in [full|freespace|minimal_64bit|minimal_32bit|desktop_64bit|desktop_32bit|ks|updates|shrink_ext4|shrink_ntfs]"
exit 1 exit 1
;; ;;
esac esac
fi fi
else else
echo "USAGE: $0 VERSION [full|freespace|minimal_64bit|minimal_32bit|desktop_64bit|desktop_32bit|ks|updates]" echo "USAGE: $0 VERSION [full|freespace|minimal_64bit|minimal_32bit|desktop_64bit|desktop_32bit|ks|updates|shrink_ext4|shrink_ntfs]"
exit 1 exit 1
fi fi