packages/easyscan: sanity checks

This commit is contained in:
Primrose 2025-07-14 20:02:26 +02:00
parent d1f27a4724
commit 2e8db32bfb
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -2,6 +2,11 @@
OUTPUT_FILE="${1:-./scan_"$(date)".pdf}"
if [ -e "$OUTPUT_FILE" ]; then
echo "$OUTPUT_FILE" already exists, you are probably making a mistake!
exit 1
fi
tempdir="$(mktemp -d)"
counter=1
@ -36,6 +41,7 @@ merged_filename="$tempdir/easyscan_final.pdf"
pdfunite "$tempdir"/*.pdf "$merged_filename"
# Copy scan to current directory
mkdir -p "$(dirname "$OUTPUT_FILE")"
cp "$merged_filename" "$OUTPUT_FILE"
# Make sure I don't remove things other than pdf