clear printf " ================================================================================ Sensorgnome Software Installation Script for Raspberry Pi 2 ================================================================================ " VERSION_NEEDED="Raspbian GNU/Linux 8 (jessie)" SG_VERSION="2016-05-04" ## check for correct version of OS . /etc/os-release if [[ "$PRETTY_NAME" != "$VERSION_NEEDED" ]]; then printf " Wrong version of raspbian! You must boot the RPi2 with the raspbian jessie lite 2016-03-28 image, available here: http://public.sensorgnome.org/RasperryPi2_Sensorgnome_Images/2016-03-18-raspbian-jessie-lite.img.7z ================================================================================ " return fi printf " This script will install Sensorgnome Software version $SG_VERSION on the SD card. Hit Enter to continue, or Ctrl-C to stop..." read x ## maybe resize root partition UNUSED=`cat /proc/partitions | awk '/mmc/{if (!total) total=$3; else total-= $3}END{printf "%d\n", total *1024/1e6}'` if (( $UNUSED + 0 > 100 )); then printf " Your SD card has $UNUSED MB of extra storage that is not accessible. To allow you to use this storage, I will launch raspi-config. In raspi-config, please do this: - select 'Expand Filesystem' - select 'Finish' (by hitting TAB) - choose 'Yes' when asked to 'Reboot now?' Ater rebooting, login and run this installation script again. You can use the up cursor to recover the command line you used to run the script. Make sure to do 'sudo su' first, so that you are working as root. Hit Enter to continue, or Ctrl-C to stop..." read x raspi-config return fi x=`cat /proc/swaps | wc -l` ## disable swap if (( $x > 1 )); then printf "\nDisabling the swap partition..." dphys-swapfile swapoff dphys-swapfile uninstall update-rc.d dphys-swapfile remove fi ## add user bone if ( ! grep -q ^bone: /etc/passwd ); then printf "\nAdding user bone (password 'bone') as synonym for 'pi'..." grep pi /etc/passwd | sed -e 's/pi/bone/g' >> /etc/passwd printf "bone\nbone\n" | passwd bone > /dev/null 2>&1 ln -s /home/pi /home/bone fi ## install needed software packages printf "\nInstalling required raspbian packages; this will take a while...\n" apt-get -y update apt-get -y install gpsd chrony libfftw3-bin libgps21 nodejs vsftpd autossh libfftw3-single3 npm udhcpd libboost-filesystem1.55.0 libboost-date-time1.55.0 libboost-thread1.55.0 libvamp-sdk2 libvamp-hostsdk3 libjson-perl printf "\nInstalling required nodejs packages; this will take a while...\n" for p in socket.io express connect errorhandler body-parser method-override; do npm install -g $p; done printf " ================================================================================ Installing sensorgnome software ================================================================================ " ## add symlinks to nodejs, fcd ln -s /usr/bin/nodejs /usr/bin/node ln -s /home/bone/proj/fcd/fcd /usr/bin/fcd ## fetch and unpack SG archive (curl http://public.sensorgnome.org/RaspberryPi2_Sensorgnome_Images/2016_05_04_update_from_jessie_lite.tar.bz2) | (cd /; tar -xpjvf -) systemctl enable hostnamesg.sh #systemctl disable dhcpcd #update-rc.d eth0-config defaults #update-rc.d udhcpd defaults sync printf " ================================================================================ Installation Complete. I will now reboot. You might need to power off/on. ================================================================================ After the reboot, you will find me here: http://192.168.7.2 - web interface ftp://192.168.7.2 - FTP file server Most computers will also be able to find me here: http://sgpi.local - web interface ftp://sgpi.local - FTP file server To edit deployment.txt or to install SG_tag_database.csv, you can just place this microSD card into another computer and copy files directly onto the first drive. DO NOT LET WINDOWS or OS X reformat this card! Hit Enter to continue, or Ctrl-C to stop... " read x reboot