Compare commits

..

No commits in common. "5fdb39ea81c39402151b880748c785062c91b579" and "1d7c60ff8bd420c561a9810124b2ffcff314d778" have entirely different histories.

6 changed files with 1 additions and 149 deletions

View File

@ -2,21 +2,13 @@
[general] [general]
hostname = "kioskpi" hostname = "kioskpi"
[reboot]
; can be used to set an automatic reboot on a specific time (time in 24 horus format)
enabled=0
reboot_time = 04:00
[screen] [screen]
; can be used to force 1080p on 4k screens or workaround broken EDID communication ; can be used to force 1080p on 4k screens or workaround broken EDID communication
;force_resolution = "1920x1080" ;force_resolution = "1920x1080"
; force a custom modelines (for specialty diplays like embedded monitors, car screens, etc.) ; force a custom modelines (for specialty diplays like embedded monitors, car screens, etc.)
;custom_modeline = "40.141 1024 1032 1064 1104 600 604 612 618 +HSync -VSync" ;custom_modeline = "40.141 1024 1032 1064 1104 600 604 612 618 +HSync -VSync"
; set screen rotation to be used (normal, left, right, inverted) ; can be used for forcing screen rotation on raspberry pi boards (normal, left, right, inverted)
;rotate_screen = "normal" ;rotate_screen = "normal"
; 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
[wifi] [wifi]
; If you need more complex WiFi settings (like WPA2-Enterprise, hidden SSIDs, etc.) ; If you need more complex WiFi settings (like WPA2-Enterprise, hidden SSIDs, etc.)

View File

@ -78,9 +78,6 @@ systemctl enable ntpdate
systemctl enable lightdm systemctl enable lightdm
systemctl enable nginx systemctl enable nginx
systemctl enable ssh systemctl enable ssh
systemctl enable kiosk-sechedule-screen.service
systemctl enable schedule-reboot.service
# generate a version info/build info file # generate a version info/build info file
echo -n "Chromium version: " >> /version-info echo -n "Chromium version: " >> /version-info

View File

@ -1,11 +0,0 @@
# /etc/systemd/system/kiosk-sechedule-screen.service
[Unit]
Description=Schedule Screen On/Off Timers
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/usr/bin/schedule-screen-timers
[Install]
WantedBy=multi-user.target

View File

@ -1,10 +0,0 @@
[Unit]
Description=Schedule Reboot from kioskbrowser.ini
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/usr/bin/schedule-reboot
[Install]
WantedBy=multi-user.target

View File

@ -1,51 +0,0 @@
#!/bin/bash
INI_FILE="/boot/kioskbrowser.ini"
REBOOT_ENABLED=$(awk -F '=' '/^\[reboot\]/ { in_reboot=1; next }
in_reboot && /^\[/ { in_reboot=0 }
in_reboot && $1 ~ /enabled/ { gsub(/ /, "", $2); print $2 }' "$INI_FILE")
REBOOT_TIME=$(awk -F '=' '/^\[reboot\]/ { in_reboot=1; next }
in_reboot && /^\[/ { in_reboot=0 }
in_reboot && $1 ~ /reboot_time/ { gsub(/ /, "", $2); print $2 }' "$INI_FILE")
if [[ "$REBOOT_ENABLED" -eq 1 ]] && [[ "$REBOOT_TIME" =~ ^[0-2][0-9]:[0-5][0-9]$ ]]; then
echo "Scheduling reboot for $REBOOT_TIME..."
TARGET_TIME=$(date -d "$REBOOT_TIME" +%s)
NOW=$(date +%s)
if [ "$TARGET_TIME" -le "$NOW" ]; then
TARGET_TIME=$(date -d "tomorrow $REBOOT_TIME" +%s)
fi
TARGET_ISO=$(date -d "@$TARGET_TIME" --iso-8601=seconds)
REBOOT_UNIT="/etc/systemd/system/reboot-at.timer"
cat <<EOF > "$REBOOT_UNIT"
[Unit]
Description=One-off reboot timer
[Timer]
OnCalendar=$TARGET_ISO
Persistent=false
[Install]
WantedBy=timers.target
EOF
# Create the associated service
cat <<EOF > /etc/systemd/system/reboot-at.service
[Unit]
Description=Scheduled Reboot
[Service]
Type=oneshot
ExecStart=/sbin/reboot
EOF
systemctl daemon-reload
systemctl enable --now reboot-at.timer
else
echo "Reboot not scheduled (disabled or invalid time)"
fi

View File

@ -1,65 +0,0 @@
#!/bin/bash
INI_FILE="/boot/kioskbrowser.ini"
SYSTEMD_DIR="/etc/systemd/system"
get_ini_value() {
local section=$1 key=$2
awk -F '=' -v sec="$section" -v k="$key" '
$0 ~ /^\[.*\]/ { in_section = ($0 == "[" sec "]") }
in_section && $1 ~ "^"k"$" {
gsub(/^[ \t]+|[ \t]+$/, "", $2)
print $2
exit
}' "$INI_FILE"
}
create_recurring_timer() {
local action=$1
local time=$2
local name="screen-${action}"
echo "Setting daily screen ${action} at ${time}"
cat <<EOF > "$SYSTEMD_DIR/${name}.timer"
[Unit]
Description=Daily screen ${action} timer
[Timer]
OnCalendar=*-*-* ${time}:00
Persistent=true
[Install]
WantedBy=timers.target
EOF
cat <<EOF > "$SYSTEMD_DIR/${name}.service"
[Unit]
Description=Turn screen ${action}
[Service]
Type=oneshot
Environment=DISPLAY=:0
ExecStart=/usr/bin/xset dpms force ${action}
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
rm -f "$SYSTEMD_DIR/screen-${action}.timer" "$SYSTEMD_DIR/screen-${action}.service"
done
systemctl daemon-reload
}
# === MAIN ===
SCREEN_ON=$(get_ini_value screen screen_on_time)
SCREEN_OFF=$(get_ini_value screen screen_off_time)
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"