82 lines
2.3 KiB
Bash
82 lines
2.3 KiB
Bash
#!/bin/bash
|
|
# First-boot script: install packages, Chromium kiosk, KDE Plasma + touch.
|
|
# Intended to be downloaded and run by cloud-init (see user-data-remote-gnss.example).
|
|
# Run as root.
|
|
|
|
set -e
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Packages
|
|
apt-get update -qq
|
|
apt-get install -y -qq \
|
|
git \
|
|
chromium-browser \
|
|
wmctrl \
|
|
openssh-server \
|
|
kde-plasma-desktop \
|
|
maliit-keyboard \
|
|
xinput-calibrator
|
|
|
|
# Autostart dir for user pi
|
|
mkdir -p /home/pi/.config/autostart
|
|
|
|
# Chromium kiosk files from file server
|
|
FILE_SERVER="http://10.130.60.141:5000/files"
|
|
curl -fsSL "${FILE_SERVER}/start-chromium.sh" -o /home/pi/start-chromium.sh
|
|
chmod 755 /home/pi/start-chromium.sh
|
|
chown pi:pi /home/pi/start-chromium.sh
|
|
curl -fsSL "${FILE_SERVER}/chromium-kiosk.desktop" -o /home/pi/.config/autostart/chromium-kiosk.desktop
|
|
chmod 644 /home/pi/.config/autostart/chromium-kiosk.desktop
|
|
chown pi:pi /home/pi/.config/autostart/chromium-kiosk.desktop
|
|
|
|
# KDE Plasma: default session (X11 for Chromium)
|
|
mkdir -p /etc/lightdm/lightdm.conf.d
|
|
cat > /etc/lightdm/lightdm.conf.d/99-default-session.conf << 'LIGHTDM'
|
|
[Seat:*]
|
|
user-session=plasmax11
|
|
LIGHTDM
|
|
|
|
# KDE touch-friendly
|
|
cat > /home/pi/.config/kdeglobals << 'KDE'
|
|
[General]
|
|
ForceFontDPI=120
|
|
KDE
|
|
chown pi:pi /home/pi/.config/kdeglobals
|
|
chmod 644 /home/pi/.config/kdeglobals
|
|
|
|
cat > /home/pi/.config/kwinrc << 'KWIN'
|
|
[Windows]
|
|
BorderlessMaximizedWindows=true
|
|
[Plugins]
|
|
touchpointsEnabled=true
|
|
KWIN
|
|
chown pi:pi /home/pi/.config/kwinrc
|
|
chmod 644 /home/pi/.config/kwinrc
|
|
|
|
# On-screen keyboard (maliit)
|
|
cat > /home/pi/.config/autostart/maliit-keyboard.desktop << 'MALIIT'
|
|
[Desktop Entry]
|
|
Type=Application
|
|
Name=Maliit Keyboard
|
|
Exec=maliit-keyboard -r
|
|
X-GNOME-Autostart-enabled=true
|
|
MALIIT
|
|
chown pi:pi /home/pi/.config/autostart/maliit-keyboard.desktop
|
|
chmod 644 /home/pi/.config/autostart/maliit-keyboard.desktop
|
|
|
|
# Ownership for all of pi's config
|
|
chown -R pi:pi /home/pi/.config
|
|
|
|
# Set KDE Plasma (X11) as default session
|
|
update-alternatives --set x-session-manager /usr/bin/startplasma-x11 2>/dev/null || true
|
|
|
|
# reTerminal DM: install Seeed display/touch drivers (screen will work after reboot)
|
|
REPO_DIR="/tmp/seeed-linux-dtoverlays"
|
|
git clone --depth 1 https://github.com/Seeed-Studio/seeed-linux-dtoverlays "$REPO_DIR"
|
|
"$REPO_DIR/scripts/reTerminal.sh" --device reTerminal-DM
|
|
rm -rf "$REPO_DIR"
|
|
|
|
# Reboot so display and touch work
|
|
reboot
|