Skip to content

Commit ef72bc8

Browse files
committed
Add a script to install WildFly
Signed-off-by: Jeff Mesnil <jmesnil@ibm.com>
1 parent 4f1b707 commit ef72bc8

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

public/sh/install-wildfly

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env sh
2+
3+
REPO="wildfly/wildfly"
4+
5+
if [ -n "${WILDFLY_VERSION}" ]; then
6+
echo "🔍 Fetching ${WILDFLY_VERSION} release from GitHub..."
7+
else
8+
echo "🔍 Fetching latest release from GitHub..."
9+
WILDFLY_VERSION=$(curl -s https://api.github.com/repos/$REPO/releases/latest \
10+
| grep "tag_name" \
11+
| cut -d '"' -f 4)
12+
fi
13+
url="https://github.com/$REPO/releases/download/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip"
14+
15+
echo "⬇️ Downloading $url..."
16+
curl -sLf -o "wildfly.zip" $url
17+
if [ $? -ne 0 ]; then
18+
echo "❌ Error downloading WildFly from $url" 1>&2
19+
exit $retval
20+
fi
21+
22+
echo "🔒 Verifying checksum..."
23+
SHA1SUM=$(curl -sLf ${url}.sha1)
24+
ACTUAL_SHA1=$(sha1sum wildfly.zip | cut -d ' ' -f 1)
25+
if [ "$ACTUAL" != "$EXPECTED" ]; then
26+
echo "❌ Checksum failed" 1>&2
27+
exit 1
28+
fi
29+
30+
echo "📦 Extracting WildFly..."
31+
unzip -q "./wildfly.zip" -d .
32+
# detect extracted directory (e.g., wildflt-1.3.0.Final)
33+
DIR=$(unzip -Z -1 "./wildfly.zip" |head -n1)
34+
rm ./wildfly.zip
35+
# remove existing directory
36+
rm -rf wildfly
37+
38+
echo "🚀 Installing to $(pwd)/wildfly"
39+
mv $DIR wildfly
40+
41+
echo "💡 You can use the JBOSS_HOME environment variable:"
42+
echo " export JBOSS_HOME=$(pwd)/wildfly"
43+
44+
version=$(./wildfly/bin/jboss-cli.sh --commands="embed-server,:read-attribute(name=product-version)" | grep result | cut -d '"' -f 4)
45+
echo "✅ Installation of WildFly $version complete!"

0 commit comments

Comments
 (0)