Compare commits

..

14 Commits
v1.0.1 ... main

10 changed files with 151 additions and 12 deletions

View File

@ -39,7 +39,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
raspberrypi:
runs-on: [self-hosted, hetzner-cax21]
runs-on: [self-hosted]
outputs:
pkgfile: ${{ steps.pkgname.outputs.pkgfile }}
@ -55,7 +55,7 @@ jobs:
- name: Build firmware
run: |
./build_raspberry_pi.sh
sudo ./build_raspberry_pi.sh
- name: Release build artifacts
uses: softprops/action-gh-release@v1

View File

@ -1,6 +1,13 @@
AnotterKiosk
N-AnotterKiosk (Not-AnotterKiosk)
=============================
### I have hacked this about alot from the main branch, mainly Raspberry Pi changes
- Removed the RO filesystem
- Added scheduled screen on/off
- Added scheduled chrome page refresh
- Rpi3 Overclock settings
- Disabled KMS driver for HW screen rotation (screen rotated portrait by default)
### Overview
Another kiosk browser OS? Yes, this one is a little bit opinionated :)

View File

@ -17,6 +17,8 @@ reboot_time = 04:00
; configure screen to power on/off as specific time of day (time format in 24 hours)
;screen_off_time=23:00
;screen_on_time=07:00
; configure chrome to refresh the page every x minutes
;refresh_screen_every_x_min=15
[wifi]
; If you need more complex WiFi settings (like WPA2-Enterprise, hidden SSIDs, etc.)

View File

@ -80,6 +80,7 @@ systemctl enable nginx
systemctl enable ssh
systemctl enable kiosk-sechedule-screen.service
systemctl enable schedule-reboot.service
systemctl enable setup-refresh-timer.service
# generate a version info/build info file

View File

@ -0,0 +1,11 @@
[Unit]
Description=Initial screen refresh timer setup
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/setup-refresh-timer
RemainAfterExit=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,4 @@
#!/bin/bash
export DISPLAY=:0
/usr/bin/xdotool key F5

15
kiosk_skeleton/usr/bin/schedule-reboot Normal file → Executable file
View File

