Installing Void Linux on a Raspberry Pi

I wanted to try out Void Linux so I decided to throw one of my raspberry pi’s at it.

  1. Follow the void linux wiki to install rootfs on the sd card. ssh was working out of the box so I was able to plug in the pi and connect via ssh using root with voidlinux as the password.
  2. Configure the package repo to point to:

    echo "repository=http://repo3.voidlinux.eu/current/musl/" >> /etc/xbps.d/my-remote-repo.conf
    
  3. Through normal means:
    • Set the root password
    • Create a new user
    • Create a password for the new user
    • Add the new user to the suders file
    • Log out of root and log back in as the new user
  4. Update the system:

    sudo xbps-install -Suv
    
  5. Hack away

Simplified GitHub Authorization Using a Git Credential Helper

In order to avoid having to authenticate each time I want to push to github I decided to set up a get credential helper that parses an encrypted credential file. The steps were:

  1. Create a personal access token in github
  2. Add the following in ~/.gitauth

    host=github.com protocol=https username=<user> password=<token>
    
    host=gist.github.com protocol=https username=<user> password=<token>
    
  3. Generate a gpg key

    gpg --gen-key
    
    • Initially I got the following error: “gpg: agent_genkey failed: No pinentry”. pinentry is just a symlink that points to one of the many pinentry binaries depending on the type you want to use. I’m running a headless server and the default pinentry expects a gui. To fix this I changed the pinentry symlink to point to pinentry-curses. I’m sure there’s a better way to do this but the few options I came across didn’t seem to work.
  4. Encrypt your gitauth file

    gpg -e -r email@example.com ~/.gitauth
    
  5. You should know have ~/.gitauth.gpg and can remove the original ~/.gitauth
  6. Set up the credential helper. Copy the following to ~/viking66/bin/git-credential-helper and make it executable:

    #!/usr/bin/env sh
    
    CREDENTIAL_FILE=$1
    
    TARGET=$(cat)
    HOST=$(echo $TARGET | grep -Po 'host=[^ ]+')
    PROTOCOL=$(echo $TARGET | grep -Po 'protocol=[^ ]+')
    
    AUTH=$(gpg -q --decrypt $CREDENTIAL_FILE | grep "$HOST" | grep "$PROTOCOL")
    
    echo "$(echo $AUTH | grep -Po 'username=[^ ]+')"
    echo "$(echo $AUTH | grep -Po 'password=[^ ]+')"
    
  7. Update git config to use the credential helper:

    git config --global credential.helper "/home/viking66/bin/git-credential-helper ~/.gitauth.gpg"
    
  8. Add the following to your .bashrc otherwise the gpg decrypt will not prompt for password and will fail:

    GPG_TTY=$(tty)
    export GPG_TTY
    
  9. Now when you push to github, your credential helper should kick in and eliminate the need to provide your username and password.

Intro

This blog is a brain dump of the things I learn while tinkering on random projects. It will contain things I know I’ll eventually forget but will inevitably need to make use of in the future.