Skip to content

Instantly share code, notes, and snippets.

@danielwippermann
Last active October 27, 2016 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielwippermann/436f0758f30cfe68c348 to your computer and use it in GitHub Desktop.
Save danielwippermann/436f0758f30cfe68c348 to your computer and use it in GitHub Desktop.
Repackages the Windows installer contents of the RESOL ServiceCenter to run in a *nix environment.
#!/bin/sh
#
# Repackages the Windows installer contents of the RESOL ServiceCenter to run
# in a *nix environment.
#
#
#
# Copyright (c) 2012, Daniel Wippermann
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# RESOL is a registered trademark of RESOL - Elektronische Regelungen GmbH.
#
# All other trademarks are the property of their respective owner.
#
#
#
# Short manual:
#
# 1) Create a new folder and put this script into it
#
# 2) Run the script without additional parameters to get a list of supported architectures:
# $ ./repackage-rsc.sh
#
# 3) Run the script with your favorite architecture parameter:
# $ ./repackage-rsc.sh macosx-cocoa-x86_64
#
# 4) Use the RESOL ServiceCenter located in the "ServiceCenterFull" sub-directory...
# $ ./ServiceCenterFull/eclipse/eclipse
#
#
#
# Revision history:
#
# 2016-10-27: Version 2 (Daniel.Wippermann@gmail.com)
# Adapt to new RSC ZIP directory structure and download location
#
# 2012-07-18: Version 1 (Daniel.Wippermann@gmail.com)
# Initial release
#
#
#
# Future Improvements:
#
# - automatic detection of host architecture
#
ARCHITECTURE="$1"
if [ -z "$ARCHITECTURE" ]; then
echo "USAGE: repackage-rsc.sh <architecture>"
echo
echo "Repackage the Windows installer of the RESOL ServiceCenter to run in a *nix"
echo "environment."
echo
echo "Tested values for <architecture>:"
echo " linux-gtk Linux (x86/GTK 2)"
echo " macosx-cocoa-x86_64 Mac OS X (x86_64/Cocoa)"
echo
echo "Untested, but very likely supported values for <architecture>:"
echo " linux-gtk-x86_64 Linux (x86_64/GTK 2)"
echo ""
exit 1
fi
echo "* Checking prerequisites..."
for PREREQ in wget 7z; do
if ! which $PREREQ > /dev/null 2>&1; then
echo "FATAL: This script needs the '$PREREQ' command to function properly, exiting..."
exit 1
fi
done
TOPDIR="$(cd $(dirname "$0"); pwd)"
if [ -z "$TOPDIR" ]; then
echo "FATAL: Could not determine TOPDIR, exiting..."
exit 1
fi
RSC_SETUP_ZIP_FILE="ServiceCenterFullSetup.zip"
if [ ! -f "$TOPDIR/$RSC_SETUP_ZIP_FILE" ]; then
echo "* Trying to download $RSC_SETUP_ZIP_FILE... "
wget -O "$TOPDIR/$RSC_SETUP_ZIP_FILE" "http://www.resol.de/software/RSC/RSC.zip" || rm -f "$TOPDIR/$RSC_SETUP_ZIP_FILE"
fi
if [ ! -f "$TOPDIR/$RSC_SETUP_ZIP_FILE" ]; then
echo "FATAL: Could not find $RSC_SETUP_ZIP_FILE in $TOPDIR, exiting..."
echo " Please download a Window installer of the RESOL ServiceCenter from"
echo " http://www.resol.de/"
echo " and put it in the same directory as this script."
exit 1
fi
ECLIPSE_TGZ_FILE="eclipse-platform-3.6.2-$ARCHITECTURE.tar.gz"
if [ ! -f "$TOPDIR/$ECLIPSE_TGZ_FILE" ]; then
echo "* Trying to download $ECLIPSE_TGZ_FILE... "
wget -O "$TOPDIR/$ECLIPSE_TGZ_FILE" "http://archive.eclipse.org/eclipse/downloads/drops/R-3.6.2-201102101200/$ECLIPSE_TGZ_FILE" || rm -f "$TOPDIR/$ECLIPSE_TGZ_FILE"
fi
if [ ! -f "$TOPDIR/$ECLIPSE_TGZ_FILE" ]; then
echo "FATAL: Could not find $ECLIPSE_TGZ_FILE in $TOPDIR, exiting..."
echo " Please download a Eclipse 3.6.2 Platform Runtime Binary for your architecture from"
echo " http://archive.eclipse.org/eclipse/downloads/drops/R-3.6.2-201102101200/"
echo " and put it in the same folder as this script."
exit 1
fi
RXTX_ZIP_FILE="rxtx-2.2pre2-bins.zip"
if [ ! -f "$TOPDIR/$RXTX_ZIP_FILE" ]; then
echo "* Trying to download $RXTX_ZIP_FILE... "
wget -O "$TOPDIR/$RXTX_ZIP_FILE" "http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2-bins.zip" || rm -f "$TOPDIR/$RXTX_ZIP_FILE"
fi
if [ ! -f "$TOPDIR/$RXTX_ZIP_FILE" ]; then
echo "FATAL: Could not find $RXTX_ZIP_FILE in $TOPDIR, exiting..."
echo " Please download the RXTX-2.2pre2 package from"
echo " http://rxtx.qbang.org/"
echo " and put it in the same folder as this script."
exit 1
fi
echo "* Extracting $ECLIPSE_TGZ_FILE... "
rm -rf "$TOPDIR/tmp/eclipse"
mkdir -p "$TOPDIR/tmp/eclipse"
tar -x -z -f "$TOPDIR/$ECLIPSE_TGZ_FILE" -C "$TOPDIR/tmp/eclipse"
ECLIPSE_SETUP_DIR="$TOPDIR/tmp/eclipse/eclipse"
if [ ! -d "$ECLIPSE_SETUP_DIR/plugins" ]; then
echo "FATAL: Unpacking $ECLIPSE_TGZ_FILE did not create directory eclipse, exiting..."
exit 1
fi
echo "* Extracting $RXTX_ZIP_FILE... "
rm -rf "$TOPDIR/tmp/rxtx"
mkdir -p "$TOPDIR/tmp/rxtx"
7z x -o"$TOPDIR/tmp/rxtx" "$TOPDIR/$RXTX_ZIP_FILE" > /dev/null 2>&1
RXTX_SETUP_DIR="$TOPDIR/tmp/rxtx/$(basename "$RXTX_ZIP_FILE" .zip)"
if [ ! -f "$RXTX_SETUP_DIR/RXTXcomm.jar" ]; then
echo "FATAL: Unpacking $RXTX_ZIP_FILE did not create RXTXcomm.jar, exiting..."
exit 1
fi
echo "* Extracting $RSC_SETUP_ZIP_FILE... "
rm -rf "$TOPDIR/tmp/rsc-setup"
mkdir -p "$TOPDIR/tmp/rsc-setup"
7z x -o"$TOPDIR/tmp/rsc-setup" "$TOPDIR/$RSC_SETUP_ZIP_FILE" > /dev/null 2>&1
if [ ! -f "$TOPDIR/tmp/rsc-setup/ServiceCenterFullSetup.exe" ]; then
echo "FATAL: Unpacking $RSC_SETUP_ZIP_FILE did not create ServiceCenterFullSetup.exe, exiting..."
exit 1
fi
echo "* Extracting ServiceCenterFullSetup.exe... "
rm -rf "$TOPDIR/tmp/rsc"
mkdir -p "$TOPDIR/tmp/rsc"
7z x -o"$TOPDIR/tmp/rsc" "$TOPDIR/tmp/rsc-setup/ServiceCenterFullSetup.exe" > /dev/null 2>&1
RSC_SETUP_DIR="$TOPDIR/tmp/rsc"
if [ ! -d "$RSC_SETUP_DIR/eclipse/plugins/gnu.io_2.2.0" ]; then
echo "FATAL: Unpacking ServiceCenterFullSetup.exe did not create directory plugins, exiting..."
exit 1
fi
echo "* Merging files into ServiceCenterFull..."
RSC_OUT_DIR="$TOPDIR/ServiceCenterFull"
rm -rf "$RSC_OUT_DIR"
mkdir -p "$RSC_OUT_DIR/eclipse/plugins"
mkdir -p "$RSC_OUT_DIR/eclipse/configuration"
mkdir -p "$RSC_OUT_DIR/workspace"
cp -a "$RSC_SETUP_DIR/eclipse/plugins/"* "$RSC_OUT_DIR/eclipse/plugins/"
for PLATFORM in i686-pc-linux-gnu x86_64-unknown-linux-gnu mac-10.5; do
mkdir -p "$RSC_OUT_DIR/eclipse/plugins/gnu.io_2.2.0/os/$PLATFORM/"
cp -a "$RXTX_SETUP_DIR/$PLATFORM/"* "$RSC_OUT_DIR/eclipse/plugins/gnu.io_2.2.0/os/$PLATFORM/"
done
cp -a "$ECLIPSE_SETUP_DIR/"* "$RSC_OUT_DIR/eclipse/"
cp -a "$RSC_SETUP_DIR/eclipse/configuration/"* "$RSC_OUT_DIR/eclipse/configuration/"
cp -a "$RSC_SETUP_DIR/workspace/"* "$RSC_OUT_DIR/workspace/"
cp -a "$RSC_SETUP_DIR/Readme.html" "$RSC_OUT_DIR/"
echo "* Cleaning up... "
rm -rf "$TOPDIR/tmp"
echo "* DONE!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment