Austin Schuh | ab8c0c5 | 2020-02-22 13:42:37 -0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | mkdir -p /root/bin |
| 6 | |
| 7 | # Give it a static IP |
| 8 | cp /tmp/dhcpcd.conf /etc/ |
| 9 | |
| 10 | # And provide a script to change it. |
| 11 | cp /tmp/change_hostname.sh /root/bin/ |
| 12 | chmod a+x /root/bin/change_hostname.sh |
| 13 | |
| 14 | chown -R pi.pi /home/pi/.ssh |
| 15 | |
| 16 | apt-get install -y vim-nox \ |
| 17 | git \ |
| 18 | cpufrequtils |
| 19 | |
| 20 | echo 'GOVERNOR="performance"' > /etc/default/cpufrequtils |
| 21 | |
| 22 | # Add a .bashrc and friends for root. |
| 23 | if [[ ! -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!" |
| 31 | fi |
| 32 | |
| 33 | # Add a .bashrc and friends for pi. |
| 34 | if [[ ! -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 |
| 42 | fi |
| 43 | |
| 44 | # Make SSH work and not complain about pi being the username and pw still. |
| 45 | rm -f /etc/profile.d/sshpwd.sh |
| 46 | rm -f /etc/profile.d/wifi-check.sh |
| 47 | |
| 48 | systemctl enable ssh.service |
| 49 | |
| 50 | # Default us to pi-8971-1 |
| 51 | /root/bin/change_hostname.sh pi-8971-1 |