blob: 3b711122368e826d5e41ba56c13b0f4147325ef4 [file] [log] [blame]
Austin Schuhab8c0c52020-02-22 13:42:37 -08001#!/bin/bash
2
3set -ex
4
5mkdir -p /root/bin
Jim Ostrowskib82a22f2022-02-27 16:10:17 -08006mkdir -p /home/pi/bin
Austin Schuhab8c0c52020-02-22 13:42:37 -08007
8# Give it a static IP
9cp /tmp/dhcpcd.conf /etc/
10
11# And provide a script to change it.
12cp /tmp/change_hostname.sh /root/bin/
Austin Schuhc0ec2a82022-02-24 17:26:29 -080013cp /tmp/enable_imu.sh /root/bin/
Austin Schuhab8c0c52020-02-22 13:42:37 -080014chmod a+x /root/bin/change_hostname.sh
Austin Schuhc0ec2a82022-02-24 17:26:29 -080015chmod a+x /root/bin/enable_imu.sh
Austin Schuhab8c0c52020-02-22 13:42:37 -080016
17chown -R pi.pi /home/pi/.ssh
Austin Schuhc0ec2a82022-02-24 17:26:29 -080018chown -R pi.pi /home/pi/bin
Austin Schuhab8c0c52020-02-22 13:42:37 -080019
Tyler Chatow6309a472022-03-27 23:09:48 -070020echo 'deb [trusted=yes] https://software.frc971.org/Build-Dependencies/gstreamer_bullseye_arm64_deps ./' >> /etc/apt/sources.list
21
Austin Schuh90c82782020-02-26 19:54:51 -080022apt-get update
23
Austin Schuhab8c0c52020-02-22 13:42:37 -080024apt-get install -y vim-nox \
25 git \
Austin Schuh90c82782020-02-26 19:54:51 -080026 cpufrequtils \
Jim Ostrowskic58989a2022-01-29 16:12:08 -080027 libopencv-calib3d4.5 \
28 libopencv-contrib4.5 \
29 libopencv-core4.5 \
30 libopencv-features2d4.5 \
31 libopencv-flann4.5 \
32 libopencv-highgui4.5 \
33 libopencv-imgcodecs4.5 \
34 libopencv-imgproc4.5 \
35 libopencv-ml4.5 \
36 libopencv-objdetect4.5 \
37 libopencv-photo4.5 \
38 libopencv-shape4.5 \
39 libopencv-stitching4.5 \
40 libopencv-superres4.5 \
41 libopencv-video4.5 \
42 libopencv-videoio4.5 \
43 libopencv-videostab4.5 \
44 libopencv-viz4.5 \
Austin Schuh1252ed12020-03-01 19:27:29 -080045 libnice10 \
Austin Schuh867bd922021-11-07 16:59:52 -080046 pmount \
Jim Ostrowskic58989a2022-01-29 16:12:08 -080047 libnice-dev \
Tyler Chatow6309a472022-03-27 23:09:48 -070048 feh \
49 libgstreamer1.0-0 \
50 libgstreamer-plugins-base1.0-0 \
51 libgstreamer-plugins-bad1.0-0 \
52 gstreamer1.0-plugins-base \
53 gstreamer1.0-plugins-good \
54 gstreamer1.0-plugins-bad \
55 gstreamer1.0-plugins-ugly \
56 gstreamer1.0-nice
Austin Schuhab8c0c52020-02-22 13:42:37 -080057
Tyler Chatow6309a472022-03-27 23:09:48 -070058PATH=$PATH:/sbin dpkg -i /tmp/wiringpi-2.70-1.deb
Jim Ostrowski2a483b32022-02-15 18:19:14 -080059
Austin Schuhab8c0c52020-02-22 13:42:37 -080060echo 'GOVERNOR="performance"' > /etc/default/cpufrequtils
61
62# Add a .bashrc and friends for root.
63if [[ ! -e "/root/.dotfiles" ]]; then
64 cd /root/
65 git clone --separate-git-dir=/root/.dotfiles https://github.com/AustinSchuh/.dotfiles.git tmpdotfiles
66 rsync --recursive --verbose --exclude '.git' tmpdotfiles/ /root/
67 rm -r tmpdotfiles
68 git --git-dir=/root/.dotfiles/ --work-tree=/root/ config --local status.showUntrackedFiles no
69 # Run the vundle installer which installs plugins on the first run of vim.
70 vim -c ":qa!"
71fi
72
73# Add a .bashrc and friends for pi.
74if [[ ! -e "/home/pi/.dotfiles" ]]; then
75 cd /home/pi/
76 su -c "git clone --separate-git-dir=/home/pi/.dotfiles https://github.com/AustinSchuh/.dotfiles.git tmpdotfiles" pi
77 su -c "rsync --recursive --verbose --exclude '.git' tmpdotfiles/ /home/pi/" pi
78 su -c "rm -r tmpdotfiles" pi
79 su -c "git --git-dir=/home/pi/.dotfiles/ --work-tree=/home/pi/ config --local status.showUntrackedFiles no" pi
80 # Run the vundle installer which installs plugins on the first run of vim.
81 su -c "vim -c ':qa!'" pi
82fi
83
84# Make SSH work and not complain about pi being the username and pw still.
85rm -f /etc/profile.d/sshpwd.sh
86rm -f /etc/profile.d/wifi-check.sh
87
88systemctl enable ssh.service
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080089systemctl enable frc971.service
Austin Schuhf7970ca2022-02-11 22:19:29 -080090systemctl enable frc971chrt.service
Austin Schuhab8c0c52020-02-22 13:42:37 -080091
Austin Schuhd4df9552020-09-13 18:59:50 -070092# Default us to pi-971-1
93/root/bin/change_hostname.sh pi-971-1