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 # Configuration file for OpenKiosk
# Debug flag. Set to 1 to cause startkiosk.sh to output helpful # Debug flag. Set to 1 to cause openkiosk to output helpful
# information to ~/startkiosk.log. # information to ~/openkiosk.log.
# Set to 0 for production use, or the log could fill up your filesystem! # Set to 0 for production use, or the log could fill up your filesystem!
DEBUG="0" DEBUG="0"

View File

@@ -20,7 +20,8 @@
<p> <p>
<b>Welcome</b><br> <b>Welcome</b><br>
Welcome to OpenKiosk. You are seeing this page because you have accepted the default URL during installation. 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. and adjust things for your needs.
</p> </p>
<p> <p>
@@ -28,7 +29,7 @@
To edit this file, you'll either need to ssh into the kiosk machine or use 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 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 <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. The file contains descriptions of the available options.
<br> <br>
For testing purposes, you can set the TGT_URL parameter in the openkiosk.conf file For testing purposes, you can set the TGT_URL parameter in the openkiosk.conf file
@@ -39,8 +40,8 @@
</p> </p>
<p> <p>
<b>Useful Key Combinations</b><br> <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 If this is a standalone kiosk, many of the normal key combinations have been disabled to prevent misuse of the kiosk.
you should know about. However, there are two that you should know about.
<br> <br>
Pressing &lt;alt&gt;-&lt;F4&gt; will kill and restart the display app, reloading the target URL. Pressing &lt;alt&gt;-&lt;F4&gt; will kill and restart the display app, reloading the target URL.
<br> <br>
@@ -55,7 +56,7 @@
Click on the link Click on the link
or see the LICENSE file in the distribution to read it. or see the LICENSE file in the distribution to read it.
<br><br> <br><br>
OpenKiosk is Copyright (C) 2024 by Rod Wright. OpenKiosk is Copyright (C) 2026 by Rod Wright.
<br> <br>
</p> </p>

View File

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

View File

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