adding to git.i0t.app
This commit is contained in:
85
deploy/install.sh
Executable file
85
deploy/install.sh
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install rtsp-streamer as a boot-to-wall kiosk. Run as root on the target
|
||||
# (Raspberry Pi 4 or any Linux with sway + mpv).
|
||||
#
|
||||
# sudo ./deploy/install.sh [kiosk-user]
|
||||
#
|
||||
# Steps performed:
|
||||
# * install the rtsp-streamer binary to /usr/local/bin
|
||||
# * install the kiosk sway config to /etc/rtsp-streamer/sway/config
|
||||
# * create the kiosk user (if missing) and add it to the video/render/input seats
|
||||
# * enable tty1 autologin for that user
|
||||
# * append the sway launcher to the user's ~/.bash_profile
|
||||
#
|
||||
# It does NOT install sway/mpv — do that with your distro's package manager:
|
||||
# Debian/RPi OS: apt install sway mpv foot
|
||||
# Arch: pacman -S sway mpv foot
|
||||
set -euo pipefail
|
||||
|
||||
KIOSK_USER="${1:-kiosk}"
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BIN_SRC="${REPO_DIR}/bin/rtsp-streamer"
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "error: run as root (sudo)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$BIN_SRC" ]; then
|
||||
echo "error: ${BIN_SRC} not found. Build it first: make build (native) or make pi (arm64)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ">> installing binary to /usr/local/bin/rtsp-streamer"
|
||||
install -m 0755 "$BIN_SRC" /usr/local/bin/rtsp-streamer
|
||||
|
||||
echo ">> installing sway kiosk config to /etc/rtsp-streamer/sway/config"
|
||||
install -d /etc/rtsp-streamer/sway
|
||||
install -m 0644 "${REPO_DIR}/deploy/sway/config" /etc/rtsp-streamer/sway/config
|
||||
|
||||
if ! id "$KIOSK_USER" >/dev/null 2>&1; then
|
||||
echo ">> creating user ${KIOSK_USER}"
|
||||
useradd --create-home --shell /bin/bash "$KIOSK_USER"
|
||||
fi
|
||||
echo ">> adding ${KIOSK_USER} to video/render/input groups"
|
||||
for grp in video render input seat; do
|
||||
getent group "$grp" >/dev/null 2>&1 && usermod -aG "$grp" "$KIOSK_USER" || true
|
||||
done
|
||||
|
||||
echo ">> enabling tty1 autologin for ${KIOSK_USER}"
|
||||
install -d /etc/systemd/system/getty@tty1.service.d
|
||||
sed "s/kiosk/${KIOSK_USER}/" "${REPO_DIR}/deploy/systemd/getty@tty1.service.d/autologin.conf" \
|
||||
> /etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
systemctl daemon-reload
|
||||
|
||||
HOME_DIR="$(getent passwd "$KIOSK_USER" | cut -d: -f6)"
|
||||
PROFILE="${HOME_DIR}/.bash_profile"
|
||||
MARKER="# >>> rtsp-streamer kiosk launcher >>>"
|
||||
if ! grep -qF "$MARKER" "$PROFILE" 2>/dev/null; then
|
||||
echo ">> appending sway launcher to ${PROFILE}"
|
||||
{
|
||||
echo ""
|
||||
echo "$MARKER"
|
||||
cat "${REPO_DIR}/deploy/profile-snippet.sh"
|
||||
echo "# <<< rtsp-streamer kiosk launcher <<<"
|
||||
} >> "$PROFILE"
|
||||
chown "$KIOSK_USER": "$PROFILE"
|
||||
else
|
||||
echo ">> launcher already present in ${PROFILE}, leaving it"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Done. Next steps:
|
||||
1. Put a config at ${HOME_DIR}/.config/rtsp-streamer/config.yaml
|
||||
(as ${KIOSK_USER}: rtsp-streamer config init then edit it, or run
|
||||
rtsp-streamer tui).
|
||||
2. Export the controller password for the daemon. Easiest: create
|
||||
${HOME_DIR}/.config/rtsp-streamer/env with RTSP_STREAMER_PASSWORD=...
|
||||
and source it from ~/.bash_profile before sway starts.
|
||||
3. Discover cameras: sudo -u ${KIOSK_USER} rtsp-streamer discover
|
||||
4. Reboot, or switch to tty1, to bring up the wall.
|
||||
|
||||
Make sure 'sway' and 'mpv' are installed. Verify a stream first with:
|
||||
mpv --rtsp-transport=tcp 'rtsps://HOST:7441/ALIAS?enableSrtp'
|
||||
EOF
|
||||
7
deploy/profile-snippet.sh
Normal file
7
deploy/profile-snippet.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
# rtsp-streamer kiosk launcher — appended to the kiosk user's ~/.bash_profile
|
||||
# by deploy/install.sh. Starts sway (and thus the video wall) only on the
|
||||
# physical console tty1, so SSH logins get a normal shell.
|
||||
if [ "$(tty)" = "/dev/tty1" ] && [ -z "$WAYLAND_DISPLAY" ] && [ -z "$SSH_CONNECTION" ]; then
|
||||
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
||||
exec sway -c /etc/rtsp-streamer/sway/config
|
||||
fi
|
||||
35
deploy/sway/config
Normal file
35
deploy/sway/config
Normal file
@@ -0,0 +1,35 @@
|
||||
# rtsp-streamer kiosk sway config
|
||||
#
|
||||
# Installed to /etc/rtsp-streamer/sway/config. sway is started on tty1 by the
|
||||
# autologin shell (see deploy/install.sh) and this config launches the video
|
||||
# wall daemon. The daemon inherits WAYLAND_DISPLAY and SWAYSOCK from sway, so
|
||||
# it can position mpv windows over the sway IPC.
|
||||
|
||||
### Appearance — a black, chromeless canvas for video tiles ###
|
||||
output * bg #000000 solid_color
|
||||
default_border none
|
||||
default_floating_border none
|
||||
titlebar_border_thickness 0
|
||||
gaps inner 0
|
||||
gaps outer 0
|
||||
smart_borders no
|
||||
focus_follows_mouse no
|
||||
|
||||
# Hide the pointer almost immediately; there is no keyboard/mouse on the TV.
|
||||
seat * hide_cursor 1
|
||||
|
||||
# Every mpv window should map borderless and floating so the daemon can place
|
||||
# it at an exact pixel rectangle. The daemon also sets this, belt-and-braces.
|
||||
for_window [app_id="mpv"] floating enable, border none
|
||||
|
||||
### Prevent the TV from blanking ###
|
||||
# We do NOT run swayidle, so sway will not blank the output on its own. If your
|
||||
# panel still sleeps, uncomment a keep-alive loop in a systemd timer instead.
|
||||
|
||||
### Launch the wall ###
|
||||
exec rtsp-streamer daemon --log info
|
||||
|
||||
### Emergency escape hatches (handy while setting up over a keyboard) ###
|
||||
# Super+Return opens a terminal if one is installed; Super+Shift+Q exits sway.
|
||||
bindsym Mod4+Return exec (foot || alacritty || xterm) 2>/dev/null
|
||||
bindsym Mod4+Shift+q exit
|
||||
9
deploy/systemd/getty@tty1.service.d/autologin.conf
Normal file
9
deploy/systemd/getty@tty1.service.d/autologin.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
# Autologin the kiosk user on tty1. Installed to
|
||||
# /etc/systemd/system/getty@tty1.service.d/autologin.conf
|
||||
#
|
||||
# Change "kiosk" if you use a different user. The shell profile for that user
|
||||
# (installed by deploy/install.sh) starts sway on tty1, which launches the
|
||||
# rtsp-streamer daemon.
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --autologin kiosk --noclear %I $TERM
|
||||
Reference in New Issue
Block a user