git://git.jankratochvil.net
/
nethome.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rpmsafe: realpath fixes
[nethome.git]
/
bin
/
qemu-img-recompress
diff --git
a/bin/qemu-img-recompress
b/bin/qemu-img-recompress
index
0feb535
..
5aa4126
100755
(executable)
--- a/
bin/qemu-img-recompress
+++ b/
bin/qemu-img-recompress
@@
-1,5
+1,10
@@
#! /bin/sh
renice 20 -p $$
#! /bin/sh
renice 20 -p $$
+guestfish=true
+if [ "$1" = "-n" ];then
+ guestfish=false
+ shift
+fi
for file in "$@";do
if [ "$file" = "${file%.qcow2}" ];then
echo >&2 "Invalid: <$file>"
for file in "$@";do
if [ "$file" = "${file%.qcow2}" ];then
echo >&2 "Invalid: <$file>"
@@
-12,6
+17,10
@@
for file in "$@";do
set -xe
mv -i "$file" "$file"-src
rm -f "$file"-dest
set -xe
mv -i "$file" "$file"-src
rm -f "$file"-dest
+ if $guestfish;then
+ test "$(guestfish -n -a "$file"-src run : list-devices : list-partitions|tr '\n' ' ')" = "/dev/vda /dev/vda1 "
+ guestfish -n -a "$file"-src run : zerofree /dev/vda1
+ fi
time qemu-img convert -c -f qcow2 "$file"-src -O qcow2 "$file"-dest
mv -i "$file"-dest "$file"
rm -f "$file"-src
time qemu-img convert -c -f qcow2 "$file"-src -O qcow2 "$file"-dest
mv -i "$file"-dest "$file"
rm -f "$file"-src