1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | # $Id$ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | |
---|
6 | name sonatype-nexus |
---|
7 | version 2.2-01 |
---|
8 | categories devel |
---|
9 | platforms darwin |
---|
10 | supported_archs noarch |
---|
11 | license sonatype |
---|
12 | maintainers behanna.org:chris |
---|
13 | description Network-visible Maven repository |
---|
14 | long_description Sonatype Nexus is an http\[s\]-visible Maven repository, \ |
---|
15 | suitable for use by the Maven build system. Nexus conforms \ |
---|
16 | to the repository layout used by Maven 2 and Maven 3. |
---|
17 | |
---|
18 | homepage http://www.sonatype.org/nexus |
---|
19 | master_sites http://www.sonatype.org/downloads |
---|
20 | checksums md5 1f904614f5d412c684fe99ad12064000 \ |
---|
21 | sha1 7c5e1217fdc617ab496707b847b5ce3b237b6ba5 \ |
---|
22 | rmd160 cd79002bd832c8f29e748a2052cecf3e2213b022 |
---|
23 | |
---|
24 | depends_run path:/usr/bin/java:kaffe |
---|
25 | |
---|
26 | distname nexus-${version}-bundle |
---|
27 | |
---|
28 | set nexusUser nexus |
---|
29 | set nexusGroup ${nexusUser} |
---|
30 | |
---|
31 | add_users ${nexusUser} group=${nexusGroup} |
---|
32 | |
---|
33 | use_configure no |
---|
34 | |
---|
35 | #fetch { |
---|
36 | # puts "exec sh -c (cd ${distpath}; curl -L -O ${master_sites}/${distfiles})" |
---|
37 | # try { |
---|
38 | # set results [exec sh -c "(cd ${distpath}; curl -L -O ${master_sites}/${distfiles})"] |
---|
39 | # set status 0 |
---|
40 | # } catch {CHILDSTATUS results options} { |
---|
41 | # set status [lindex [dict get $options -errorcode] 2] |
---|
42 | # } finally {} |
---|
43 | # puts $results |
---|
44 | #} |
---|
45 | |
---|
46 | build {} |
---|
47 | |
---|
48 | extract {} |
---|
49 | |
---|
50 | destroot { |
---|
51 | exec tar zxf ${distpath}/${distfiles} -C ${destroot}${prefix} |
---|
52 | } |
---|
53 | |
---|
54 | set nexusPrefix ${prefix}/nexus |
---|
55 | set nexusDestroot ${destroot}${nexusPrefix} |
---|
56 | |
---|
57 | # |
---|
58 | # We borrow heavily from the "don't overwrite config files" section in |
---|
59 | # www/privoxy. |
---|
60 | # |
---|
61 | post-destroot { |
---|
62 | if [file exists ${nexusDestroot}] { |
---|
63 | file delete ${nexusDestroot} |
---|
64 | } |
---|
65 | |
---|
66 | file link -symbolic ${nexusDestroot} nexus-${version} |
---|
67 | |
---|
68 | # Rename these so local modifications are not removed on uninstall. |
---|
69 | foreach nexusConf {jetty.xml logback.xml nexus.properties} { |
---|
70 | if [file exists ${nexusDestroot}/conf/${nexusConf}] { |
---|
71 | file rename ${nexusDestroot}/conf/${nexusConf} \ |
---|
72 | ${nexusDestroot}/conf/${nexusConf}.new |
---|
73 | } |
---|
74 | # backup config files |
---|
75 | if {[file exists ${nexusPrefix}/conf/${nexusConf}] \ |
---|
76 | && ![file exists ${nexusPrefix}/conf/${nexusConf}.new]} { |
---|
77 | |
---|
78 | file copy ${nexusPrefix}/conf/${nexusConf} \ |
---|
79 | ${destroot}${nexusPrefix}/conf/${nexusConf}.mp_backup |
---|
80 | } |
---|
81 | } |
---|
82 | |
---|
83 | set startup_script ${nexusDestroot}/bin/nexus |
---|
84 | set nexus_properties ${nexusDestroot}/conf/nexus.properties |
---|
85 | |
---|
86 | # |
---|
87 | # Put the nexus data directory someplace sensible. |
---|
88 | # |
---|
89 | if ![file exists ${destroot}/${prefix}/var/sonatype-work] { |
---|
90 | file rename ${destroot}/${prefix}/sonatype-work ${destroot}/${prefix}/var/ |
---|
91 | } else { |
---|
92 | file delete -force ${destroot}/${prefix}/sonatype-work |
---|
93 | } |
---|
94 | |
---|
95 | reinplace "s,^nexus-webapp\=.*$,nexus-webapp=${nexusPrefix}/nexus," \ |
---|
96 | ${nexus_properties}.new |
---|
97 | |
---|
98 | reinplace "s,^nexus-work\=.*$,nexus-work=${prefix}/var/sonatype-work," \ |
---|
99 | ${nexus_properties}.new |
---|
100 | |
---|
101 | reinplace "s,^runtime\=.*$,runtime=${nexusPrefix}/nexus/WEB-INF," \ |
---|
102 | ${nexus_properties}.new |
---|
103 | |
---|
104 | reinplace "s,^#PIDDIR.*$,PIDDIR=${prefix}/var/run," ${startup_script} |
---|
105 | |
---|
106 | # |
---|
107 | # Point the startup file to the installation and set the run user. |
---|
108 | # |
---|
109 | reinplace "s,^NEXUS_HOME.*$,NEXUS_HOME=${nexusPrefix}," ${startup_script} |
---|
110 | reinplace "s,^#RUN_AS_USER.*$,RUN_AS_USER=${nexusUser}," ${startup_script} |
---|
111 | |
---|
112 | } |
---|
113 | |
---|
114 | post-activate { |
---|
115 | foreach nexusConf {jetty.xml logback.xml nexus.properties} { |
---|
116 | if ![file exists ${nexusPrefix}/etc/nexus/${nexusConf}] { |
---|
117 | # restore config files |
---|
118 | if [file exists ${nexusPrefix}/conf/${nexusConf}.mp_backup] { |
---|
119 | file copy ${nexusPrefix}/conf/${nexusConf}.mp_backup \ |
---|
120 | ${nexusPrefix}/conf/${nexusConf} |
---|
121 | } else { |
---|
122 | file copy ${nexusPrefix}/conf/${nexusConf}.new \ |
---|
123 | ${nexusPrefix}/conf/${nexusConf} |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | if {[existsuser ${nexusUser}] != 0 && \ |
---|
128 | [existsgroup ${nexusGroup}] != 0} { |
---|
129 | |
---|
130 | file attributes ${nexusPrefix}/conf/${nexusConf} \ |
---|
131 | -group ${nexusGroup} -owner ${nexusUser} \ |
---|
132 | -permissions 0664 |
---|
133 | } |
---|
134 | } |
---|
135 | |
---|
136 | if {[file exists ${prefix}/var/sonatype-work] && \ |
---|
137 | [existsuser ${nexusUser}] != 0 && \ |
---|
138 | [existsgroup ${nexusGroup}] != 0} { |
---|
139 | |
---|
140 | file attributes ${prefix}/var/sonatype-work \ |
---|
141 | -group ${nexusGroup} -owner ${nexusUser} \ |
---|
142 | -permissions 0775 |
---|
143 | } |
---|
144 | } |
---|
145 | |
---|
146 | destroot.violate_mtree yes |
---|
147 | |
---|
148 | startupitem.create yes |
---|
149 | startupitem.name nexus |
---|
150 | startupitem.start "${prefix}/nexus/bin/nexus start" |
---|
151 | startupitem.stop "${prefix}/nexus/bin/nexus stop" |
---|
152 | startupitem.restart "${prefix}/nexus/bin/nexus restart" |
---|
153 | startupitem.pidfile clean ${prefix}/var/run/nexus.pid |
---|