Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EAP Controller software on a raspberry pi. Full description: https://medium.com/@arthurgay/eap-controller-software-on-a-raspberry-pi-9e93ecd1672e.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run using sudo or as the root user."
exit 1
fi
echo "EAP Controller on Raspberry Pi"
echo "=============================="
echo "Author: Arthur Gay <arthurgay05@gmail.com>"
echo "Full explanation: https://medium.com/@arthurgay/eap-controller-software-on-a-raspberry-pi"
echo ""
echo "Checking requirements"
hash wget 2>/dev/null || { echo >&2 " Utility wget is required but is not installed. Aborting."; exit 1; }
hash tar 2>/dev/null || { echo >&2 " Utility tar is required but is not installed. Aborting."; exit 1; }
hash patch 2>/dev/null || { echo >&2 " Utility patch is required but is not installed. Aborting."; exit 1; }
hash which 2>/dev/null || { echo >&2 " Utility which is required but is not installed. Aborting."; exit 1; }
hash java 2>/dev/null || { echo >&2 " Program java must be installed. Use sudo apt-get install oracle-java7-jdk. Aborting."; exit 1; }
hash mongo 2>/dev/null || { echo >&2 " Program mongo must be installed. Use sudo apt-get install mongodb. Aborting."; exit 1; }
echo "Create temp directory"
TEMP_DIR=$(mktemp -d)
cd $TEMP_DIR
echo "Download archive"
wget http://static.tp-link.com/EAP_Controller_v2.4.8_linux_x64.tar.gz
echo "Extract archive"
tar -xf EAP_Controller_v2.4.8_linux_x64.tar.gz
echo "Patch file controller.sh"
TEMP_FILE=$(mktemp)
echo<<EOF >$(TEMPFILE)
8c8
< JAVA_TOOL=${JRE_HOME}/bin/java
---
> JAVA_TOOL=java
68c68
< ${PORTT_TOOL} 127.0.0.1 8088 500
---
> netstat -plnt | grep :::8088
92c92
< nohup $JAVA_TOOL -server -Xms128m -Xmx1024m -XX:MaxHeapFreeRatio=60 -XX:MinHeapFreeRatio=30 -XX:+UseSerialGC -XX:+HeapDumpOnOutOfMemoryError -Deap.home="${eapHome}" -cp ${eapHome}"/lib/com.tp-link.eap.start-0.0.1-SNAPSHOT.jar:"${eapHome}"/lib/*:"${eapHome}"/external-lib/*" com.tp_link.eap.start.EapMain start > ${eapHome}/logs/startup.log 2>&1 &
---
> nohup $JAVA_TOOL -client -Xms128m -Xmx1024m -XX:MaxHeapFreeRatio=60 -XX:MinHeapFreeRatio=30 -XX:+UseSerialGC -XX:+HeapDumpOnOutOfMemoryError -Deap.home="${eapHome}" -cp ${eapHome}"/lib/com.tp-link.eap.start-0.0.1-SNAPSHOT.jar:"${eapHome}"/lib/*:"${eapHome}"/external-lib/*" com.tp_link.eap.start.EapMain start > ${eapHome}/logs/startup.log 2>&1 &
EOF
mv bin/control.sh bin/control.sh~
patch bin/control.sh~ -i $TEMP_FILE -o bin/control.sh
echo "Replace mongo and mongod binaries"
rm bin/mongo bin/mongod
ln -s $(which mongo) bin/mongo
ln -s $(which mongod) bin/mongod
echo "Disable mongod service at startup"
systemctl stop mongodb.service
systemctl disable mongodb.service
echo "Install"
./install.sh
rm -rf $TEMP_DIR
rm $TEMP_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.