diff --git a/etc/apt/preferences.d/nosnap.pref b/distfiles/etc/apt/preferences.d/nosnap.pref similarity index 100% rename from etc/apt/preferences.d/nosnap.pref rename to distfiles/etc/apt/preferences.d/nosnap.pref diff --git a/etc/needrestart/conf.d/no-prompt.conf b/distfiles/etc/needrestart/conf.d/no-prompt.conf similarity index 100% rename from etc/needrestart/conf.d/no-prompt.conf rename to distfiles/etc/needrestart/conf.d/no-prompt.conf diff --git a/etc/openkiosk.conf b/distfiles/etc/openkiosk/openkiosk.conf similarity index 93% rename from etc/openkiosk.conf rename to distfiles/etc/openkiosk/openkiosk.conf index a1ae485..8d01c30 100644 --- a/etc/openkiosk.conf +++ b/distfiles/etc/openkiosk/openkiosk.conf @@ -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" diff --git a/home/kioskuser/openkiosk_welcome.html b/distfiles/etc/openkiosk/openkiosk_welcome.html similarity index 80% rename from home/kioskuser/openkiosk_welcome.html rename to distfiles/etc/openkiosk/openkiosk_welcome.html index 50d9883..cf7b80e 100644 --- a/home/kioskuser/openkiosk_welcome.html +++ b/distfiles/etc/openkiosk/openkiosk_welcome.html @@ -20,7 +20,8 @@

Welcome
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.

@@ -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 click here 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.
For testing purposes, you can set the TGT_URL parameter in the openkiosk.conf file @@ -39,8 +40,8 @@

Useful Key Combinations
- 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.
Pressing <alt>-<F4> will kill and restart the display app, reloading the target URL.
@@ -55,7 +56,7 @@ Click on the link or see the LICENSE file in the distribution to read it.

- OpenKiosk is Copyright (C) 2024 by Rod Wright. + OpenKiosk is Copyright (C) 2026 by Rod Wright.

diff --git a/home/kioskuser/.config/openbox/rc.xml b/distfiles/home/kioskuser/.config/openbox/rc.xml similarity index 100% rename from home/kioskuser/.config/openbox/rc.xml rename to distfiles/home/kioskuser/.config/openbox/rc.xml diff --git a/home/kioskuser/.profile b/distfiles/home/kioskuser/.profile similarity index 90% rename from home/kioskuser/.profile rename to distfiles/home/kioskuser/.profile index f6dfaf6..649e6a3 100644 --- a/home/kioskuser/.profile +++ b/distfiles/home/kioskuser/.profile @@ -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 diff --git a/lib/systemd/system/getty@tty1.service b/distfiles/lib/systemd/system/getty@tty1.service similarity index 100% rename from lib/systemd/system/getty@tty1.service rename to distfiles/lib/systemd/system/getty@tty1.service diff --git a/usr/local/bin/cloneuser b/distfiles/usr/local/bin/cloneuser similarity index 100% rename from usr/local/bin/cloneuser rename to distfiles/usr/local/bin/cloneuser diff --git a/usr/local/bin/kiosk_cleanup b/distfiles/usr/local/bin/kiosk_cleanup similarity index 100% rename from usr/local/bin/kiosk_cleanup rename to distfiles/usr/local/bin/kiosk_cleanup diff --git a/distfiles/usr/local/bin/kiosk_viewhtml b/distfiles/usr/local/bin/kiosk_viewhtml new file mode 100755 index 0000000..2a02525 --- /dev/null +++ b/distfiles/usr/local/bin/kiosk_viewhtml @@ -0,0 +1,27 @@ +#!/bin/bash +# kiosk_viewhtml + +if [ "$1" = "" ] +then + "usage: kiosk_viewhtml " + 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 diff --git a/usr/local/bin/kiosk_viewpdf b/distfiles/usr/local/bin/kiosk_viewpdf similarity index 100% rename from usr/local/bin/kiosk_viewpdf rename to distfiles/usr/local/bin/kiosk_viewpdf diff --git a/usr/local/bin/kiosk_startkiosk b/distfiles/usr/local/bin/openkiosk similarity index 89% rename from usr/local/bin/kiosk_startkiosk rename to distfiles/usr/local/bin/openkiosk index b960b35..5d26ce5 100755 --- a/usr/local/bin/kiosk_startkiosk +++ b/distfiles/usr/local/bin/openkiosk @@ -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" ]] diff --git a/kiosk-setup.sh b/kiosk-setup.sh index ab170fe..1bbb4af 100755 --- a/kiosk-setup.sh +++ b/kiosk-setup.sh @@ -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 diff --git a/usr/local/bin/kiosk_viewhtml b/usr/local/bin/kiosk_viewhtml deleted file mode 100755 index b51ac7e..0000000 --- a/usr/local/bin/kiosk_viewhtml +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# kiosk_viewhtml - -if [ "$1" = "" ] -then - "usage: kiosk_viewhtml " - 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