From 073c5b8cd81453d0b7b7c56eb2ac26c34554a477 Mon Sep 17 00:00:00 2001 From: Sebastian Kiesel Date: Sun, 6 Aug 2023 12:59:56 +0200 Subject: [PATCH] muxsa-kvm2png: adjust for Debian Bookworm --- bin/muxsa-kvm2png | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/bin/muxsa-kvm2png b/bin/muxsa-kvm2png index 9916046..b2186a4 100755 --- a/bin/muxsa-kvm2png +++ b/bin/muxsa-kvm2png @@ -62,7 +62,7 @@ echo ############################################################################ -TMP_FILE="$(mktemp -t muxsa-kvm2png-XXXXXXXXXX.ppm)" +TMP_FILE="$(mktemp -t muxsa-kvm2png-XXXXXXXXXX.png)" if [ ! -w "${TMP_FILE}" ] ; then echo "Error: cannot create tmp_file. abort." exit 1 @@ -193,12 +193,26 @@ while true ; do echo "Outfile ${OUTFILE} exists and overwriting not allowed. abort." exit 1 fi - echo "Converting and saving screenshot to ${OUTFILE}" - pnmtopng -force "${TMP_FILE}" > "$OUTFILE" - if [ $? -ne 0 ] ; then - echo "Converting and saving screenshot failed. abort." - exit 1 - fi + + TMPFORMAT="$(identify -format "%m" "${TMP_FILE}")" + case "${TMPFORMAT}" in + PNG) + echo -n "copy " + cp -v "${TMP_FILE}" "${OUTFILE}" + ;; + PPM) + echo "pnmtopng -force \"${TMP_FILE}\" > \"${OUTFILE}\"" + pnmtopng -force "${TMP_FILE}" > "${OUTFILE}" + if [ $? -ne 0 ] ; then + echo "Converting and saving screenshot failed. abort." + exit 1 + fi + ;; + *) + echo "File ${TMP_FILE} has unknown format ${TMPFORMAT}. abort." + exit 1 + ;; + esac if [ "${MUXSA_KVM2PNG_MD5_LAST_SLIDE}" ] ; then if md5sum "${OUTFILE}" | \