make it OpenBSD compatible

This commit is contained in:
Solene Rapenne 2022-10-11 13:27:34 +02:00
parent ad0bd30642
commit 8c335981f5
1 changed files with 10 additions and 23 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/local/bin/bash
# uncomment for very verbose script debugging... # uncomment for very verbose script debugging...
#set -x #set -x
@ -7,6 +7,7 @@
# 2012-2017, Mike Gabriel <mike.gabriel@das-netzwerkteam.de> # 2012-2017, Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
# 2016, Daniel Teichmann <daniel@teichm-sh.de> # 2016, Daniel Teichmann <daniel@teichm-sh.de>
# 2017, Benjamin Schlüter <bschlueter@posteo.de> # 2017, Benjamin Schlüter <bschlueter@posteo.de>
# 2022, Solène Rapenne <solene@perso.pw>
# Surf Kiosk Display is free software; you can redistribute it and/or modify # Surf Kiosk Display is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -35,10 +36,9 @@
# #
# recommendations: # recommendations:
# unclutter # unclutter
# pulseaudio
# x11-xserver-utils # x11-xserver-utils
VERSION="0.0.5" VERSION="0.1.0"
BROWSER=surf BROWSER=surf
@ -49,9 +49,6 @@ DEFAULT_RESOLUTION=""
# all displays that need to be changed # all displays that need to be changed
declare -A DISPLAYS declare -A DISPLAYS
# launch pulseaudio daemon if not already running
WITH_PULSEAUDIO="yes"
# hide idle mouse pointer # hide idle mouse pointer
HIDE_IDLE_POINTER="yes" HIDE_IDLE_POINTER="yes"
@ -98,22 +95,10 @@ browser_lock="$workdir/.surf-lock"
browser_config_dir=`mktemp -d -p "$workdir" ${BROWSER}-display-profile-XXXXXX` browser_config_dir=`mktemp -d -p "$workdir" ${BROWSER}-display-profile-XXXXXX`
# provide pulseaudio support in the browser session, if not # launch blackbox manager
# already available...
if ! pacmd stat 1>/dev/null 2>/dev/null; then
if [ "x$WITH_PULSEAUDIO" = "xyes" ]; then
if which pulseaudio 1>/dev/null; then
pulseaudio -D -n \
-L 'module-udev-detect' \
--exit-idle-time=65535
fi
fi
fi
# launch matchbox manager
if ! wmctrl -m 1>/dev/null 2>/dev/null; then if ! wmctrl -m 1>/dev/null 2>/dev/null; then
if which matchbox-window-manager 1>/dev/null; then if which blackbox 1>/dev/null; then
matchbox-window-manager 1>/dev/null 2>/dev/null& blackbox 1>/dev/null 2>/dev/null&
fi fi
fi fi
@ -142,7 +127,7 @@ if which setxkbmap 1>/dev/null; then
fi fi
# if FAKE_HOSTNAME is not empty, use that string for hostname # if FAKE_HOSTNAME is not empty, use that string for hostname
THIS_HOSTNAME=$(hostname -f) THIS_HOSTNAME=$(hostname -s)
if [ -n "$FAKE_HOSTNAME" ]; then if [ -n "$FAKE_HOSTNAME" ]; then
THIS_HOSTNAME="$FAKE_HOSTNAME" THIS_HOSTNAME="$FAKE_HOSTNAME"
fi fi
@ -220,6 +205,7 @@ function cleanup {
} }
trap "cleanup" SIGINT SIGTERM ERR EXIT trap "cleanup" SIGINT SIGTERM ERR EXIT
# OpenBSD is currently missing xprintidle
function browser_loop { function browser_loop {
if [ "x$INACTIVITY_INTERVAL" != "x0" ]; then if [ "x$INACTIVITY_INTERVAL" != "x0" ]; then
( (
@ -304,7 +290,8 @@ if [ -n "$WWW_URI" ]; then
$OUTPUT "INFO: WWW_URI is configured. Using content from given URL: $WWW_URI" $OUTPUT "INFO: WWW_URI is configured. Using content from given URL: $WWW_URI"
create_lock create_lock
browser_loop #not available in OpenBSD yet
#browser_loop
else else