#!/bin/sh #----make sure this is run as root user=`id -u` if [ $user -ne 0 ]; then echo "This script requires root permissions. Please run this script with sudo." exit fi #----ascii art! echo " _ _ _ _ _ _ _ " echo "| | (_) | | | | | | | | | " echo "| |_ _| |__ ___ | |_ | |__ ___ ___ | |_ ___| |_ _ __ __ _ _ __ " echo "| __| | '_ \ / _ \| __| | '_ \ / _ \ / _ \| __/ __| __| '__/ _\` | '_ \ " echo "| |_| | |_) | (_) | |_ | |_) | (_) | (_) | |_\__ \ |_| | | (_| | |_) |" echo " \__| |_.__/ \___/ \__| |_.__/ \___/ \___/ \__|___/\__|_| \__,_| .__/ " echo " _/ | | | " echo " |__/ |_| " #----intro message echo "" echo "-----------------------------------------------------------------------" echo "Welcome! Let's set up your Raspberry Pi with the TJBot software." echo "" echo "Important: This script was designed for setting up a Raspberry Pi after" echo "a clean install of Raspbian. If you are running this script on a" echo "Raspberry Pi that you've used for other projects, please take a look at" echo "what this script does BEFORE running it to ensure you are comfortable" echo "with its actions (e.g. performing an OS update, installing software" echo "packages, removing old packages, etc.)" echo "-----------------------------------------------------------------------" #----confirm bootstrap read -p "Would you like to use this Raspberry Pi for TJBot? [Y/n] " choice /dev/null 2>&1 sed -i "s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\t$name/g" /etc/hosts #----disabling ipv6 echo "" echo "In some networking environments, disabling ipv6 may help your Pi get on" echo "the network." read -p "Disable ipv6? [y/N] " choice /dev/null; then NODE_VERSION=$(node --version 2>&1) NODE_LEVEL=$(node --version 2>&1 | cut -d '.' -f 1 | cut -d 'v' -f 2) if [ $NODE_LEVEL -lt $MIN_NODE_LEVEL ]; then echo "Node.js v$NODE_VERSION.x is currently installed. We recommend installing" echo "v$MIN_NODE_LEVEL.x or later." NEED_NODE_INSTALL=true fi else echo "Node.js is not installed." NEED_NODE_INSTALL=true fi if $NEED_NODE_INSTALL; then read -p "Would you like to install Node.js v$RECOMMENDED_NODE_LEVEL.x? [Y/n] " choice /dev/null 2>&1 fi if grep "gpu_mem=128" /boot/config.txt then : else echo "gpu_mem=128" | tee -a /boot/config.txt >/dev/null 2>&1 fi fi ;; *) ;; esac #----clone tjbot echo "" echo "We are ready to clone the TJBot project." read -p "Where should we clone it to? (default: /home/pi/Desktop/tjbot): " TJBOT_DIR