#!/bin/bash PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" CWD=`pwd` ID=`id -u` if test $ID -ne "0"; then echo "Need to be root" exit fi #INSTALL JRE AND JAVA SERIAL I/O apt-get install openjdk-7-jre librxtx-java update-java-alternatives --jre -s `update-java-alternatives -l | awk '/java-1.7/ { print $1 }'` #INSTALL MPIDE (IF NOT ALREADY INSTALLED) cd /opt if test ! -d "mpide-0023-raspberrypi-20130920"; then wget http://chipkit.s3.amazonaws.com/builds/mpide-0023-raspberrypi-20130920.tgz tar zxvf mpide-0023-raspberrypi-20130920.tgz rm -f mpide-0023-raspberrypi-20130920.tgz fi cd $CWD #LINK MPIDE IN PATH ln -sf /opt/mpide-0023-raspberrypi-20130920/mpide /usr/local/bin/mpide #SETUP TTYS0 FOR MPIDE ON REBOOT echo "ln -f /dev/ttyAMA0 /dev/ttyS0" >> /etc/rc.local #SETUP TTYAMA0 FOR MPIDE ON REBOOT if test ! -f "/boot/cmdline.txt.bak"; then cp /boot/cmdline.txt /boot/cmdline.txt.bak fi C=`awk '{ for (i = 1; i <= NF; ++i) { if ($i !~ /ttyAMA0/) { printf $i" " } } printf "\n" }' /boot/cmdline.txt` echo $C > /boot/cmdline.txt echo "NOW REBOOT."