summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-12-11 17:23:48 +0000
committerNick White <git@njw.name>2019-12-11 17:23:48 +0000
commitb8ad2e78705a7db9e4ae433afcc60f1325549506 (patch)
tree3c0544a81ff3d5ec415461eed06dde638792d6ec
parent1a6d3cda451b97acf59f79de6b11fbdd22b6ef1f (diff)
Install trainings from training repo, and ensure they are updated when bookpipeline starts
-rw-r--r--roles/pipeliner/templates/updatepipeline.j26
-rw-r--r--roles/tesseractor/tasks/training.yml11
2 files changed, 11 insertions, 6 deletions
diff --git a/roles/pipeliner/templates/updatepipeline.j2 b/roles/pipeliner/templates/updatepipeline.j2
index 9a375ca..e7b6ed4 100644
--- a/roles/pipeliner/templates/updatepipeline.j2
+++ b/roles/pipeliner/templates/updatepipeline.j2
@@ -1,5 +1,9 @@
#!/bin/sh
g="/home/{{ ansible_user }}/src/go"
+t="/home/{{ ansible_user }}/trainings"
GOPATH="$g" go get -u rescribe.xyz/bookpipeline/... && \
-sudo cp "$g/bin/bookpipeline" /usr/local/bin/
+sudo cp "$g/bin/bookpipeline" /usr/local/bin/ || exit 1
+
+cd "$t" && git pull && \
+cp "$t"/* /usr/local/share/tesseract-ocr/trainings/
diff --git a/roles/tesseractor/tasks/training.yml b/roles/tesseractor/tasks/training.yml
index 2393ae5..c9e9315 100644
--- a/roles/tesseractor/tasks/training.yml
+++ b/roles/tesseractor/tasks/training.yml
@@ -1,8 +1,9 @@
---
# Installs tesseract training files
-# TODO: get this from somewhere more sensible
-- name: Install tesseract training files
- copy: src={{ item }} dest=/usr/local/share/tesseract-ocr/tessdata/
- with_items:
- - /home/nick/rescribe/2018-natphil/tmp/tessdata/rescribealphav5.traineddata
+- name: Get trainings repo
+ git: dest=/home/{{ ansible_user }}/trainings repo=https://git.rescribe.xyz/trainings
+ become: no
+
+- name: Copy trainings
+ copy: src=/home/{{ ansible_user }}/trainings/ dest=/usr/local/share/tesseract-ocr/tessdata