0

Like perhaps many newbies to Raspberry Pi, I'm experimenting with the various OS options and how to customize the OS to my preferences. Every time I copy an OS to one of my Micro SD cards, I perform a few tasks manually:

  • Perform GUI and CLI updates
  • Disable Bluetooth
  • Enable VNC
  • Copy my public SSH key
  • Install Vim
  • Change background to solid color
  • Reduce GUI resolution
  • Remove unneeded folders and files from ~.

So far I've done the above about a dozen times. I'd like to not repeat myself anymore. But I'd also like to take advantage of git branching so I can experiment. VS Code is available for Raspberry Pi but unsupported. I'd like to create a git branch of the boot drive, install VS Code, see if it's stable enough for my needs. If not, take advantage of git and revert to the main branch, start from that point again.

In case it's relevant, I know a bit of Linux, but that's mostly because I use macOS as my main machine and am familiar with its command line, as well as having used Linux for web services.

What would be the best way to integrate version control with Raspberry Pi starter images?

Chuck
  • 223
  • 2
  • 8

1 Answers1

0

My solution so far is to use a separate repository to hold a script that does about 90% of what I want. It's not perfect, but I plan to refine it over time and correct the one thing in it that's not working so far (enabling VNC).

In case anyone else finds it useful, here it is (with some redaction):

#!/usr/bin/env bash

rm -r ~/Bookshelf/ ~/Documents/ ~/Downloads/ ~/Music/ ~/Pictures/ ~/Templates/ ~/Public/ ~/Videos/

echo "" >> ~/.bashrc echo "alias ls="ls -la"" >> ~/.bashrc echo "alias ll="ls -golAFhG"" >> ~/.bashrc echo "alias lll="ls -lAFG"" >> ~/.bashrc echo "alias ..="cd .."" >> ~/.bashrc source ~/.bashrc

git config --global user.email chivalry@mac.com git config --global user.name "Charles Ross"

sudo cp config-files/90forceyes /etc/apt/apt.conf.d/ sudo apt full-upgrade sudo apt-get update sudo apt-get upgrade sudo apt-get install vim sudo apt-get install gh sudo apt autoremove sudo apt clean

echo "ghp_..." | gh auth login --with-token

mkdir ~/.ssh cp config-files/authorized_keys ~/.ssh/

Enable VNC

sudo raspi-config nonint do_vnc 0

Boot into CLI

sudo raspi-config nonint do_boot_behaviour B2 sudo systemctl disable bluetooth

sudo reboot now

I haven't figured out how to change the GUI resolution or remove the desktop picture and set the background to a single color in the GUI, but this is sufficient for now. When creating a new boot drive for the Pi, I copy the repository folder to a thumb drive and execute the script. Takes a few minutes, and isn't completely non-interactive yet (because of some existing configuration files during, I think, the full-upgrade command). And I'm not positive that everything I'm doing with apt is necessary, but it's a start.

Chuck
  • 223
  • 2
  • 8