Raspberry Pi OS | pi-top[4] SDK | Full Automated Install

@duwudi @pi-topMIKE Hope your ok with this and you can use this how you wish

With a couple issues with installing the pi-top SDK missing dependencies, I decided to make an automated script that will install the pi-top SDK and required dependencies depending if you have Raspberry Pi OS Lite, Minimal or full.

This does require internet connection and can be run via SSH or directly on the system
THIS IS NOT REQUIRED FOR pi-topOS

What does the script do exactly?

  1. Updates your system to latest version and removes useless packages
  2. Checks the Raspberry Pi OS Version || Lite, Minimal or Full
  3. Installs dependencies specific to OS version
  4. Installs the pi-top SDK

Raspberry Pi OS Lite missing dependencies

  • python3-pip
  • libopenjp2-7
  • libilmbase-dev
  • libopenexr-dev
  • libgstreamer1.0-dev
  • libavcodec-dev
  • libavformat-dev
  • libswscale-dev
  • openCV

Raspberry Pi OS Minimal and Full missing dependencies

  • openCV

Check what version of Raspberry Pi OS you have installed can be done by checking /boot/issue.txt and checking the stage number

  • Stage 1 - truly minimal system. - no idea what this version is
  • Stage 2 - Lite system. - publicly available (Lite)
  • Stage 3 - desktop system - no idea what this version is
  • Stage 4 - Normal Raspbian image. - publicly available (Minimal)
  • Stage 5 - The Raspbian Full image. - publicly available (Full)

Stage 2, 4 and 5 are all we are interested in. 1 and 3 are unknown versions to me. I dont know where to get the images from so I cannot test

PLEASE NOTE: this script can take some time to complete so please be patient

Testing
I have tested this on all 3 versions, Lite/Minimal/Full and can confirm that it works. you will know that it works when the OLED starts displaying the pi-top animation then the menu system when completed

Single Line installer
wget -O - https://raw.githubusercontent.com/CAProjects/pi-top-SDK-installer/main/sdk-installer.sh | bash

leave it to fully run

Full Code
If you have suggestions on how to optimize this better, I would welcome the feedback

#!/bin/bash
clear
echo "Welcome to the pi-top[4] SDK installer"
echo
echo "this script was created by CAProjects"
echo "to help with installing the pi-top SDK"
echo
echo "What this script does is check what version"
echo "of Raspberry Pi OS your running and then"
echo "installs the required dependencies for the"
echo "pi-top SDK and also the SDK itself"
echo
echo "This script will start in 5 seconds"
sleep 5s

FILE=/boot/issue.txt
clear
echo "****************************************"
echo "* Updating your system before we start *"
echo "****************************************"
sleep 3s
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y

clear
echo "Update has completed"
echo "Checking Raspbery Pi OS version || Lite, Minimal or full"
sleep 3s
echo
if test -f "$FILE"; then
    if grep "stage4" "/boot/issue.txt" || grep "stage5" "/boot/issue.txt"; then
        clear
        echo "OS Version is Raspberry Pi Minimal or Full"
        echo "Installing SDK dependencies for Minimal/full"
        sleep 3s
        sudo python3 -m pip install opencv-python
        echo
        echo "SDK dependencies installed, Installing the pi-top SDK"
        sleep 3s
    elif grep "stage2" "$FILE"; then
        clear
        echo "OS Version is Raspberry Pi Lite"
        echo "Installing SDK dependencies for Lite"
        sleep 3s
        sudo apt install -y python3-pip libopenjp2-7 libilmbase-dev libopenexr-dev libgstreamer1.0-dev libavcodec-dev libavformat-dev libswscale-dev
        sudo python3 -m pip install opencv-python
        echo
        echo "SDK dependencies installed, Installing the pi-top SDK"
        sleep 3s
    else
        echo "Sorry, you have an unsupported Raspberry Pi OS version"
        echo "Terminating Script..."
        exit
    fi
fi
clear
echo "deb http://apt.pi-top.com/pi-top-os sirius main contrib non-free" | sudo tee /etc/apt/sources.list.d/pi-top.list &> /dev/null
curl https://apt.pi-top.com/pt-apt.asc | sudo apt-key add
sudo apt update
sudo apt install --no-install-recommends -y pt-device-manager pt-sys-oled pt-firmware-updater

echo
echo "We are all done here, Please check the pi-top OLED screen for battery status"
echo "if you see a battery status on the OLED, the install completed without issue"

My repo for the code

@CAProjects nice, this looks super useful - only feedback I have is to remove some of the unnecessary sleeps throughout the script, no reason to slow things down :grin:

@duwudi Yeah I forgot to take them out, was mainly for testing, will sort that out on Thursday