|
| 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 |
0 commit comments