]> gitweb.hhaalo.de Git - scantopdf.git/commitdiff
add ocr script
authorBastian Dehn <hhaalo@arcor.de>
Sat, 4 Apr 2026 07:39:27 +0000 (09:39 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 4 Apr 2026 07:39:27 +0000 (09:39 +0200)
Makefile
src/addocr [new file with mode: 0644]

index 9221bc69c20619dfd396be8ed6cfa9045ae03ac4..7462f7fba72821b794965a7e532eb3ab5bd4896b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,8 @@ test: $(BUILDDIR)/parts/scanbasic.sh \
 
 build: $(PACKAGEDIR)/$(BINDIR)/scantopdf \
        $(PACKAGEDIR)/$(BINDIR)/scantopdfgray \
-       $(PACKAGEDIR)/$(BINDIR)/scantopdfbw
+       $(PACKAGEDIR)/$(BINDIR)/scantopdfbw \
+       $(PACKAGEDIR)/$(BINDIR)/addocr
 
 package: $(BUILDDIR)/$(PACKAGENAME).deb
 
@@ -52,8 +53,8 @@ $(PACKAGEDIR)/$(BINDIR)/scantopdf: \
 
        mkdir -p $(@D)
        ./tools/includer $(SRCDIR)/scantopdf \
-                       | sed "s/@VERSION@/$(VERSION)/" \
-                       > $(PACKAGEDIR)/$(BINDIR)/scantopdf
+               | sed "s/@VERSION@/$(VERSION)/" \
+               > $(PACKAGEDIR)/$(BINDIR)/scantopdf
        chmod 755 $(PACKAGEDIR)/$(BINDIR)/scantopdf
 
 $(PACKAGEDIR)/$(BINDIR)/scantopdfgray: \
@@ -62,8 +63,8 @@ $(PACKAGEDIR)/$(BINDIR)/scantopdfgray: \
 
        mkdir -p $(@D)
        ./tools/includer $(SRCDIR)/scantopdfgray \
-                       | sed "s/@VERSION@/$(VERSION)/" \
-                       > $(PACKAGEDIR)/$(BINDIR)/scantopdfgray
+               | sed "s/@VERSION@/$(VERSION)/" \
+               > $(PACKAGEDIR)/$(BINDIR)/scantopdfgray
        chmod 755 $(PACKAGEDIR)/$(BINDIR)/scantopdfgray
 
 $(PACKAGEDIR)/$(BINDIR)/scantopdfbw: \
@@ -72,10 +73,20 @@ $(PACKAGEDIR)/$(BINDIR)/scantopdfbw: \
 
        mkdir -p $(@D)
        ./tools/includer $(SRCDIR)/scantopdfgray \
-                       | sed "s/@VERSION@/$(VERSION)/" \
-                       > $(PACKAGEDIR)/$(BINDIR)/scantopdfbw
+               | sed "s/@VERSION@/$(VERSION)/" \
+               > $(PACKAGEDIR)/$(BINDIR)/scantopdfbw
        chmod 755 $(PACKAGEDIR)/$(BINDIR)/scantopdfbw
 
+$(PACKAGEDIR)/$(BINDIR)/addocr: \
+       $(SRCDIR)/errlog.sh \
+       $(SRCDIR)/addocr.sh
+
+       mkdir -p $(@D)
+       ./tools/includer $(SRCDIR)/addocr \
+               | sed "s/@VERSION@/$(VERSION)/" \
+               > $(PACKAGEDIR)/$(BINDIR)/addocr
+       chmod 755 $(PACKAGEDIR)/$(BINDIR)/addocr
+
 ################################################################################
 
 $(PACKAGEDIR)/$(SHAREDIR)/scantopdf/cutpage.html: \
@@ -98,6 +109,7 @@ $(BUILDDIR)/$(PACKAGENAME).deb: \
        $(PACKAGEDIR)/$(BINDIR)/scantopdf \
        $(PACKAGEDIR)/$(BINDIR)/scantopdfgray \
        $(PACKAGEDIR)/$(BINDIR)/scantopdfbw \
+       $(PACKAGEDIR)/$(BINDIR)/addocr \
        $(PACKAGEDIR)/$(SHAREDIR)/scantopdf/cutpage.html \
        $(PACKAGEDIR)/DEBIAN/control
 
diff --git a/src/addocr b/src/addocr
new file mode 100644 (file)
index 0000000..c9c562e
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+#include "errlog.sh"
+#include "addocr.sh"
+
+main()
+{
+       local file="$1"
+
+       echo "⭐ START: addocr"
+
+       [ -n "$file" ] \
+               || errlog "missing file" \
+               || return $?
+       [ -f "$file" ] \
+               || errlog "file $file does not exists" \
+               || return $?
+
+       addocr "$file"
+
+       echo "✅ SUCCESS: addocr"
+}
+
+main $*
\ No newline at end of file