Last active
August 14, 2017 15:37
-
-
Save knuton/a56d7d9e2beb7e768bb951d92b72ef9f to your computer and use it in GitHub Desktop.
Script to set up a "pseudo Senso" on Raspbian
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
# Purpose: Set up the Senso driver to run as a Senso simulator on boot | |
# Requires ARMv7 or newer. | |
# Usage: curl -L https://git.io/vQIGb | sudo sh -e | |
PARENT_DIR=$(pwd) | |
SETUP_DIR="pseudo-senso" | |
DRIVER_VERSION="v0.3.2" | |
export DEBIAN_FRONTEND=noninteractive | |
# Install Git (may be needed to install dependencies) | |
apt-get -y install git | |
# Install Node | |
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - | |
apt install -y nodejs | |
node -v | |
# Retrieve Senso driver | |
git clone https://github.com/dividat/driver.git "$SETUP_DIR" | |
cd "$SETUP_DIR" | |
git checkout "$DRIVER_VERSION" | |
npm install | |
# Launch on boot & spoof MAC address | |
sed -i -e '$i \su $(whoami) -c "sudo ifconfig eth0 down && sudo ifconfig eth0 hw ether 00:50:c2:3d:97:28 && sudo ifconfig eth0 up && cd '"$PARENT_DIR/$SETUP_DIR"' && npm run replay -- rec/simple.dat > '"$PARENT_DIR/$SETUP_DIR/daemon.log"' &"\n' /etc/rc.local | |
printf "\nDone. Device should appear on network as Senso ($DRIVER_VERSION) after reboot.\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment