diff --git a/distfiles/usr/local/bin/kiosk_viewhtml b/distfiles/usr/local/bin/kiosk_viewhtml index 2a02525..271b525 100755 --- a/distfiles/usr/local/bin/kiosk_viewhtml +++ b/distfiles/usr/local/bin/kiosk_viewhtml @@ -19,7 +19,7 @@ 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 +if ! chromium $chromargs $url >/dev/null 2>&1 then kiosk_cleanup.sh xmessage -buttons "Ok:1" -center "Failed to retrieve web page." diff --git a/distfiles/usr/local/bin/kiosk_viewpdf b/distfiles/usr/local/bin/kiosk_viewpdf index f397995..9c09635 100755 --- a/distfiles/usr/local/bin/kiosk_viewpdf +++ b/distfiles/usr/local/bin/kiosk_viewpdf @@ -15,7 +15,7 @@ source $conf_file if echo "$url" | grep -q '^file:' then filepath=$(echo "$server_url"|cut -d"/" -f2-) - xpdf -fullscreen -cont -z width $filepath + xpdf -fullscreen -cont -z width $filepath >/dev/null 2>&1 else if ! wget -q -O /dev/shm/target.pdf $url then @@ -23,7 +23,7 @@ else xmessage -buttons "Ok:1" -center "Failed to retrieve pdf file." exit 1 else - xpdf -fullscreen -cont -z width /dev/shm/target.pdf + xpdf -fullscreen -cont -z width /dev/shm/target.pdf >/dev/null 2>&1 fi fi diff --git a/distfiles/usr/local/bin/openkiosk b/distfiles/usr/local/bin/openkiosk index 5d26ce5..7fa0a6d 100755 --- a/distfiles/usr/local/bin/openkiosk +++ b/distfiles/usr/local/bin/openkiosk @@ -183,7 +183,7 @@ debuglog "Monitoring for URL and config file changes..." debuglog "Reading config file" source $conf_file -if ! pgrep $ALIVE_STRING +if ! pgrep $ALIVE_STRING >/dev/null 2>&1 then # relaunch application if it terminates if $krestart diff --git a/kiosk-setup.sh b/kiosk-setup.sh index 1bbb4af..4d965d9 100755 --- a/kiosk-setup.sh +++ b/kiosk-setup.sh @@ -112,27 +112,6 @@ function install_x_server() { fi } -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 > /dev/null 2>&1 - do - if add-apt-repository ppa:xtradeb/apps -y - then - echo "added chromium repository" - echo "" - else - echo "A problem was encountered during installation." - echo "the command that failed was:" - echo " add-apt-repository ppa:xtradeb/apps -y" - abort_exit - fi - apt-get update - done - echo "...done." -} - function install_webmin() { # Check for webmin installation and prompt for install echo "" @@ -331,8 +310,8 @@ function set_kiosk_url() { function set_kiosk_type() { # Prompt for kiosk type echo "" - type_choice=false - while !$type_choice + type_choice="none" + while [[ "$type_choice" == "none" ]] do echo "Will this kiosk be an interactive kiosk or a display-only kiosk?" echo -n "[I]nteractive or [D]isplay-only? [I] :" @@ -359,11 +338,60 @@ function set_kiosk_type() { ;; *) echo "Please enter I for interactive or D for display-only." + type_choice="none" ;; esac done } +function install_required_packages() { + # Positional parameters supplied to this function should be quoted + # apt-get installable package names. + # Note: Each package supplied to the for loop below can either be a + # single package name or a list of alternatives separated by the word "or". + # If supplying a list, the last one in the list will be the one that + # gets installed. + for prereq in "$@" + do + echo "Checking for $prereq installation..." + gpattern="" + for pkg_option in $(echo $prereq) + do + if [ "$pkg_option" != "or" ] + then + gpattern+=" -e $pkg_option" + preferred_pkg=$pkg_option + fi + done + if dpkg -l|grep $gpattern >/dev/null 2>&1 + then + echo "$prereq is installed. Continuing." + else + echo "$APP_NAME requires $prereq, but it doesn't seem to be installed. " + echo -n "Install $preferred_pkg now? [Y/n]: " + read reqinstall + if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ] + then + echo "$APP_NAME requires $prereq, but you have elected not to install it." + echo "Installation cannot continue." + abort_exit + else + echo "" + echo "Proceeding with $preferred_pkg installation" + echo "" + sleep 3 + apt-get install -y $preferred_pkg + echo "" + echo "Finished with $preferred_pkg installation" + echo "" + sleep 3 + + fi + fi + done +} + + # -------------- Begin execution -------------- privilege_check @@ -438,6 +466,8 @@ echo "" echo "Preparing for $kconfig installation. Please wait..." disable_unattended_upgrades +apt-get update -qq +install_required_packages "chromium" "xpdf" # Determine OS Release version echo -n "OS information: " @@ -446,7 +476,7 @@ cat /etc/os-release echo "" sleep 5 -chmod +x usr/local/bin/* +chmod +x distfiles/usr/local/bin/* case "$kconfig" in "standalone") @@ -468,7 +498,6 @@ case "$kconfig" in install_rpi5_gl fi install_x_server - install_chromium install_webmin install_cups create_standalone_user @@ -477,6 +506,10 @@ case "$kconfig" in echo "" echo "Kiosk configuration is now complete. " echo "" + echo "For standalone installation:" + echo " - You can change the configuration by editing the configuration file:" + echo " /etc/openkiosk/openkiosk.conf" + echo "" echo "The system must be rebooted for the configuration to take effect." echo "" read -p "Would you like to reboot now? [Y/n]: " -r rebootok @@ -493,15 +526,28 @@ case "$kconfig" in # Copy in the needed files echo "Copying files..." cp -vf distfiles/usr/local/bin/* /usr/local/bin + mkdir -p /etc/openkiosk 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 set_kiosk_type echo "" echo "Kiosk configuration is now complete. " echo "" + echo "For standalone installation:" + echo " - You can change the configuration by editing the configuration file:" + echo " /etc/openkiosk/openkiosk.conf" + echo " - Reboot the system to launch OpenKiosk." + echo "" + echo "For workstation installation:" + echo " - You can change the configuration by editing the configuration file:" + echo " /etc/openkiosk/openkiosk.conf" + echo " - Type openkiosk at a shell prompt to run it, or create a launcher for it." + echo " The executable is /usr/local/bin/openkiosk." + echo "" + echo "" + echo "Enjoy!" clean_exit ;; *)