@ -1,6 +1,16 @@
#!/bin/bash
INI_FILE="/boot/kioskbrowser.ini"
remount_root() {
local mode=$1
echo "Remounting root filesystem as $mode..."
mount -o remount,"$mode" / || {
echo "Failed to remount root as $mode"
exit 1
}
}
REBOOT_ENABLED=$(awk -F '=' '/^\[reboot\]/ { in_reboot=1; next }
in_reboot && /^\[/ { in_reboot=0 }
in_reboot && $1 ~ /enabled/ { gsub(/ /, "", $2); print $2 }' "$INI_FILE")
@ -12,6 +22,8 @@ REBOOT_TIME=$(awk -F '=' '/^\[reboot\]/ { in_reboot=1; next }
if [[ "$REBOOT_ENABLED" -eq 1 ]] && [[ "$REBOOT_TIME" =~ ^[0-2][0-9]:[0-5][0-9]$ ]]; then
echo "Scheduling reboot for $REBOOT_TIME..."
remount_root rw
TARGET_TIME=$(date -d "$REBOOT_TIME" +%s)
NOW=$(date +%s)
@ -34,7 +46,6 @@ Persistent=false
WantedBy=timers.target
EOF
# Create the associated service
cat <<EOF > /etc/systemd/system/reboot-at.service
[Unit]
Description=Scheduled Reboot
@ -46,6 +57,8 @@ EOF
systemctl daemon-reload
systemctl enable --now reboot-at.timer
remount_root ro
else
echo "Reboot not scheduled (disabled or invalid time)"
fi

32
kiosk_skeleton/usr/bin/schedule-screen-timers Normal file → Executable file
View File

@ -3,6 +3,18 @@
INI_FILE="/boot/kioskbrowser.ini"
SYSTEMD_DIR="/etc/systemd/system"
# Function to safely remount root FS
remount_root() {
local mode=$1
echo "Remounting root filesystem as $mode..."
mount -o remount,"$mode" / || {
echo "Failed to remount root as $mode"
exit 1
}
}
get_ini_value() {
local section=$1 key=$2
awk -F '=' -v sec="$section" -v k="$key" '
@ -17,6 +29,17 @@ get_ini_value() {
create_recurring_timer() {
local action=$1
local time=$2
local value
if [[ "$action" == "on" ]]; then
value=1
elif [[ "$action" == "off" ]]; then
value=0
else
echo "Invalid action: $action"
return 1
fi
local name="screen-${action}"
echo "Setting daily screen ${action} at ${time}"
@ -39,14 +62,15 @@ Description=Turn screen ${action}
[Service]
Type=oneshot
Environment=DISPLAY=:0
ExecStart=/usr/bin/xset dpms force ${action}
ExecStart=/usr/bin/vcgencmd display_power ${value}
User=pi
EOF
systemctl daemon-reload
systemctl enable --now "${name}.timer"
}
cleanup_screen_timers() {
for action in on off; do
systemctl disable --now screen-${action}.timer 2>/dev/null
@ -55,6 +79,8 @@ cleanup_screen_timers() {
systemctl daemon-reload
}
remount_root rw
# === MAIN ===
SCREEN_ON=$(get_ini_value screen screen_on_time)
SCREEN_OFF=$(get_ini_value screen screen_off_time)
@ -63,3 +89,5 @@ cleanup_screen_timers
[[ "$SCREEN_ON" =~ ^[0-2][0-9]:[0-5][0-9]$ ]] && create_recurring_timer on "$SCREEN_ON"
[[ "$SCREEN_OFF" =~ ^[0-2][0-9]:[0-5][0-9]$ ]] && create_recurring_timer off "$SCREEN_OFF"
remount_root ro

View File

@ -0,0 +1,65 @@
#!/bin/bash
INI_FILE="/boot/kioskbrowser.ini"
REFRESH_INTERVAL=$(awk -F '=' '/^\[screen\]/ { in_screen=1; next }
in_screen && /^\[/ { in_screen=0 }
in_screen && $1 ~ /refresh_screen_every_x_min/ { gsub(/ /, "", $2); print $2 }' "$INI_FILE")
# Function to safely remount root FS
remount_root() {
local mode=$1
echo "Remounting root filesystem as $mode..."
mount -o remount,"$mode" / || {
echo "Failed to remount root as $mode"
exit 1
}
}
# Safely check if REFRESH_INTERVAL is a positive integer
if [[ "$REFRESH_INTERVAL" =~ ^[0-9]+$ ]] && (( REFRESH_INTERVAL > 0 )); then
echo "Setting up screen refresh every $REFRESH_INTERVAL minutes..."
SERVICE_UNIT="/etc/systemd/system/screen-refresh.service"
TIMER_UNIT="/etc/systemd/system/screen-refresh.timer"
# Remount as read-write
remount_root rw
# Write unit files
cat <<EOF | tee "$SERVICE_UNIT" > /dev/null
[Unit]
Description=Refresh Screen
After=graphical.target
[Service]
Type=oneshot
User=pi
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
ExecStart=/usr/bin/refresh-screen
EOF
cat <<EOF | tee "$TIMER_UNIT" > /dev/null
[Unit]
Description=Run screen refresh every $REFRESH_INTERVAL minutes
[Timer]
OnBootSec=1min
OnUnitActiveSec=${REFRESH_INTERVAL}min
Persistent=false
[Install]
WantedBy=timers.target
EOF
# Reload and enable timer
systemctl daemon-reload
systemctl enable --now screen-refresh.timer
# Remount as read-only
remount_root ro
echo "Screen refresh timer setup complete."
else
echo "Invalid or missing refresh interval"
fi

View File

@ -28,11 +28,14 @@
enable_uart=1
disable_splash=1
dtparam=audio=on
gpu_mem=128
gpu_mem=256
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
#dtoverlay=vc4-kms-v3d
#max_framebuffers=2
# Rotate the screen
display_hdmi_rotate=1
# Run in 64-bit mode
arm_64bit=1
@ -46,10 +49,15 @@ disable_overscan=1
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
[pi3]
arm_freq=1350
core_freq=500
gpu_freq=500
over_voltage=4
[pi4]
# Run as fast as firmware / board allows
arm_boost=1
[all]
avoid_warnings=1