SignageWithAlpineLinux: Unterschied zwischen den Versionen

Aus bytewerk-Wiki
Zur Navigation springen Zur Suche springen
(support multiple browsers as an option)
KKeine Bearbeitungszusammenfassung
 
(5 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
Signage with Alpine linux on the raspberry pi
Signage with Alpine linux on the raspberry pi

=== hardware ===
This guide works for the Raspberry Pi3 and Raspberry Pi4.

In case you want to run a viewer for Schlangenprogrammiernacht you'll need a Raspberry Pi4 as the javascript viewer ist quite demanding

=== setup image ===
=== setup image ===
* Format SD-Card as FAT32 with a MSDOS partition table
* Format SD-Card as FAT32 with a MSDOS partition table
Zeile 10: Zeile 16:
=== prepare base system ===
=== prepare base system ===
* start "setup-alpine"
* start "setup-alpine"
** select keyboard language (e.g. de-nodeadkeys)
* Agree to install on /dev/mmcblk0p1
** choose hostname (e.g. "signage")
* install as "sys"
** chose interface to listen for DHCP for (e.g. eth0)
* add user e.g. "sign"
** select timezone (e.g. Europe/Berlin)
** add user e.g. "sign"
** Agree to install on /dev/mmcblk0p1
** install as "sys"
* reboot the system
* reboot the system
* (optional) continue via SSH
* (optional) continue via SSH
* select correct repositories
* apk update
* apk add nano
root> apk update
root> apk add nano
* nano /etc/apk/repositories and uncomment the community repository
root> nano /etc/apk/repositories #uncomment the community repository
* apk update
root> apk update


=== setup base system ===
=== setup base system ===
* setup boot parameters
* apk add screen
* add file boot/usercfg.txt with the following content
* add file /boot/usercfg.txt with the following content
disable_overscan=1
root> echo "disable_overscan=1
dtoverlay=vc4-kms-v3d
dtoverlay=vc4-kms-v3d
gpu_mem=128
gpu_mem=128" > /boot/usercfg.txt
* (optional) switch to udev
* (optional) switch to udev
setup-devd
root> setup-devd


=== setup windowmanager ===
=== setup windowmanager ===
* install window manager
* install window manager
root> apk add screen
apk add seatd wlr-randr mesa-dri-gallium sway
apk add wlr-randr wtype
root> apk add seatd wlr-randr mesa-dri-gallium sway tinydm dbus
root> apk add wlr-randr wtype


* start seatd on boot and add "sign" to its group
* start seatd on boot and add "sign" to its group
rc-service seatd start
root> rc-service seatd start
rc-update add seatd default
root> rc-update add seatd default
adduser sign seat # grant sign access to seatd
root> adduser sign seat # grant sign access to seatd


* copy and edit sway config for user "sign"
* copy and edit sway config for user "sign"
mkdir -p /home/sign/.config/sway
root> su - sign
cp /etc/sway/config /home/sign/.config/sway
sign> mkdir -p ~/.config/sway
sign> cp /etc/sway/config ~/.config/sway
echo "
sign> echo "
# hide cursor
# hide cursor
seat seat0 hide_cursor 8000
seat seat0 hide_cursor 8000
# force fullhd
# force fullhd
output HDMI-A-1 mode 1920x1080
output HDMI-A-1 mode 1920x1080
exec /home/sign/swaystart.sh &" >> ~/.config/sway/config
exec ~/swaystart.sh &" >> ~/.config/sway/config
touch /home/sign/swaystart.sh
sign> touch ~/swaystart.sh


* setup autostart for user "sign"
* setup autostart for user "sign"
root> echo "AUTOLOGIN_UID=1000" >> /etc/conf.d/tinydm
echo "#!/bin/sh
root> rc-update add tinydm default
su -c /home/sign/autostart.sh - sign &" > /etc/local.d/user-sign.start
root> tinydm-set-session -s /usr/share/wayland-sessions/sway.desktop
rc-update add local default

* autostart sway on boot
echo "#!/bin/sh
sway &" > /home/sign/autostart.sh


* fix file permissions
* fix file permissions
chmod +x /home/sign/autostart.sh
sign> chmod +x ~/swaystart.sh
chmod +x /home/sign/swaystart.sh


* configure XDG_RUNTIME_DIR
* configure XDG_RUNTIME_DIR
echo "if test -z "${XDG_RUNTIME_DIR}"; then
sign> echo "if test -z \"\${XDG_RUNTIME_DIR}\"; then
export XDG_RUNTIME_DIR=/tmp/$(id -u)-runtime-dir
export XDG_RUNTIME_DIR=/tmp/\$(id -u)-runtime-dir
if ! test -d "${XDG_RUNTIME_DIR}"; then
if ! test -d \"\${XDG_RUNTIME_DIR}\"; then
mkdir "${XDG_RUNTIME_DIR}"
mkdir \"\${XDG_RUNTIME_DIR}\"
chmod 0700 "${XDG_RUNTIME_DIR}"
chmod 0700 \"\${XDG_RUNTIME_DIR}\"
fi
fi
fi" > /home/sign/.profile
fi" > ~/.profile


=== setup browser (chromium) ===
=== setup browser (chromium) ===
You can use pretty much any browser that supports wayland. The default is chromium.
You can use pretty much any browser that supports wayland. The default is chromium.
* install and autostart chromium
* install and autostart chromium
apk add chromium
root> apk add chromium font-noto
sign> echo "#!/bin/sh

echo "#!/bin/sh
URL=https://schlangen.bytewerk.org/watch/
chromium-browser --kiosk -incognito \
chromium-browser --kiosk -incognito \
--enable-features=UseOzonePlatform --ozone-platform=wayland \
--enable-features=UseOzonePlatform --ozone-platform=wayland \
--start-fullscreen --noerrdialogs --disable-infobars --disk-cache-dir=/dev/null \
--start-fullscreen --noerrdialogs --disable-infobars --disk-cache-dir=/dev/null \
--disk-cache-size=1 'https://example.com' &
--disk-cache-size=1 $URL &
while true; do
while true; do
# after a while all browsers begin to stutter. Here is a crude fix
# after a while all browsers begin to stutter. Here is a crude fix
sleep 600
sleep 600
WAYLAND_DISPLAY=wayland-1 wtype -P F5
WAYLAND_DISPLAY=wayland-1 wtype -P F5
done" > /home/sign/swaystart.sh
done" > ~/swaystart.sh


=== setup browser (falkon) ===
=== setup browser (falkon) ===
In case you don't want to use chromium you can also use another browser. For instance falkon.
In case you don't want to use chromium you can also use another browser. For instance falkon.
* install and autostart falkon
* install and autostart falkon
apk add falkon
sign> apk add falkon font-noto
sign> echo "#!/bin/sh

echo "#!/bin/sh
falkon -e -i -f https://example.com &
URL=http://example.com/
falkon -e -i -f $URL &
while true; do
while true; do
# after a while all browsers begin to stutter. Here is a crude fix
# after a while all browsers begin to stutter. Here is a crude fix
sleep 600
sleep 600
WAYLAND_DISPLAY=wayland-1 wtype -P F5
WAYLAND_DISPLAY=wayland-1 wtype -P F5
done" > /home/sign/swaystart.sh
done" > ~/swaystart.sh


=== setup SPN viewer ===
=== setup SPN viewer ===
apk add font-noto-emoji # for snake emojis
root> apk add font-noto-emoji # for snake emojis

Aktuelle Version vom 9. Mai 2023, 00:08 Uhr

Signage with Alpine linux on the raspberry pi

hardware

This guide works for the Raspberry Pi3 and Raspberry Pi4.

In case you want to run a viewer for Schlangenprogrammiernacht you'll need a Raspberry Pi4 as the javascript viewer ist quite demanding

setup image

  • Format SD-Card as FAT32 with a MSDOS partition table
  • Grab the base file system from the alpine linux website (pick aarch64)
  • Mount new partition and unzip archive directly to SDcard
  • umount and plug SDcard into raspberry pi
  • boot and log in as "root" without entering a password
  • Make sure the raspberry-pi is connected to the internet

prepare base system

  • start "setup-alpine"
    • select keyboard language (e.g. de-nodeadkeys)
    • choose hostname (e.g. "signage")
    • chose interface to listen for DHCP for (e.g. eth0)
    • select timezone (e.g. Europe/Berlin)
    • add user e.g. "sign"
    • Agree to install on /dev/mmcblk0p1
    • install as "sys"
  • reboot the system
  • (optional) continue via SSH
  • select correct repositories
root> apk update
root> apk add nano
root> nano /etc/apk/repositories #uncomment the community repository
root> apk update

setup base system

  • setup boot parameters
  • add file /boot/usercfg.txt with the following content
root> echo "disable_overscan=1
dtoverlay=vc4-kms-v3d
gpu_mem=128" > /boot/usercfg.txt
  • (optional) switch to udev
root> setup-devd

setup windowmanager

  • install window manager
root> apk add screen
root> apk add seatd wlr-randr mesa-dri-gallium sway tinydm dbus
root> apk add wlr-randr wtype
  • start seatd on boot and add "sign" to its group
root> rc-service seatd start
root> rc-update add seatd default
root> adduser sign seat # grant sign access to seatd
  • copy and edit sway config for user "sign"
root> su - sign
sign> mkdir -p ~/.config/sway
sign> cp /etc/sway/config ~/.config/sway
sign> echo "
# hide cursor
seat seat0 hide_cursor 8000
# force fullhd
output HDMI-A-1 mode 1920x1080
exec ~/swaystart.sh &" >> ~/.config/sway/config
sign> touch ~/swaystart.sh
  • setup autostart for user "sign"
root> echo "AUTOLOGIN_UID=1000" >> /etc/conf.d/tinydm
root> rc-update add tinydm default
root> tinydm-set-session -s /usr/share/wayland-sessions/sway.desktop
  • fix file permissions
sign> chmod +x ~/swaystart.sh
  • configure XDG_RUNTIME_DIR
sign> echo "if test -z \"\${XDG_RUNTIME_DIR}\"; then
  export XDG_RUNTIME_DIR=/tmp/\$(id -u)-runtime-dir
  if ! test -d \"\${XDG_RUNTIME_DIR}\"; then
    mkdir \"\${XDG_RUNTIME_DIR}\"
    chmod 0700 \"\${XDG_RUNTIME_DIR}\"
  fi
fi" > ~/.profile

setup browser (chromium)

You can use pretty much any browser that supports wayland. The default is chromium.

  • install and autostart chromium
root> apk add chromium font-noto
sign> echo "#!/bin/sh

URL=https://schlangen.bytewerk.org/watch/

chromium-browser --kiosk -incognito \
--enable-features=UseOzonePlatform --ozone-platform=wayland \
--start-fullscreen --noerrdialogs --disable-infobars --disk-cache-dir=/dev/null \
--disk-cache-size=1 $URL &
while true; do
  # after a while all browsers begin to stutter. Here is a crude fix
  sleep 600
  WAYLAND_DISPLAY=wayland-1 wtype -P F5
done" > ~/swaystart.sh

setup browser (falkon)

In case you don't want to use chromium you can also use another browser. For instance falkon.

  • install and autostart falkon
sign> apk add falkon font-noto
sign> echo "#!/bin/sh

URL=http://example.com/

falkon -e -i -f $URL &
while true; do
  # after a while all browsers begin to stutter. Here is a crude fix
  sleep 600
  WAYLAND_DISPLAY=wayland-1 wtype -P F5
done" > ~/swaystart.sh

setup SPN viewer

root> apk add font-noto-emoji # for snake emojis