-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
post-install.xql
52 lines (47 loc) · 2.45 KB
/
post-install.xql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
xquery version "3.0";
import module namespace nav="http://www.tei-c.org/tei-simple/navigation" at "modules/navigation.xql";
import module namespace config="http://www.tei-c.org/tei-simple/config" at "modules/config.xqm";
(: The following external variables are set by the repo:deploy function :)
(: file path pointing to the exist installation directory :)
declare variable $home external;
(: path to the directory containing the unpacked .xar package :)
declare variable $dir external;
(: the target collection into which the app is deployed :)
declare variable $target external;
if (not(sm:user-exists("tei-demo"))) then
sm:create-account("tei-demo", "demo", "tei", ())
else
(),
(: API needs dba rights for LaTeX :)
sm:chgrp(xs:anyURI($target || "/modules/lib/api-dba.xql"), "dba"),
sm:chmod(xs:anyURI($target || "/modules/lib/api-dba.xql"), "rwxr-Sr-x"),
xmldb:create-collection($target || "/data", "playground"),
sm:chmod(xs:anyURI($target || "/data/playground"), "rwxrwxr-x"),
sm:chown(xs:anyURI($target || "/data/playground"), "tei-demo"),
sm:chgrp(xs:anyURI($target || "/data/playground"), "tei"),
xmldb:create-collection($target || "/data", "dts"),
sm:chmod(xs:anyURI($target || "/data/dts"), "rwxrwxr-x"),
sm:chown(xs:anyURI($target || "/data/dts"), "tei-demo"),
sm:chgrp(xs:anyURI($target || "/data/dts"), "tei"),
sm:chmod(xs:anyURI($target || "/data/annotate"), "rwxrwxr-x"),
sm:chown(xs:anyURI($target || "/data/annotate"), "tei-demo"),
sm:chown(xs:anyURI($target || "/data/registers"), "tei-demo"),
for $resource in xmldb:get-child-resources($target || "/data/registers")
return (
sm:chown(xs:anyURI($target || "/data/registers/" || $resource), "tei-demo"),
sm:chmod(xs:anyURI($target || "/data/registers/" || $resource), "rw-rw-r--")
),
sm:chmod(xs:anyURI($target || "/data/jats"), "rwxrwxr-x"),
sm:chown(xs:anyURI($target || "/data/jats"), "tei-demo"),
xmldb:create-collection($target || "/data", "temp"),
sm:chmod(xs:anyURI($target || "/data/temp"), "rwxrwxr-x"),
sm:chown(xs:anyURI($target || "/data/temp"), "tei"),
sm:chgrp(xs:anyURI($target || "/data/temp"), "tei"),
sm:chmod(xs:anyURI($target || "/odd"), "rwxrwxr-x"),
sm:chmod(xs:anyURI($target || "/transform"), "rwxrwxr-x"),
for $resource in xmldb:get-child-resources($target || "/transform")
return
if (ends-with($resource, "-main.xql")) then
sm:chmod(xs:anyURI($target || "/transform/" || $resource), "rwxrwxr-x")
else
sm:chmod(xs:anyURI($target || "/transform/" || $resource), "rw-rw-r--")