Forked from CrackerStealth/patch_openhab_bluetooth.sh
Last active
February 11, 2016 21:12
-
-
Save richbeales/d7177734e1804a56a72a to your computer and use it in GitHub Desktop.
BASH Script to Patch OpenHAB Bluetooth Binding For Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Patch OpenHAB Bluetooth Binding For Linux | |
# | |
# Description: Patches the bluetooth binding compiled for OpenHAB with the | |
# libraries needed to run on Linux. You should change the path to Java below | |
# in the JAVA_BIN enviornmental variable. | |
# | |
# PLACE THIS SCRIPT IN AN EMPTY DIRECTORY WITH THE OPENHAB BLUETOOTH BINDING! | |
# | |
# Filename: patch_openhab_bluetooth.sh | |
# | |
# Usage: ./patch_openhab_bluetooth.sh org.openhab.binding.bluetooth-[VERSION].jar | |
# Setup enviornment variables | |
BINDING_JAR=$1 | |
# Command line parameter check | |
if [ -z "$BINDING_JAR" ]; then | |
echo "usage $0 org.openhab.binding.bluetooth-[VERSION].jar" | |
exit 1; | |
fi | |
# Extract and remove the bindings jar file | |
jar -xvf $BINDING_JAR | |
rm -f $BINDING_JAR | |
# Download the latest snapshot of the bluecove libraries into the lib folder | |
cd lib | |
rm -f bluecove-2.1.1-SNAPSHOT.jar | |
wget http://snapshot.bluecove.org/distribution/download/2.1.1-SNAPSHOT/2.1.1-SNAPSHOT.63/bluecove-2.1.1-SNAPSHOT.jar | |
wget http://snapshot.bluecove.org/distribution/download/2.1.1-SNAPSHOT/2.1.1-SNAPSHOT.63/bluecove-bluez-2.1.1-SNAPSHOT.jar | |
wget http://snapshot.bluecove.org/distribution/download/2.1.1-SNAPSHOT/2.1.1-SNAPSHOT.63/bluecove-gpl-2.1.1-SNAPSHOT.jar | |
cd .. | |
# Modify the Manifest file to know about the added libraries | |
cd META-INF | |
sed -i 's|.,lib/bluecove-2.1.1.jar|.,lib/bluecove-gpl-2.1.1-SNAPSHOT.jar,lib/bluecove-bluez-2.1.1-SNAPSHOT.jar,lib/bluecove-2.1.1-SNAPSHOT.jar|g' MANIFEST.MF | |
cd .. | |
# Bundle the binding back up into a JAR file and remove source files | |
jar -cmf0 META-INF/MANIFEST.MF $BINDING_JAR lib META-INF org OSGI-INF | |
rm -rf ./lib ./META-INF ./org ./OSGI-INF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to work for me - on debian 32 bit.