Skip to content

Instantly share code, notes, and snippets.

@dcommander
Last active February 20, 2022 01:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcommander/84f5ebd45953922525ca09a46865b5a5 to your computer and use it in GitHub Desktop.
Save dcommander/84f5ebd45953922525ca09a46865b5a5 to your computer and use it in GitHub Desktop.
A script that automates building JNI JAR files for the TurboVNC Helper libraries in a specific release of TurboVNC
#!/bin/bash
set -u
set -e
trap onexit INT
trap onexit TERM
trap onexit EXIT
TMPDIR=
onexit()
{
if [ ! "$TMPDIR" = "" ]; then
rm -rf $TMPDIR
fi
}
TMPDIR=`mktemp -d /tmp/buildtvnchelperjars.XXXXXX`
URL=https://sourceforge.net/projects/turbovnc/files
VERSION=
if [ "$#" -gt 0 ]; then
VERSION=$1
fi
if [ "$VERSION" = "" ]; then
echo USAGE: $0 \<TurboVNC version\>
exit 1
fi
pushd $TMPDIR
wget -nv $URL/$VERSION/TurboVNC-$VERSION.exe
innoextract -s TurboVNC-$VERSION.exe
mv app/java/turbovnchelper.dll .
rm -rf app *.exe
jar cf turbovnchelper-win32.jar turbovnchelper.dll
wget -nv $URL/$VERSION/TurboVNC64-$VERSION.exe
innoextract -s TurboVNC64-$VERSION.exe
mv app/java/turbovnchelper.dll .
rm -rf app *.exe
jar cf turbovnchelper-win64.jar turbovnchelper.dll
wget -nv $URL/$VERSION/turbovnc-$VERSION.i386.rpm
rpm2cpio turbovnc-$VERSION.i386.rpm | cpio -id
mv opt/TurboVNC/java/libturbovnchelper.so .
rm -rf opt etc usr *.rpm
jar cf turbovnchelper-linux32.jar libturbovnchelper.so
wget -nv $URL/$VERSION/turbovnc-$VERSION.x86_64.rpm
rpm2cpio turbovnc-$VERSION.x86_64.rpm | cpio -id
mv opt/TurboVNC/java/libturbovnchelper.so .
rm -rf opt etc usr *.rpm
jar cf turbovnchelper-linux64.jar libturbovnchelper.so
popd
mv $TMPDIR/*.jar .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment