Skip to content

Instantly share code, notes, and snippets.

@Boltrology
Forked from stokito/install-openjdk8-musl.sh
Created October 10, 2024 22:00
Show Gist options
  • Save Boltrology/07f026a5762fb477598f8f2f55519e22 to your computer and use it in GitHub Desktop.
Save Boltrology/07f026a5762fb477598f8f2f55519e22 to your computer and use it in GitHub Desktop.
Install Java openjdk8 compiled for musl from Alpine onto OpenWRT (armv7). Tested on Turris Omnia (TurrisOS 6.4.1)
#!/bin/sh
# aarch64, armhf, armv7, ppc64le, s390x, x86, x86_64
ARCH="armv7" # Turris Omnia
REVISION="8.275.01-r0"
DESTDIR="" # empty for root, you can set to /opt
# Alpine v3.13 switched to musl v1.2.0 while TurrisOS 6.4.1 uses older musl v1.1.24
# Use ldd command to see a musl version.
# If it's newer then change the URL to https://dl-cdn.alpinelinux.org/alpine/edge/
# You will also need to change the REVISION for the latest
URL="https://dl-cdn.alpinelinux.org/alpine/v3.12/community/$ARCH"
PACKAGES="openjdk8 openjdk8-jre openjdk8-jre-lib openjdk8-jre-base"
for package in $PACKAGES; do
# download and extract on the fly
# apk files are just tar.gz with additional .PKGINFO and .SIGN.RSA files
wget -q -O - "${URL}/${package}-${REVISION}.apk" | tar -xz -C "$DESTDIR" --exclude=.PKGINFO --exclude=.SIGN*
done
export PATH="$PATH:$DESTDIR/usr/lib/jvm/java-8-openjdk/bin"
echo "export PATH=\"$PATH:$DESTDIR/usr/lib/jvm/java-8-openjdk/bin\"" >> /etc/profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment