|
1 |
| -#!/bin/sh -e |
| 1 | +#!/bin/bash -e |
2 | 2 | #
|
3 | 3 | # Licensed to the Apache Software Foundation (ASF) under one
|
4 | 4 | # or more contributor license agreements. See the NOTICE file
|
|
23 | 23 | ##
|
24 | 24 | ## Builds Guacamole, saving "guacamole.war" and all applicable extension .jars
|
25 | 25 | ## using the guacamole-client source contained within the given directory.
|
26 |
| -## Extension files will be grouped by their associated type, with all MySQL |
27 |
| -## files being placed within the "mysql/" subdirectory of the destination, all |
28 |
| -## PostgreSQL files being placed within the "postgresql/" subdirectory of the |
29 |
| -## destination, etc. |
| 26 | +## Extension files will be grouped by their associated type, identical to |
| 27 | +## extracting the .tar.gz files included with each Guacamole release except |
| 28 | +## that version numbers are stripped from directory and .jar file names. |
| 29 | +## |
| 30 | +## The build process is split across multiple scripts within the |
| 31 | +## /opt/guacamole/build.d directory. Additional steps may be added to the |
| 32 | +## build process by adding .sh scripts to this directory. Any such scripts MUST |
| 33 | +## be shell scripts ending with a ".sh" extension and MUST be written for bash |
| 34 | +## (the shell used by this entrypoint). |
30 | 35 | ##
|
31 | 36 | ## @param BUILD_DIR
|
32 | 37 | ## The directory which currently contains the guacamole-client source and
|
|
39 | 44 | ## extension type.
|
40 | 45 | ##
|
41 | 46 |
|
| 47 | +## |
| 48 | +## The directory which currently contains the guacamole-client source and in |
| 49 | +## which the build should be performed. |
| 50 | +## |
42 | 51 | BUILD_DIR="$1"
|
43 |
| -DESTINATION="$2" |
44 |
| - |
45 |
| -# |
46 |
| -# Create destination, if it does not yet exist |
47 |
| -# |
48 |
| - |
49 |
| -mkdir -p "$DESTINATION" |
50 |
| - |
51 |
| -# |
52 |
| -# Build guacamole.war and all extensions |
53 |
| -# |
54 |
| - |
55 |
| -cd "$BUILD_DIR" |
56 |
| - |
57 |
| -# |
58 |
| -# Run the maven build, applying any arbitrary provided maven arguments. |
59 |
| -# |
60 |
| - |
61 |
| -mvn $MAVEN_ARGUMENTS package |
62 |
| - |
63 |
| -# |
64 |
| -# Copy guacamole.war to destination |
65 |
| -# |
66 |
| - |
67 |
| -cp guacamole/target/*.war "$DESTINATION/guacamole.war" |
68 |
| - |
69 |
| -# |
70 |
| -# Copy JDBC auth extensions and SQL scripts |
71 |
| -# |
72 |
| - |
73 |
| -tar -xzf extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/target/*.tar.gz \ |
74 |
| - -C "$DESTINATION" \ |
75 |
| - --wildcards \ |
76 |
| - --no-anchored \ |
77 |
| - --strip-components=1 \ |
78 |
| - "*.jar" \ |
79 |
| - "*.sql" |
80 |
| - |
81 |
| -# |
82 |
| -# Download MySQL JDBC driver |
83 |
| -# |
84 |
| - |
85 |
| -echo "Downloading MySQL Connector/J ..." |
86 |
| -curl -L "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-$MYSQL_JDBC_VERSION.tar.gz" | \ |
87 |
| -tar -xz \ |
88 |
| - -C "$DESTINATION/mysql/" \ |
89 |
| - --wildcards \ |
90 |
| - --no-anchored \ |
91 |
| - --no-wildcards-match-slash \ |
92 |
| - --strip-components=1 \ |
93 |
| - "mysql-connector-*.jar" |
94 |
| - |
95 |
| -# |
96 |
| -# Download PostgreSQL JDBC driver |
97 |
| -# |
98 |
| - |
99 |
| -echo "Downloading PostgreSQL JDBC driver ..." |
100 |
| -curl -L "https://jdbc.postgresql.org/download/postgresql-$PGSQL_JDBC_VERSION.jar" \ |
101 |
| - > "$DESTINATION/postgresql/postgresql-$PGSQL_JDBC_VERSION.jar" |
102 |
| - |
103 |
| -# |
104 |
| -# Copy SSO auth extensions |
105 |
| -# |
106 |
| - |
107 |
| -tar -xzf extensions/guacamole-auth-sso/modules/guacamole-auth-sso-dist/target/*.tar.gz \ |
108 |
| - -C "$DESTINATION" \ |
109 |
| - --wildcards \ |
110 |
| - --no-anchored \ |
111 |
| - --strip-components=1 \ |
112 |
| - "*.jar" |
113 | 52 |
|
114 |
| -# |
115 |
| -# Download SQL Server JDBC driver |
116 |
| -# |
117 |
| - |
118 |
| -echo "Downloading SQL Server JDBC driver ..." |
119 |
| -curl -L "https://github.com/microsoft/mssql-jdbc/releases/download/v$MSSQL_JDBC_VERSION/mssql-jdbc-$MSSQL_JDBC_VERSION.jre8.jar" \ |
120 |
| - > "$DESTINATION/sqlserver/mssql-jdbc-$MSSQL_JDBC_VERSION.jre8.jar" \ |
121 |
| - |
122 |
| -# |
123 |
| -# Copy LDAP auth extension and schema modifications |
124 |
| -# |
125 |
| - |
126 |
| -mkdir -p "$DESTINATION/ldap" |
127 |
| -tar -xzf extensions/guacamole-auth-ldap/target/*.tar.gz \ |
128 |
| - -C "$DESTINATION/ldap" \ |
129 |
| - --wildcards \ |
130 |
| - --no-anchored \ |
131 |
| - --xform="s#.*/##" \ |
132 |
| - "*.jar" \ |
133 |
| - "*.ldif" |
134 |
| - |
135 |
| -# |
136 |
| -# Copy Radius auth extension if it was build |
137 |
| -# |
138 |
| - |
139 |
| -if [ -f extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar ]; then |
140 |
| - mkdir -p "$DESTINATION/radius" |
141 |
| - cp extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar "$DESTINATION/radius" |
142 |
| -fi |
143 |
| - |
144 |
| -# |
145 |
| -# Copy TOTP auth extension if it was built |
146 |
| -# |
147 |
| - |
148 |
| -if [ -f extensions/guacamole-auth-totp/target/guacamole-auth-totp*.jar ]; then |
149 |
| - mkdir -p "$DESTINATION/totp" |
150 |
| - cp extensions/guacamole-auth-totp/target/guacamole-auth-totp*.jar "$DESTINATION/totp" |
151 |
| -fi |
152 |
| - |
153 |
| -# |
154 |
| -# Copy Duo auth extension if it was built |
155 |
| -# |
156 |
| - |
157 |
| -if [ -f extensions/guacamole-auth-duo/target/*.tar.gz ]; then |
158 |
| - mkdir -p "$DESTINATION/duo" |
159 |
| - tar -xzf extensions/guacamole-auth-duo/target/*.tar.gz \ |
160 |
| - -C "$DESTINATION/duo/" \ |
161 |
| - --wildcards \ |
162 |
| - --no-anchored \ |
163 |
| - --no-wildcards-match-slash \ |
164 |
| - --strip-components=1 \ |
165 |
| - "*.jar" |
166 |
| -fi |
167 |
| - |
168 |
| -# |
169 |
| -# Copy header auth extension if it was built |
170 |
| -# |
171 |
| - |
172 |
| -if [ -f extensions/guacamole-auth-header/target/guacamole-auth-header*.jar ]; then |
173 |
| - mkdir -p "$DESTINATION/header" |
174 |
| - cp extensions/guacamole-auth-header/target/guacamole-auth-header*.jar "$DESTINATION/header" |
175 |
| -fi |
176 |
| - |
177 |
| -# |
178 |
| -# Copy json auth extension if it was built |
179 |
| -# |
180 |
| - |
181 |
| -if [ -f extensions/guacamole-auth-json/target/guacamole-auth-json*.jar ]; then |
182 |
| - mkdir -p "$DESTINATION/json" |
183 |
| - cp extensions/guacamole-auth-json/target/guacamole-auth-json*.jar "$DESTINATION/json" |
184 |
| -fi |
185 |
| - |
186 |
| -# |
187 |
| -# Copy automatic brute-force banning auth extension if it was built |
188 |
| -# |
189 |
| - |
190 |
| -if [ -f extensions/guacamole-auth-ban/target/guacamole-auth-ban*.jar ]; then |
191 |
| - mkdir -p "$DESTINATION/ban" |
192 |
| - cp extensions/guacamole-auth-ban/target/guacamole-auth-ban*.jar "$DESTINATION/ban" |
193 |
| -fi |
| 53 | +## |
| 54 | +## The directory to save guacamole.war within, along with all extension .jars. |
| 55 | +## Note that this script will create extension-specific subdirectories within |
| 56 | +## this directory, and files will thus be grouped by extension type. |
| 57 | +## |
| 58 | +DESTINATION="$2" |
194 | 59 |
|
195 |
| -# |
196 |
| -# Copy history recording storage extension if it was built |
197 |
| -# |
| 60 | +# Run all scripts within the "build.d" directory |
| 61 | +for SCRIPT in /opt/guacamole/build.d/*.sh; do |
| 62 | + source "$SCRIPT" |
| 63 | +done |
198 | 64 |
|
199 |
| -if [ -f extensions/guacamole-history-recording-storage/target/guacamole-history-recording-storage*.jar ]; then |
200 |
| - mkdir -p "$DESTINATION/recordings" |
201 |
| - cp extensions/guacamole-history-recording-storage/target/guacamole-history-recording-storage*.jar "$DESTINATION/recordings" |
202 |
| -fi |
0 commit comments