-
Notifications
You must be signed in to change notification settings - Fork 1
/
roborio_install_ros.sh
executable file
·113 lines (95 loc) · 5.51 KB
/
roborio_install_ros.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# Run me with IP address of Rio as argument
# Rio must be hooked up to the internet to grab packages correctly
# Set time and date on Rio to match the system
# we're installing from. This should be close enough
# to reality to get past ssl errors from pip if the
# date on the Rio is totally wacky
ssh -p 22 admin@$1 date -u --set=\"$(date)\"
ssh -p 22 admin@$1 'swapon /dev/sda5'
ssh -p 22 admin@$1 'opkg update'
# Split these up so the disk doesn't fill up with temp files
# Also need to install pyyaml first for some reason to avoid
# weird dependency hell issues with opkg (fixed in 2019?)
ssh -p 22 admin@$1 'opkg install python-pyyaml'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install libeigen python-dev libpython2 python-core'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install libcurl4 lz4 libboost-filesystem1.63.0 libboost-program-options1.63.0 libboost-signals1.63.0 libboost-regex1.63.0 libboost-thread1.63.0 libboost-chrono1.63.0 libboost-date-time1.63.0 libboost-atomic1.63.0'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install libbz2 libxml2 libgnutls-bin libgnutls-openssl27'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install libgnutls30 libgnutlsxx28 nettle libgmp10 libgmpxx4 libz1 cmake make'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install python-setuptools python3-docutils'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install python-pkgutil python-dateutil python-argparse python-nose'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install python-netifaces python-pip coreutils gdb i2c-tools '
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install ntp ntp-tickadj ntp-utils ntpdate rsync htop curl libusb-1.0-dev'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install gflags gflags-bash-completion libglog0 openssl'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'opkg install gpgme-dev gpgme libgpg-error-dev libgpg-error0 libassuan-dev libassuan0'
ssh -p 22 admin@$1 'opkg clean'
ssh -p 22 admin@$1 'pip install catkin_pkg rospkg rosdistro vcstools rosdep wstool rosinstall rosinstall_generator defusedxml empy'
# Copy over ROS tar.bz2 file, extract to / on the Rio
scp -P 22 ~/2019RobotCode/roscore_roborio.tar.bz2 admin@$1:.
ssh -p 22 admin@$1 'cd / && tar -xjf ~/roscore_roborio.tar.bz2'
ssh -p 22 admin@$1 'rm ~/roscore_roborio.tar.bz2'
scp -P 22 ~/2019RobotCode/os_detect.py admin@$1:/usr/lib/python2.7/site-packages/rospkg/
# Try to simulate what the cross-build environment looks like
# This will prevent weird bugs were sourcing install_isolated/setup.bash
# will overwrite the settings from /opt/ros/melodic/setup.bash leading
# to errors finding basic ROS tools
ssh -p 22 admin@$1 'mkdir -p /home/ubuntu/frc2019/roborio'
ssh -p 22 admin@$1 'ln -s / /home/ubuntu/frc2019/roborio/arm-frc2019-linux-gnueabi'
# TODO -is this needed?
ssh -p 22 admin@$1 'ln -s /usr/include /include'
# Create workspace. Do a build in the empty workspace to set
# up various scripts for later use. TODO : See if this is needed?
ssh -p 22 admin@$1 'mkdir -p 2019RobotCode/zebROS_ws/src'
ssh -p 22 admin@$1 'source /opt/ros/melodic/setup.bash && cd 2019RobotCode/zebROS_ws && catkin_make_isolated --install'
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#
##################-----------------------------#################
#Edit /etc/ntp.conf to be a copy of ntp-server in 2019RobotCode#
scp -P 22 ~/2019RobotCode/ntp-server.conf admin@$1:/etc/ntp.conf
#---------------------------------------------------------------#
# to setup RTC on the rio
# Plug the rtc into the i2c port on the rio while unpowered
#
scp -P 22 ~/2019RobotCode/rtc-bq32k.ko admin@$1:.
ssh -p 22 admin@$1 'mv rtc-bq32k.ko /lib/modules/`uname -r`/kernel'
ssh -p 22 admin@$1 'depmod'
ssh -p 22 admin@$1 'i2cdetect -y 2'
ssh -p 22 admin@$1 'echo bq32000 0x68 | tee /sys/class/i2c-adapter/i2c-2/new_device'
ssh -p 22 admin@$1 'hwclock -w'
scp -P 22 ~/2019RobotCode/setupClock admin@$1:/etc/init.d/setupClock
ssh -p 22 admin@$1 'chmod +x /etc/init.d/setupClock'
ssh -p 22 admin@$1 'ln -sf /etc/init.d/setupClock /etc/init.d/hwclock.sh'
ssh -p 22 admin@$1 '/usr/sbin/update-rc.d -f setupClock defaults'
ssh -p 22 admin@$1 '/usr/sbin/update-rc.d -f hwclock.sh defaults'
# Copy wpilib to roborio
ssh -p 22 admin@$1 mkdir wpilib
cd ~/frc2019/roborio/arm-frc2019-linux-gnueabi/lib/wpilib/linux/athena/shared
scp -P 22 *.so *.so.3.? admin@$1:wpilib
# Set up ssh keys
scp -P 22 ~/2019RobotCode/jetson_setup/roborio_dot_ssh.tar.bz2 admin@$1:.
ssh -p 22 admin@$1 'mkdir .ssh'
ssh -p 22 admin@$1 'cd .ssh -p 22 && tar -xjf ../roborio_dot_ssh.tar.bz2'
ssh -p 22 admin@$1 'rm roborio_dot_ssh.tar.bz2'
# Edit /etc/ssh/sshd_config, uncomment Port 22, add Port 5801,
# uncomment ChallengeResponseAuthentication and set it to no
ssh -p 22 admin@$1 "sed \"s/#Port 22/Port 22\\nPort 5801/g\" /etc/ssh/sshd_config | sed \"s/#ChallengeResponseAuthentication yes/ChallengeResponseAuthentication no/\" > sshd_config && mv sshd_config /etc/ssh"
# Restart sshd to pick up above changes
ssh -p 22 admin@$1 "/etc/init.d/sshd restart"
sleep 5
# Copy rio_bashrc.sh, ROSJetsonMaster.sh to /home/admin
scp -P 22 ~/2019RobotCode/rio_bashrc.sh admin@$1:.
scp -P 22 ~/2019RobotCode/zebROS_ws/ROSJetsonMaster.sh admin@$1:.
# Set up prereqs for deploy script
ssh -p 22 admin@$1 'mv ~/2019RobotCode ~/2019RobotCode.orig'
ssh -p 22 admin@$1 'ln -s ~/2019RobotCode.orig ~/2019RobotCode'
ssh -p 22 admin@$1 'mkdir -p ~/2019RobotCode.prod/zebROS_ws'
ssh -p 22 admin@$1 'mkdir -p ~/2019RobotCode.dev/zebROS_ws'