Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickemu: Support $disk_format var for $disk_img #940

Closed
wants to merge 3 commits into from

Conversation

gmt4
Copy link
Contributor

@gmt4 gmt4 commented Feb 21, 2024

This adds disk_format=${disk_format:-qcow2} variable that defaults to qcow2 format, so the vm.conf files can use $disk_format to specify the format of the $disk_img when this is different from the default qcow2.

This adds disk_format=${disk_format:-qcow2} variable that defaults to
qcow2 format, so the vm.conf files can use $disk_format to specify the
format of the $disk_img when this is different from the default qcow2.
@lj3954
Copy link
Member

lj3954 commented Feb 21, 2024

Could you not use the file extension in the disk_img variable to determine the correct format?

If not specified, detect the $disk_format of $disk_img, and set
disk_format to the format detected by qemu-img info $disk_img
@gmt4
Copy link
Contributor Author

gmt4 commented Feb 28, 2024

Could you not use the file extension in the disk_img variable to determine the correct format?

yep, thanks for the suggestion. Instead of guessing, I just went with asking qemu-img info to do the guessing for me.

@TuxVinyards
Copy link
Contributor

TuxVinyards commented Feb 28, 2024

| gawk '/^file format: / {print $NF}'

| grep 'file format' | cut -d ':' -f 2 | tr -d ' '

Not everyone has gawk installed. I would suggest this to be more portable. It's also easier to understand ...

Edit:

Or, probably cleaner, | grep 'file format' | cut -d ':' -f 2 | tr -cd '[:graph:]' as this also removes the trailing linefeed

@gmt4
Copy link
Contributor Author

gmt4 commented Feb 28, 2024

@TuxVinyards Done!, thanks for spotting it, i just went with gawk as I saw another use of gawk in https://github.com/quickemu-project/quickemu/blob/master/quickemu#L1411

@TuxVinyards
Copy link
Contributor

@TuxVinyards Done!, thanks for spotting it, i just went with gawk as I saw another use of gawk in https://github.com/quickemu-project/quickemu/blob/master/quickemu#L1411

Two wrongs don't make a right. Line 1411 has bad use of 'cat' as well. 😵‍💫

@TuxVinyards
Copy link
Contributor

Probably needs a PR for 1411 etc too. Should be 'grep $file | grep ...' 🤣

@flexiondotorg
Copy link
Member

Closed via #986

zen0bit added a commit to oSoWoSo/quickemu that referenced this pull request Apr 11, 2024
zen0bit added a commit to oSoWoSo/quickemu that referenced this pull request Apr 11, 2024
zen0bit added a commit to oSoWoSo/quickemu that referenced this pull request Apr 11, 2024
zen0bit added a commit to oSoWoSo/quickemu that referenced this pull request Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants