GUACAMOLE-374: Support absolutely all properties and extensions.

This commit is contained in:
Michael Jumper
2024-02-18 00:43:21 -08:00
parent 83111616e5
commit 9580dd4f82
15 changed files with 887 additions and 1414 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/bash -e
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -23,10 +23,15 @@
##
## Builds Guacamole, saving "guacamole.war" and all applicable extension .jars
## using the guacamole-client source contained within the given directory.
## Extension files will be grouped by their associated type, with all MySQL
## files being placed within the "mysql/" subdirectory of the destination, all
## PostgreSQL files being placed within the "postgresql/" subdirectory of the
## destination, etc.
## Extension files will be grouped by their associated type, identical to
## extracting the .tar.gz files included with each Guacamole release except
## that version numbers are stripped from directory and .jar file names.
##
## The build process is split across multiple scripts within the
## /opt/guacamole/build.d directory. Additional steps may be added to the
## build process by adding .sh scripts to this directory. Any such scripts MUST
## be shell scripts ending with a ".sh" extension and MUST be written for bash
## (the shell used by this entrypoint).
##
## @param BUILD_DIR
## The directory which currently contains the guacamole-client source and
@@ -39,164 +44,21 @@
## extension type.
##
##
## The directory which currently contains the guacamole-client source and in
## which the build should be performed.
##
BUILD_DIR="$1"
##
## The directory to save guacamole.war within, along with all extension .jars.
## Note that this script will create extension-specific subdirectories within
## this directory, and files will thus be grouped by extension type.
##
DESTINATION="$2"
#
# Create destination, if it does not yet exist
#
# Run all scripts within the "build.d" directory
for SCRIPT in /opt/guacamole/build.d/*.sh; do
source "$SCRIPT"
done
mkdir -p "$DESTINATION"
#
# Build guacamole.war and all extensions
#
cd "$BUILD_DIR"
#
# Run the maven build, applying any arbitrary provided maven arguments.
#
mvn $MAVEN_ARGUMENTS package
#
# Copy guacamole.war to destination
#
cp guacamole/target/*.war "$DESTINATION/guacamole.war"
#
# Copy JDBC auth extensions and SQL scripts
#
tar -xzf extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-dist/target/*.tar.gz \
-C "$DESTINATION" \
--wildcards \
--no-anchored \
--strip-components=1 \
"*.jar" \
"*.sql"
#
# Download MySQL JDBC driver
#
echo "Downloading MySQL Connector/J ..."
curl -L "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-$MYSQL_JDBC_VERSION.tar.gz" | \
tar -xz \
-C "$DESTINATION/mysql/" \
--wildcards \
--no-anchored \
--no-wildcards-match-slash \
--strip-components=1 \
"mysql-connector-*.jar"
#
# Download PostgreSQL JDBC driver
#
echo "Downloading PostgreSQL JDBC driver ..."
curl -L "https://jdbc.postgresql.org/download/postgresql-$PGSQL_JDBC_VERSION.jar" \
> "$DESTINATION/postgresql/postgresql-$PGSQL_JDBC_VERSION.jar"
#
# Copy SSO auth extensions
#
tar -xzf extensions/guacamole-auth-sso/modules/guacamole-auth-sso-dist/target/*.tar.gz \
-C "$DESTINATION" \
--wildcards \
--no-anchored \
--strip-components=1 \
"*.jar"
#
# Download SQL Server JDBC driver
#
echo "Downloading SQL Server JDBC driver ..."
curl -L "https://github.com/microsoft/mssql-jdbc/releases/download/v$MSSQL_JDBC_VERSION/mssql-jdbc-$MSSQL_JDBC_VERSION.jre8.jar" \
> "$DESTINATION/sqlserver/mssql-jdbc-$MSSQL_JDBC_VERSION.jre8.jar" \
#
# Copy LDAP auth extension and schema modifications
#
mkdir -p "$DESTINATION/ldap"
tar -xzf extensions/guacamole-auth-ldap/target/*.tar.gz \
-C "$DESTINATION/ldap" \
--wildcards \
--no-anchored \
--xform="s#.*/##" \
"*.jar" \
"*.ldif"
#
# Copy Radius auth extension if it was build
#
if [ -f extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar ]; then
mkdir -p "$DESTINATION/radius"
cp extensions/guacamole-auth-radius/target/guacamole-auth-radius*.jar "$DESTINATION/radius"
fi
#
# Copy TOTP auth extension if it was built
#
if [ -f extensions/guacamole-auth-totp/target/guacamole-auth-totp*.jar ]; then
mkdir -p "$DESTINATION/totp"
cp extensions/guacamole-auth-totp/target/guacamole-auth-totp*.jar "$DESTINATION/totp"
fi
#
# Copy Duo auth extension if it was built
#
if [ -f extensions/guacamole-auth-duo/target/*.tar.gz ]; then
mkdir -p "$DESTINATION/duo"
tar -xzf extensions/guacamole-auth-duo/target/*.tar.gz \
-C "$DESTINATION/duo/" \
--wildcards \
--no-anchored \
--no-wildcards-match-slash \
--strip-components=1 \
"*.jar"
fi
#
# Copy header auth extension if it was built
#
if [ -f extensions/guacamole-auth-header/target/guacamole-auth-header*.jar ]; then
mkdir -p "$DESTINATION/header"
cp extensions/guacamole-auth-header/target/guacamole-auth-header*.jar "$DESTINATION/header"
fi
#
# Copy json auth extension if it was built
#
if [ -f extensions/guacamole-auth-json/target/guacamole-auth-json*.jar ]; then
mkdir -p "$DESTINATION/json"
cp extensions/guacamole-auth-json/target/guacamole-auth-json*.jar "$DESTINATION/json"
fi
#
# Copy automatic brute-force banning auth extension if it was built
#
if [ -f extensions/guacamole-auth-ban/target/guacamole-auth-ban*.jar ]; then
mkdir -p "$DESTINATION/ban"
cp extensions/guacamole-auth-ban/target/guacamole-auth-ban*.jar "$DESTINATION/ban"
fi
#
# Copy history recording storage extension if it was built
#
if [ -f extensions/guacamole-history-recording-storage/target/guacamole-history-recording-storage*.jar ]; then
mkdir -p "$DESTINATION/recordings"
cp extensions/guacamole-history-recording-storage/target/guacamole-history-recording-storage*.jar "$DESTINATION/recordings"
fi