blob: 2a072e5a452432dafa80f3b0dd58e9b8066daf30 [file] [log] [blame]
Austin Schuhab8c0c52020-02-22 13:42:37 -08001#!/bin/bash
2
3set -ex
4
5mkdir -p /root/bin
6
7# Give it a static IP
8cp /tmp/dhcpcd.conf /etc/
9
10# And provide a script to change it.
11cp /tmp/change_hostname.sh /root/bin/
12chmod a+x /root/bin/change_hostname.sh
13
14chown -R pi.pi /home/pi/.ssh
15
16apt-get install -y vim-nox \
17 git \
18 cpufrequtils
19
20echo 'GOVERNOR="performance"' > /etc/default/cpufrequtils
21
22# Add a .bashrc and friends for root.
23if [[ ! -e "/root/.dotfiles" ]]; then
24 cd /root/
25 git clone --separate-git-dir=/root/.dotfiles https://github.com/AustinSchuh/.dotfiles.git tmpdotfiles
26 rsync --recursive --verbose --exclude '.git' tmpdotfiles/ /root/
27 rm -r tmpdotfiles
28 git --git-dir=/root/.dotfiles/ --work-tree=/root/ config --local status.showUntrackedFiles no
29 # Run the vundle installer which installs plugins on the first run of vim.
30 vim -c ":qa!"
31fi
32
33# Add a .bashrc and friends for pi.
34if [[ ! -e "/home/pi/.dotfiles" ]]; then
35 cd /home/pi/
36 su -c "git clone --separate-git-dir=/home/pi/.dotfiles https://github.com/AustinSchuh/.dotfiles.git tmpdotfiles" pi
37 su -c "rsync --recursive --verbose --exclude '.git' tmpdotfiles/ /home/pi/" pi
38 su -c "rm -r tmpdotfiles" pi
39 su -c "git --git-dir=/home/pi/.dotfiles/ --work-tree=/home/pi/ config --local status.showUntrackedFiles no" pi
40 # Run the vundle installer which installs plugins on the first run of vim.
41 su -c "vim -c ':qa!'" pi
42fi
43
44# Make SSH work and not complain about pi being the username and pw still.
45rm -f /etc/profile.d/sshpwd.sh
46rm -f /etc/profile.d/wifi-check.sh
47
48systemctl enable ssh.service
49
50# Default us to pi-8971-1
51/root/bin/change_hostname.sh pi-8971-1