Commit 7df9bc95 authored by Jérome Perrin's avatar Jérome Perrin

component/tesseract: fix permissions of downloaded traineddata

With the default umask of running slapos node, the default umask create files
that are only readable by user, not by group:

    slapuser10@COMP-1234:~$ ls -al /opt/slapgrid/bf0ccebdbd76d491bcbe16b7998529b2/parts/tesseract/share/tessdata/
    total 125296
    drwxr-x--- 4 slapsoft slapsoft 4096 Jul 13 05:57 .
    drwxr-x--- 3 slapsoft slapsoft 4096 Jul 13 05:57 ..
    -rw------- 1 slapsoft slapsoft 44366093 Jul 13 05:57 chi_sim.traineddata
    drwxr-x--- 2 slapsoft slapsoft 4096 Jul 13 05:57 configs
    -rw------- 1 slapsoft slapsoft 23466654 Jul 13 05:57 eng.traineddata
    -rw------- 1 slapsoft slapsoft 14213351 Jul 13 05:57 fra.traineddata
    -rw------- 1 slapsoft slapsoft 35659159 Jul 13 05:57 jpn.traineddata
    -rw------- 1 slapsoft slapsoft 10562874 Jul 13 05:57 osd.traineddata
    -rw-r--r-- 1 slapsoft slapsoft 572 Jul 13 05:57 pdf.ttf
    drwxr-x--- 2 slapsoft slapsoft 4096 Jul 13 05:57 tessconfigs

but when using multiple users, partitions users are members of slapsoft group,
so these files needs to be group readable.
parent e97d82f2
[download-tessdata.py]
filename = download-tessdata.py
md5sum = 2d283a6d8662d6bb8c9de7b26162b702
md5sum = 1f6cf2797f0daf9dec16c1d3a8c44907
......@@ -19,9 +19,13 @@ def post_make_hook(options, buildout, env):
for url in options['tessdata-urls'].splitlines():
url, _, md5sum = url.partition('#')
if url:
destination = os.path.join(
options['tessdata-location'],
os.path.basename(url),
)
download(
url,
md5sum=md5sum,
path=os.path.join(options['tessdata-location'],
os.path.basename(url)),
path=destination,
)
os.chmod(destination, 0o750)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment