Adjustments to support workstation mode

This commit is contained in:
2026-02-27 14:30:51 -05:00
parent 6dbb650431
commit 77a250ce08
14 changed files with 93 additions and 73 deletions

View File

@@ -2,8 +2,8 @@
#
# Configuration file for OpenKiosk
# Debug flag. Set to 1 to cause startkiosk.sh to output helpful
# information to ~/startkiosk.log.
# Debug flag. Set to 1 to cause openkiosk to output helpful
# information to ~/openkiosk.log.
# Set to 0 for production use, or the log could fill up your filesystem!
DEBUG="0"

View File

@@ -20,7 +20,8 @@
<p>
<b>Welcome</b><br>
Welcome to OpenKiosk. You are seeing this page because you have accepted the default URL during installation.
Obviously this is not very useful. To make it more useful, you'll need to edit the /etc/openkiosk.conf file
Obviously this is not very useful. To make it more useful, you'll need to edit the /etc/openkiosk/openkiosk.conf
file (if this is a standalone kiosk) or ~/.config/openkiosk/openkiosk.conf (if this is a workstation kiosk)
and adjust things for your needs.
</p>
<p>
@@ -28,7 +29,7 @@
To edit this file, you'll either need to ssh into the kiosk machine or use
webmin. If you elected to install webmin during OpenKiosk installation, you can
<a href="https://localhost:10000"> click here </a> to access it, then use the
File Manager tool to navigate to /etc and edit the openkiosk.conf file.
File Manager tool to navigate to /etc/openkiosk and edit the openkiosk.conf file.
The file contains descriptions of the available options.
<br>
For testing purposes, you can set the TGT_URL parameter in the openkiosk.conf file
@@ -39,8 +40,8 @@
</p>
<p>
<b>Useful Key Combinations</b><br>
Many of the normal key combinations have been disabled to prevent misuse of the kiosk. However, there are two that
you should know about.
If this is a standalone kiosk, many of the normal key combinations have been disabled to prevent misuse of the kiosk.
However, there are two that you should know about.
<br>
Pressing &lt;alt&gt;-&lt;F4&gt; will kill and restart the display app, reloading the target URL.
<br>
@@ -55,7 +56,7 @@
Click on the link
or see the LICENSE file in the distribution to read it.
<br><br>
OpenKiosk is Copyright (C) 2024 by Rod Wright.
OpenKiosk is Copyright (C) 2026 by Rod Wright.
<br>
</p>

View File

@@ -20,4 +20,4 @@ fi
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
/usr/bin/startx /etc/X11/Xsession /usr/local/bin/startkiosk.sh -- :0
/usr/bin/startx /etc/X11/Xsession /usr/local/bin/openkiosk -- :0

View File

@@ -0,0 +1,27 @@
#!/bin/bash
# kiosk_viewhtml
if [ "$1" = "" ]
then
"usage: kiosk_viewhtml <url> <config file path>"
exit 1
fi
url="$1"
conf_file="$2"
source $conf_file
if [[ "$EUID" == "0" || $(who|cut -d" " -f1) == "kioskuser" ]]
then
# Use standalone args
chromargs="--test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito"
else
# Use workstation args
chromargs="--test-type --ignore-certificate-errors --start-fullscreen --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito"
fi
if ! chromium $chromargs $url
then
kiosk_cleanup.sh
xmessage -buttons "Ok:1" -center "Failed to retrieve web page."
exit 1
fi

View File

@@ -1,15 +1,15 @@
#!/bin/bash
# kiosk_startkiosk
# openkiosk
if [[ "$EUID" == "0" || $(who|cut -d" " -f1) == "kioskuser" ]]
then
conf_file="/etc/openkiosk.conf"
conf_file="/etc/openkiosk/openkiosk.conf"
run_type="standalone"
else
if [[ ! -e "$HOME/.config/openkiosk/openkiosk.conf" ]]
then
mkdir -p $HOME/.config/openkiosk
cp /etc/openkiosk.conf $HOME/.config/openkiosk/
cp /etc/openkiosk/openkiosk.conf $HOME/.config/openkiosk/
fi
conf_file="$HOME/.config/openkiosk/openkiosk.conf"
run_type="workstation"
@@ -63,11 +63,13 @@ function check_conf() {
debuglog "Config file has changed!"
echo $new_conf_md5 > /dev/shm/curr_conf_md5.txt
debuglog "Killing application"
$KILL_CMD
krestart=true
$KILL_CMD
$CLEANUP_CMD
return 1
else
return 0
krestart=false
return 0
fi
}
@@ -96,11 +98,13 @@ function check_url() {
debuglog "URL has changed!"
echo $new_url_md5>/dev/shm/curr_url_md5.txt
debuglog "Killing application"
krestart=true
$KILL_CMD
$CLEANUP_CMD
return 1
else
return 0
krestart=false
return 0
fi
}
@@ -109,13 +113,13 @@ function debuglog() {
then
if [[ "$run_type" == "standalone" ]]
then
logfile_path="/var/log/startkiosk.log"
logfile_path="/var/log/openkiosk.log"
else
logfile_path="$HOME/startkiosk.log"
logfile_path="$HOME/openkiosk.log"
fi
if [[ ! -e "$logfile_path" ]]
then
echo "startkiosk log started : "$(date +%Y-%m-%d %H:%M:%S) > $logfile_path
echo "openkiosk log started : "$(date +%Y-%m-%d %H:%M:%S) > $logfile_path
fi
echo $(date +%H:%M:%S) "$1">>$logfile_path
fi
@@ -181,9 +185,14 @@ source $conf_file
if ! pgrep $ALIVE_STRING
then
# relaunch application if it terminates
debuglog "Restarting with command $APP_CMD"
$APP_CMD &
# relaunch application if it terminates
if $krestart
then
debuglog "Restarting with command $APP_CMD"
$APP_CMD &
else
exit 0
fi
fi
if [[ "$POLL_INTERVAL" == "0" ]]

View File

@@ -12,13 +12,13 @@ APP_VERSION="2.0.0"
function clean_exit() {
# Re-enable unattended-upgrades
if $restart_uu; then systemctl start unattended-upgrades; fi
if $restart_uu; then systemctl start unattended-upgrades >/dev/null 2>&1; fi
exit 0
}
function abort_exit() {
# Re-enable unattended-upgrades
if $restart_uu; then systemctl start unattended-upgrades; fi
if $restart_uu; then systemctl start unattended-upgrades >/dev/null 2>&1; fi
exit 1
}
@@ -45,16 +45,20 @@ function update_os() {
# Make sure OS is up to date
echo "Updating Operating System..."
sleep 5
if apt-get update && apt-get dist-upgrade -y
then
echo "...done."
echo ""
else
echo "A problem was encountered during installation."
echo "the command that failed was:"
echo " apt-get update && apt-get dist-upgrade -y"
abort_exit
fi
apt-get update -qq
if [[ "$kconfig" == "standalone" ]]
then
if apt-get dist-upgrade -y
then
echo "...done."
echo ""
else
echo "A problem was encountered during installation."
echo "the command that failed was:"
echo " apt-get update && apt-get dist-upgrade -y"
abort_exit
fi
fi
}
function remove_snap() {
@@ -112,7 +116,7 @@ function install_chromium() {
# Try to install chromium-browser package, but if that fails, add
# repository and install chromium package
echo "Installing chromium..."
while ! apt-get install -y chromium
while ! apt-get install -y chromium > /dev/null 2>&1
do
if add-apt-repository ppa:xtradeb/apps -y
then
@@ -235,7 +239,7 @@ function install_cups() {
echo ""
echo ""
echo "The cups print server has been installed."
echo "After the kiosk is set up and working, edit /etc/openkiosk.conf"
echo "After the kiosk is set up and working, edit /etc/openkiosk/openkiosk.conf"
echo "and set the TGT_URL parameter to:"
echo " https://localhost:631"
echo "to add or manage printers via the kiosk browser."
@@ -279,18 +283,18 @@ function set_kiosk_url() {
echo "back or forward in a page unless the page itself provides that"
echo "capability."
url_ok=false
server_url="file:/home/kioskuser/openkiosk_welcome.html"
while ! $url_ok
server_url="file:/etc/openkiosk/openkiosk_welcome.html"
while ! $url_ok
do
echo ""
echo "Please enter complete URL. Valid formats are:"
echo "\"http://somesite.com/somepage\""
echo "\"file:/path/to/file.name\""
echo ""
read -p "[file:/home/kioskuser/openkiosk_welcome.html] :" -r server_url
read -p "[file:/etc/openkiosk/openkiosk_welcome.html] :" -r server_url
if [[ $server_url == "" ]]
then
server_url="file:/home/kioskuser/openkiosk_welcome.html"
server_url="file:/etc/openkiosk/openkiosk_welcome.html"
fi
if [[ $server_url == "test" ]]
then
@@ -321,7 +325,7 @@ function set_kiosk_url() {
fi
fi
done
sed -i 's,'TGT_URL=.*','TGT_URL="\"$server_url\""',' /etc/openkiosk.conf
sed -i 's,'TGT_URL=.*','TGT_URL="\"$server_url\""',' /etc/openkiosk/openkiosk.conf
}
function set_kiosk_type() {
@@ -344,9 +348,9 @@ function set_kiosk_type() {
read poll_interval
echo ""
if [[ $poll_interval == "" ]]; then poll_interval=60; fi
sed -i 's,'POLL_INTERVAL=.*','POLL_INTERVAL="\"$poll_interval\""',' /etc/openkiosk.conf
sed -i 's,'POLL_INTERVAL=.*','POLL_INTERVAL="\"$poll_interval\""',' /etc/openkiosk/openkiosk.conf
echo "Disabling screen blanking."
sed -i 's,'INHIBIT_BLANK=.*','INHIBIT_BLANK="\"1\""',' /etc/openkiosk.conf
sed -i 's,'INHIBIT_BLANK=.*','INHIBIT_BLANK="\"1\""',' /etc/openkiosk/openkiosk.conf
type_choice="D"
;;
"i" | "I" | "")
@@ -375,7 +379,7 @@ continueok=false
while ! $continueok
do
read -p "Would you like to continue with OpenKiosk setup [Y/n]: " -r continueok
case "$continueok in
case "$continueok" in
"n" | "N")
echo "Cancelling setup."
clean_exit
@@ -406,8 +410,8 @@ echo "browser or pdf viewer in a full screen or windowed configuration only"
echo "on demand."
echo ""
echo "Which configuration would you like?"
kconfig=false
while ! $kconfig
kconfig="none"
while [[ "$kconfig" == "none" ]]
do
read -p "Would you like a [S]tandalone or a [W]orkstation configuration? [S/W]?: " -r kconfig
case "$kconfig" in
@@ -425,7 +429,7 @@ do
;;
*)
echo "Please enter S or W, or enter C to cancel installation."
kconfig=false
kconfig="none"
;;
esac
done
@@ -444,13 +448,13 @@ sleep 5
chmod +x usr/local/bin/*
case "$kconfig in
case "$kconfig" in
"standalone")
# Copy in the needed files
echo "Copying files..."
cp -vf usr/local/bin/* /usr/local/bin
cp -Rvf etc/* /etc/
cp -vf lib/systemd/system/getty@tty1.service /lib/systemd/system
cp -vf distfiles/usr/local/bin/* /usr/local/bin
cp -Rvf distfiles/etc/* /etc/
cp -vf distfiles/lib/systemd/system/getty@tty1.service /lib/systemd/system
rm /lib/systemd/system/ctrl-alt-del.target
ln -s /dev/null /lib/systemd/system/ctrl-alt-del.target
echo "...done."
@@ -488,8 +492,9 @@ case "$kconfig in
"workstation")
# Copy in the needed files
echo "Copying files..."
cp -vf usr/local/bin/* /usr/local/bin
cp -vf etc/openkiosk.conf /etc/
cp -vf distfiles/usr/local/bin/* /usr/local/bin
cp -vf distfiles/etc/openkiosk/openkiosk.conf /etc/openkiosk/
cp -vf distfiles/etc/openkiosk/openkiosk_welcome.html /etc/openkiosk/
install_chromium
install_cups
set_kiosk_url

View File

@@ -1,22 +0,0 @@
#!/bin/bash
# kiosk_viewhtml
if [ "$1" = "" ]
then
"usage: kiosk_viewhtml <url> <config file path>"
exit 1
fi
url="$1"
conf_file="$2"
source $conf_file
if ! chromium --test-type --ignore-certificate-errors --kiosk \
--no-first-run --check-for-update-interval=1 --simulate-upgrade \
--incognito $url
then
kiosk_cleanup.sh
xmessage -buttons "Ok:1" -center "Failed to retrieve web page."
exit 1
fi