blob: c0112f622b36fba8e3e139a2696d31e8002694ee [file] [log] [blame]
Austin Schuha617d032017-09-14 00:06:59 -07001#!/bin/bash
Lee Mracek3126dc42018-06-18 04:44:39 -04002set -Eeuo pipefail
Austin Schuha617d032017-09-14 00:06:59 -07003
4if [ $# != 1 ];
5then
Michael Schuhe2baf9c2018-05-31 16:32:46 -10006 echo "# setup_robot.sh is used to configure a newly flashed roboRIO"
7 echo ""
8 echo "Usage: setup_roborio.sh 10.9.71.2"
9 echo ""
10 echo "# or if that does not work, try"
11 echo ""
12 echo "Usage: setup_roborio.sh roboRIO-971-frc.local"
Austin Schuha617d032017-09-14 00:06:59 -070013 exit 1
14fi
15
16readonly ROBOT_HOSTNAME="$1"
17
Austin Schuhcb091712018-02-21 20:01:55 -080018echo "Looking to see if l is aliased right."
Lee Mracek3126dc42018-06-18 04:44:39 -040019
20readonly HAS_ALIAS=$(ssh "admin@${ROBOT_HOSTNAME}" "cat /etc/profile" | grep -Fq "alias l")
21
22if [[ $? -ne 0 ]]; then
23 echo "ssh command failed remotely"
24 exit 1
25elif $HAS_ALIAS
Austin Schuha617d032017-09-14 00:06:59 -070026 echo "Already has l alias"
27else
28 echo "Adding l alias"
29 ssh "admin@${ROBOT_HOSTNAME}" 'echo "alias l=\"ls -la\"" >> /etc/profile'
Michael Schuhe2baf9c2018-05-31 16:32:46 -100030 echo "Adding symbolic link to loging directory"
31 ssh "admin@${ROBOT_HOSTNAME}" ln -s /media/sda1 logs
Austin Schuha617d032017-09-14 00:06:59 -070032fi
33
Michael Schuhe2baf9c2018-05-31 16:32:46 -100034# Make sure starter.sh has the correct permissions to run the robot code.
35# If missing o+rx, the robot code will not start. No error messages on
36# some driver stations.
37ssh "admin@${ROBOT_HOSTNAME}" 'chmod go+rx robot_code/starter.sh'
38
Austin Schuha617d032017-09-14 00:06:59 -070039ssh "admin@${ROBOT_HOSTNAME}" 'PATH="${PATH}":/usr/local/natinst/bin/ /usr/local/frc/bin/frcKillRobot.sh -r -t'
40
41echo "Deploying robotCommand startup script"
42scp aos/config/robotCommand "admin@${ROBOT_HOSTNAME}:/home/lvuser/"
43
Michael Schuhe2baf9c2018-05-31 16:32:46 -100044echo "Copying libstdc++.so.6.0.21 library to /usr/lib"
Lee Mracek3126dc42018-06-18 04:44:39 -040045scp external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/lib/libstdc++.so.6.0.21 "admin@${ROBOT_HOSTNAME}:/usr/lib/"