Skip to content

Commit 1fbec62

Browse files
committed
Add rpi bootstrap script
1 parent 50ebb13 commit 1fbec62

File tree

6 files changed

+100
-0
lines changed

6 files changed

+100
-0
lines changed

rpi/.bash_profile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if [ -z $DISPLAY ] && [ $(tty) = /dev/tty1 ]
2+
then
3+
set -e
4+
while true; do
5+
startx
6+
done
7+
fi

rpi/.xinitrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
xset -dpms
3+
# Disable screensaver
4+
xset s off
5+
xset s noblank
6+
7+
# Hide mouse pointer
8+
unclutter -idle 0 &
9+
10+
# Start browser in kiosk mode
11+
chromium-browser http://localhost:8082 --start-fullscreen --kiosk --incognito --noerrdialogs --no-first-run --disk-cache-dir=/dev/null

rpi/Readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Run status-board on a Raspberry Pi
2+
3+
This folder contains scripts to configure a Pi to run the status board.
4+
You can install a [Raspberry Pi OS Lite](https://www.raspberrypi.com/software/operating-systems/)
5+
and use the [bootstrap.sh](bootstrap.sh) script to set it up:
6+
7+
```shell
8+
# Install Raspberry Pi OS Lite (32bit) (https://www.raspberrypi.com/software/operating-systems/)
9+
# Setup username, password, hostname, ssh and autologin (without desktop) with
10+
sudo raspi-config
11+
# Download and extract latest bootstrap archive
12+
wget -qO- https://github.com/RoboCup-SSL/ssl-status-board/releases/latest/download/bootstrap.tar.gz | tar xvz
13+
# Run bootstrap script
14+
./rpi/bootstrap.sh
15+
```

rpi/autologin.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux

rpi/bootstrap.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
6+
7+
SRC_VERSION=${1-}
8+
9+
function installService() {
10+
if [[ ! -f ~/.local/share/systemd/user/ssl-status-board.service ]]; then
11+
mkdir -p ~/.local/share/systemd/user/
12+
cp "$SCRIPT_DIR/ssl-status-board.service" ~/.local/share/systemd/user/ssl-status-board.service
13+
systemctl --user enable ssl-status-board.service
14+
fi
15+
}
16+
17+
function installStatusBoard() {
18+
sudo apt-get install --no-install-recommends -y curl jq
19+
20+
systemctl --user stop ssl-status-board.service
21+
mkdir -p ~/.local/bin/
22+
if [[ -z "${SRC_VERSION}" ]]; then
23+
SRC_VERSION="$(curl -s https://api.github.com/repos/RoboCup-SSL/ssl-status-board/releases/latest | jq -r '.tag_name')"
24+
fi
25+
echo "Installing version: ${SRC_VERSION}"
26+
wget "https://github.com/RoboCup-SSL/ssl-status-board/releases/download/${SRC_VERSION}/ssl-status-board_${SRC_VERSION}_linux_arm" -O ~/.local/bin/ssl-status-board
27+
chmod +x ~/.local/bin/ssl-status-board
28+
systemctl --user start ssl-status-board.service
29+
}
30+
31+
function installBrowser() {
32+
# https://blog.r0b.io/post/minimal-rpi-kiosk/
33+
sudo apt-get install --no-install-recommends -y \
34+
xserver-xorg-video-all xserver-xorg-input-all xserver-xorg-core xinit x11-xserver-utils \
35+
unclutter \
36+
chromium-browser
37+
38+
# Enable Auto-Login on console
39+
mkdir -p /etc/systemd/system/[email protected]
40+
sudo cp "${SCRIPT_DIR}/autologin.conf" /etc/systemd/system/[email protected]/autologin.conf
41+
42+
# Configure to run browser when X starts
43+
cp "${SCRIPT_DIR}/.xinitrc" ~/.xinitrc
44+
45+
# Configure to run X on tty1
46+
cp "${SCRIPT_DIR}/.bash_profile" ~/.bash_profile
47+
}
48+
49+
sudo apt-get update
50+
installService
51+
installStatusBoard
52+
installBrowser

rpi/ssl-status-board.service

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
description=Launches SSL Status Board
3+
Wants=network-online.target
4+
After=network-online.target
5+
6+
[Service]
7+
Type=simple
8+
ExecStart=%h/.local/bin/ssl-status-board
9+
Restart=always
10+
11+
[Install]
12+
WantedBy=default.target

0 commit comments

Comments
 (0)