aboutsummaryrefslogtreecommitdiffstats
path: root/push-images.sh
diff options
context:
space:
mode:
Diffstat (limited to 'push-images.sh')
-rwxr-xr-xpush-images.sh44
1 files changed, 26 insertions, 18 deletions
diff --git a/push-images.sh b/push-images.sh
index cb9369c..a344af2 100755
--- a/push-images.sh
+++ b/push-images.sh
@@ -2,24 +2,32 @@
dest="$HOME/repo/images-testing"
-if test -d "$dest"; then
- echo
- echo "# rsync uncompressed images"
- rsync --verbose --progress \
- ${IMAGEFISH_DESTDIR-.}/*.raw \
- ${IMAGEFISH_DESTDIR-.}/*.qcow2 \
- $dest
+if test ! -d "$dest"; then
+ echo "# not found: $dest"
+ exit
+fi
- echo
- echo "# compress images"
- rm -f ${IMAGEFISH_DESTDIR-.}/*.xz
- xz --verbose --keep \
- ${IMAGEFISH_DESTDIR-.}/*.raw \
- ${IMAGEFISH_DESTDIR-.}/*.qcow2
+images=$(ls ${IMAGEFISH_DESTDIR-.}/*.raw \
+ ${IMAGEFISH_DESTDIR-.}/*.qcow2 \
+ 2>/dev/null)
+count=$(echo $images | wc -w)
- echo
- echo "# rsync compressed images"
- rsync --verbose --progress \
- ${IMAGEFISH_DESTDIR-.}/*.xz \
- $dest
+if test "$count" = "0"; then
+ echo "# no images"
+ exit
fi
+
+echo
+echo "# rsync $count uncompressed images"
+rsync --verbose --progress $images $dest
+
+echo
+echo "# compress $count images"
+rm -f ${IMAGEFISH_DESTDIR-.}/*.xz
+xz --verbose --keep $images
+
+echo
+echo "# rsync compressed images"
+rsync --verbose --progress \
+ ${IMAGEFISH_DESTDIR-.}/*.xz \
+ $dest