Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Liferay's Course Launcher tool automatically prepares your system and sets up a

This tool:

* Checks if Java 21 is installed in your system. If not, it installs Zulu JRE 21 from Azul.
* Checks if Java 21 is installed in your system. If not, it installs Zulu JDK 21 from Azul.
* Downloads and configures the course workspace.
* Initializes the local Liferay DXP bundle.

Expand Down
14 changes: 7 additions & 7 deletions content-manager-course-setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function install-course {

# === CONFIGURATION ===
$JavaRequiredVersion = 21
$ZuluDownloadUrl = "https://cdn.azul.com/zulu/bin/zulu21.30.15-ca-jre21.0.1-win_x64.zip"
$ZuluDownloadUrl = "https://cdn.azul.com/zulu/bin/zulu21.30.15-ca-jdk21.0.1-win_x64.zip"

switch ($CourseKey) {
"--publishing-tool-and-content-lifecycle" {
Expand Down Expand Up @@ -65,7 +65,7 @@ function install-course {

# === Download ZIP ===
Write-Host "📦 Downloading course repository..."
$ProgressPreference = 'SilentlyContinue'
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $RepoUrl -OutFile $ZipPath -UseBasicParsing

# === Extract ZIP directly here ===
Expand Down Expand Up @@ -132,11 +132,11 @@ function Get-JavaMajorVersion {
$JavaInstallDir = Join-Path $ExtractPath "zulu-java"
$JavaMarkerFile = Join-Path $JavaInstallDir ".installed"

function Install-ZuluJRE {
Write-Host "⬇️ Installing Zulu JRE inside: $JavaInstallDir"
$zipFile = "$env:TEMP\zulu-jre.zip"
function Install-ZuluJDK {
Write-Host "⬇️ Installing Zulu JDK inside: $JavaInstallDir"
$zipFile = "$env:TEMP\zulu-jdk.zip"

$ProgressPreference = 'SilentlyContinue'
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $ZuluDownloadUrl -OutFile $zipFile -UseBasicParsing
Expand-Archive -Path $zipFile -DestinationPath $JavaInstallDir
Remove-Item $zipFile
Expand All @@ -161,7 +161,7 @@ function Get-JavaMajorVersion {
$env:JAVA_HOME = $ZuluPath
$env:Path = "$ZuluPath\bin;$env:Path"
} else {
Install-ZuluJRE
Install-ZuluJDK
}
} else {
Write-Host "☕ System Java version $javaMajor is OK."
Expand Down
18 changes: 9 additions & 9 deletions content-manager-course-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@ fetch_text() {
fi
}

install_zulu_jre() {
install_zulu_jdk() {
local ARCH
ARCH=$(uname -m)
[[ "$ARCH" == "x86_64" ]] && ARCH="x64"
[[ "$ARCH" =~ (arm64|aarch64) ]] && ARCH="aarch64"

echo "🌐 Fetching Zulu JRE URL..."
echo "🌐 Fetching Zulu JDK URL..."
local ZULU_URL
ZULU_URL=$(fetch_text "https://api.azul.com/zulu/download/community/v1.0/bundles/latest/?java_version=${JAVA_REQUIRED_VERSION}&os=${OS}&arch=${ARCH}&ext=tar.gz&bundle_type=jre&javafx=false&release_status=ga&hw_bitness=64" \
| grep -oE '"download_url"[ ]*:[ ]*"[^"]+"' | head -n 1 | cut -d '"' -f4)
ZULU_URL=$(fetch_text "https://api.azul.com/zulu/download/community/v1.0/bundles/latest/?java_version=${JAVA_REQUIRED_VERSION}&os=${OS}&arch=${ARCH}&ext=tar.gz&bundle_type=jdk&javafx=false&release_status=ga&hw_bitness=64" \
| grep -oE '"url"[ ]*:[ ]*"[^"]+"' | tail -n 1 | cut -d '"' -f4)

echo "⬇️ Downloading Zulu JRE..."
echo "⬇️ Downloading Zulu JDK..."
mkdir -p "$JAVA_DIR"
local TMP_TAR="${RUNTIME_DIR}/zulu.tar.gz"
mkdir -p "$RUNTIME_DIR"
Expand All @@ -166,7 +166,7 @@ install_zulu_jre() {
}

use_or_install_java() {
# Prefer the managed per-user JRE if present (idempotent across runs)
# Prefer the managed per-user JDK if present (idempotent across runs)
if [[ -x "$JAVA_DIR/bin/java" ]]; then
export JAVA_HOME="$JAVA_DIR"
export PATH="$JAVA_HOME/bin:$PATH"
Expand All @@ -183,8 +183,8 @@ use_or_install_java() {
fi
fi

# Else, install our managed JRE 21
install_zulu_jre
# Else, install our managed JDK 21
install_zulu_jdk
}

# === TOOLING ===
Expand Down Expand Up @@ -223,4 +223,4 @@ echo "🛠 Setting up course environment..."
chmod +x ./gradlew || true
./gradlew initBundle

echo "✅ Done. Liferay bundle initialized. You may proceed to start your Liferay application now."
echo "✅ Done. Liferay bundle initialized. You may proceed to start your Liferay application now."