blob: 474a969ff3405ea41f2d672553f25d0190a40726 [file] [log] [blame]
Austin Schuha617d032017-09-14 00:06:59 -07001#!/bin/bash
Austin Schuhf4fd6a92018-09-16 16:31:12 -07002#
3# Note: this should be run from within bazel
4
Lee Mracek3126dc42018-06-18 04:44:39 -04005set -Eeuo pipefail
Austin Schuha617d032017-09-14 00:06:59 -07006
7if [ $# != 1 ];
8then
Michael Schuhe2baf9c2018-05-31 16:32:46 -10009 echo "# setup_robot.sh is used to configure a newly flashed roboRIO"
10 echo ""
11 echo "Usage: setup_roborio.sh 10.9.71.2"
12 echo ""
13 echo "# or if that does not work, try"
14 echo ""
15 echo "Usage: setup_roborio.sh roboRIO-971-frc.local"
Austin Schuha617d032017-09-14 00:06:59 -070016 exit 1
17fi
18
19readonly ROBOT_HOSTNAME="$1"
20
Austin Schuhcb091712018-02-21 20:01:55 -080021echo "Looking to see if l is aliased right."
Lee Mracek3126dc42018-06-18 04:44:39 -040022
Austin Schuhf4fd6a92018-09-16 16:31:12 -070023if ! HAS_ALIAS=$(ssh "admin@${ROBOT_HOSTNAME}" "cat /etc/profile"); then
Lee Mracek3126dc42018-06-18 04:44:39 -040024 echo "ssh command failed remotely"
25 exit 1
Austin Schuhf4fd6a92018-09-16 16:31:12 -070026elif echo "${HAS_ALIAS}" | grep -Fq "alias l"; then
Austin Schuha617d032017-09-14 00:06:59 -070027 echo "Already has l alias"
28else
29 echo "Adding l alias"
30 ssh "admin@${ROBOT_HOSTNAME}" 'echo "alias l=\"ls -la\"" >> /etc/profile'
Michael Schuhe2baf9c2018-05-31 16:32:46 -100031 echo "Adding symbolic link to loging directory"
32 ssh "admin@${ROBOT_HOSTNAME}" ln -s /media/sda1 logs
Austin Schuha617d032017-09-14 00:06:59 -070033fi
34
Austin Schuha617d032017-09-14 00:06:59 -070035ssh "admin@${ROBOT_HOSTNAME}" 'PATH="${PATH}":/usr/local/natinst/bin/ /usr/local/frc/bin/frcKillRobot.sh -r -t'
36
37echo "Deploying robotCommand startup script"
38scp aos/config/robotCommand "admin@${ROBOT_HOSTNAME}:/home/lvuser/"
39
Michael Schuhe2baf9c2018-05-31 16:32:46 -100040echo "Copying libstdc++.so.6.0.21 library to /usr/lib"
Lee Mracek3126dc42018-06-18 04:44:39 -040041scp external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/lib/libstdc++.so.6.0.21 "admin@${ROBOT_HOSTNAME}:/usr/lib/"