cleanups
This commit is contained in:
766
kiosk-setup.sh
766
kiosk-setup.sh
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# kiosk-setup.sh
|
# kiosk-setup.sh
|
||||||
# OpenKiosk Browser Terminal Setup
|
# OpenKiosk Browser Terminal Setup
|
||||||
# Copyright (C) 2024 Rod Wright
|
# Copyright (C) 2026 Rod Wright
|
||||||
|
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
@@ -41,6 +41,325 @@ function disable_unattended_upgrades() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_snap() {
|
||||||
|
# Remove snap if installed
|
||||||
|
if snap list >/dev/null 2>&1; then
|
||||||
|
echo "Removing snap..."
|
||||||
|
snap remove lxd
|
||||||
|
snap remove core20
|
||||||
|
snap remove snapd
|
||||||
|
systemctl stop snapd
|
||||||
|
systemctl disable snapd
|
||||||
|
systemctl mask snapd
|
||||||
|
apt-get purge snapd -y
|
||||||
|
apt-mark hold snapd
|
||||||
|
rm -rf /home/*/snap/
|
||||||
|
rm -rf /root/snap/
|
||||||
|
rm -rf /snap
|
||||||
|
rm -rf /var/snap
|
||||||
|
rm -rf /var/lib/snapd
|
||||||
|
echo "...done."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_rpi5_gl() {
|
||||||
|
echo "Installing gl driver for Raspberry Pi 5..."
|
||||||
|
if apt-get install -y gldriver-test
|
||||||
|
then
|
||||||
|
echo "...done."
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "A problem was encountered during installation."
|
||||||
|
echo "the command that failed was:"
|
||||||
|
echo " apt-get install -y gldriver-test"
|
||||||
|
abort_exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_x_server() {
|
||||||
|
# Install X server
|
||||||
|
echo "Installing X server..."
|
||||||
|
if apt-get install -y --no-install-recommends xorg openbox xterm xpdf
|
||||||
|
then
|
||||||
|
echo "...done."
|
||||||
|
systemctl enable getty@tty1.service
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "A problem was encountered during installation."
|
||||||
|
echo "the command that failed was:"
|
||||||
|
echo " apt-get install -y --no-install-recommends xorg openbox"
|
||||||
|
abort_exit
|
||||||
|
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
|
||||||
|
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 ""
|
||||||
|
echo "Checking for webmin installation..."
|
||||||
|
echo ""
|
||||||
|
if dpkg -l|grep webmin >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo "webmin is installed. Continuing."
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "webmin doesn't seem to be installed."
|
||||||
|
echo "It is an optional package that enables system administration"
|
||||||
|
echo "using a friendly GUI. It is highly recommended, especially for"
|
||||||
|
echo "headless servers without any way to log in directly on the machine."
|
||||||
|
echo "Note that this has the potential to be a security risk, especially"
|
||||||
|
echo "if your passwords aren't sufficiently strong."
|
||||||
|
echo -n "Install it now? [Y/n]: "
|
||||||
|
read reqinstall
|
||||||
|
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
|
||||||
|
then
|
||||||
|
echo "Proceeding without installing webmin. System administration"
|
||||||
|
echo "will require login to the server either directly or via ssh."
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Proceeding with webmin installation"
|
||||||
|
echo ""
|
||||||
|
sleep 3
|
||||||
|
echo "Installing webmin..."
|
||||||
|
skipwebmin="false"
|
||||||
|
if ! curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
|
||||||
|
then
|
||||||
|
echo "Warning: failed to download Webmin repo setup script."
|
||||||
|
echo -n "Ignore and [c]ontinue or [A]bort? [c/A]: "
|
||||||
|
read wmfailchoice
|
||||||
|
if [ "$wmfailchoice" = "C" -o "$wmfailchoice" = "c" ]
|
||||||
|
then
|
||||||
|
skipwebmin="true"
|
||||||
|
echo "Continuing without installing Webmin. You should investigate the failure"
|
||||||
|
echo "and install Webmin manually after the server is set up if you would like"
|
||||||
|
echo "to be able to manage the server from another computer with a GUI instead"
|
||||||
|
echo "of through ssh only."
|
||||||
|
echo -n "Press enter to continue."
|
||||||
|
read continueok
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$skipwebmin" = "false" ]
|
||||||
|
then
|
||||||
|
sh setup-repos.sh -f
|
||||||
|
apt-get install -y --install-recommends webmin
|
||||||
|
fi
|
||||||
|
echo "...done."
|
||||||
|
echo ""
|
||||||
|
echo "You can now access webmin using a web browser pointed to:"
|
||||||
|
echo "https://$HOSTNAME:10000"
|
||||||
|
echo "Unless you have obtained valid ssl certificates, your server is"
|
||||||
|
echo "using self-signed certs. This is not necessarily a problem, but"
|
||||||
|
echo "your browser will complain. You can tell the browser to accept the"
|
||||||
|
echo "self signed certificates and the traffic will still be encrypted,"
|
||||||
|
echo "but you may be vulnerable to man-in-the-middle attacks. You can"
|
||||||
|
echo "get free valid certificates through LetsEncrypt."
|
||||||
|
echo "See http://letsencrypt.org for more information."
|
||||||
|
echo ""
|
||||||
|
echo -n "Press enter to continue."
|
||||||
|
read continueok
|
||||||
|
echo ""
|
||||||
|
echo "Finished with webmin installation"
|
||||||
|
echo ""
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_cups() {
|
||||||
|
# Prompt whether to install print server
|
||||||
|
echo ""
|
||||||
|
echo "Checking for cups print server and driver installation..."
|
||||||
|
echo ""
|
||||||
|
if dpkg -l|grep cups-common >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo "cups is installed. Continuing."
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "The cups print server doesn't seem to be installed."
|
||||||
|
echo "If this will be an interactive kiosk and you would like to"
|
||||||
|
echo "be able to print from it, cups will need to be installed."
|
||||||
|
read -p "Install it now? [Y/n]: " -r reqinstall
|
||||||
|
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
|
||||||
|
then
|
||||||
|
echo "Proceeding without installing cups."
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Proceeding with cups installation"
|
||||||
|
echo ""
|
||||||
|
sleep 3
|
||||||
|
echo "Installing cups print server and drivers..."
|
||||||
|
apt-get install -y cups
|
||||||
|
usermod -G lpadmin $(who|cut -d" " -f1)
|
||||||
|
myhn=`hostname`
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "The cups print server has been installed."
|
||||||
|
echo "After the kiosk is set up and working, edit /etc/openkiosk.conf"
|
||||||
|
echo "and set the TGT_URL parameter to:"
|
||||||
|
echo " https://localhost:631"
|
||||||
|
echo "to add or manage printers via the kiosk browser."
|
||||||
|
echo "When you are finished, change it back to your normal URL."
|
||||||
|
echo "Note that the kiosk browser will, by default, print to the server"
|
||||||
|
echo "default printer."
|
||||||
|
echo ""
|
||||||
|
echo -n "Press enter to continue."
|
||||||
|
read continueok
|
||||||
|
echo ""
|
||||||
|
echo "Finished with cups print server installation"
|
||||||
|
echo ""
|
||||||
|
sleep 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_standalone_user() {
|
||||||
|
# Install standalone kiosk user config
|
||||||
|
echo ""
|
||||||
|
echo "Creating kiosk user..."
|
||||||
|
cloneuser.sh `who am i | awk '{print $1}'` kioskuser
|
||||||
|
mkdir -p /home/kioskuser/.config/openbox
|
||||||
|
cp -Rv home/kioskuser /home/
|
||||||
|
cp home/kioskuser/.profile /home/kioskuser
|
||||||
|
cp home/kioskuser/.config/openbox/rc.xml /home/kioskuser/.config/openbox
|
||||||
|
chown -R kioskuser:kioskuser /home/kioskuser/.config /home/kioskuser/.profile
|
||||||
|
echo "...done."
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_kiosk_url() {
|
||||||
|
# Prompt for URL
|
||||||
|
echo ""
|
||||||
|
echo "This web browser based kiosk will need to know the site you would"
|
||||||
|
echo "like to load. This can be a normal website or a file to be displayed"
|
||||||
|
echo "in the browser, but must be available as a web URL (http://something)."
|
||||||
|
echo ""
|
||||||
|
echo "Note that in kiosk mode, your normal navigation buttons and mouse"
|
||||||
|
echo "right-click menus are not available, so you will have no way to go"
|
||||||
|
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
|
||||||
|
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
|
||||||
|
if [[ $server_url == "" ]]
|
||||||
|
then
|
||||||
|
server_url="file:/home/kioskuser/openkiosk_welcome.html"
|
||||||
|
fi
|
||||||
|
if [[ $server_url == "test" ]]
|
||||||
|
then
|
||||||
|
url_ok=true
|
||||||
|
elif echo "$server_url" | grep -q '^file:'
|
||||||
|
then
|
||||||
|
filepath=$(echo "$server_url"|cut -d":" -f2-)
|
||||||
|
if [ ! -f "$filepath" ]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo "There was an error reading the file you entered. The URL must"
|
||||||
|
echo "be a complete valid path specification of the format:"
|
||||||
|
echo "\"file:/path/to/file.name\" on the kiosk's filesystem."
|
||||||
|
else
|
||||||
|
url_ok=true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! `wget --no-check-certificate -q -o /dev/null -O /dev/null $server_url`
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo "There was an error retrieving the URL you entered. The URL must"
|
||||||
|
echo "be a complete URL of the format \"http://somesite.com/somepage\"."
|
||||||
|
echo "If this URL is on the local network, try using the IP address or"
|
||||||
|
echo "the local domain. For example, instead of \"http://myserver/mypage\","
|
||||||
|
echo "try \"http://192.168.1.1/mypage\" or \"http://myserver.local/mypage\"."
|
||||||
|
else
|
||||||
|
url_ok=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
sed -i 's,'TGT_URL=.*','TGT_URL="\"$server_url\""',' /etc/openkiosk.conf
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_kiosk_type() {
|
||||||
|
# Prompt for kiosk type
|
||||||
|
echo ""
|
||||||
|
type_choice=false
|
||||||
|
while !$type_choice
|
||||||
|
do
|
||||||
|
echo "Will this kiosk be an interactive kiosk or a display-only kiosk?"
|
||||||
|
echo -n "[I]nteractive or [D]isplay-only? [I] :"
|
||||||
|
read kiosk_type
|
||||||
|
echo ""
|
||||||
|
case "$kiosk_type" in
|
||||||
|
"d" | "D")
|
||||||
|
echo "Configuring for display-only kiosk."
|
||||||
|
echo "How often would you like to check for changes to the page being"
|
||||||
|
echo "displayed? Specify the number of seconds. Enter 0 to disable"
|
||||||
|
echo "periodic checking."
|
||||||
|
echo -n "Seconds between checks? [60] :"
|
||||||
|
read poll_interval
|
||||||
|
echo ""
|
||||||
|
if [[ $poll_interval == "" ]]; then poll_interval=60; fi
|
||||||
|
sed -i 's,'POLL_INTERVAL=.*','POLL_INTERVAL="\"$poll_interval\""',' /etc/openkiosk.conf
|
||||||
|
echo "Disabling screen blanking."
|
||||||
|
sed -i 's,'INHIBIT_BLANK=.*','INHIBIT_BLANK="\"1\""',' /etc/openkiosk.conf
|
||||||
|
type_choice="D"
|
||||||
|
;;
|
||||||
|
"i" | "I" | "")
|
||||||
|
echo "Configuring for interactive kiosk."
|
||||||
|
type_choice="I"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Please enter I for interactive or D for display-only."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# -------------- Begin execution --------------
|
# -------------- Begin execution --------------
|
||||||
|
|
||||||
privilege_check
|
privilege_check
|
||||||
@@ -56,20 +375,63 @@ 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
|
||||||
if [[ $continueok == "n" || $continueok == "N" ]]
|
case "$continueok in
|
||||||
then
|
"n" | "N")
|
||||||
exit 1
|
echo "Cancelling setup."
|
||||||
elif [[ $continueok == "y" || $continueok == "Y" || $continueok == "" ]]
|
clean_exit
|
||||||
then
|
;;
|
||||||
continueok=true
|
"y" | "Y" | "")
|
||||||
echo "Continuing with OpenKiosk setup."
|
continueok=true
|
||||||
else
|
echo "Continuing with OpenKiosk setup."
|
||||||
continueok=false
|
;;
|
||||||
echo "Please answer Y (default) or N."
|
*)
|
||||||
fi
|
continueok=false
|
||||||
|
echo "Please answer Y (default) or N."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Preparing for installation. Please wait..."
|
echo "OpenKiosk can be set up as a standalone kiosk or a workstation kiosk."
|
||||||
|
echo ""
|
||||||
|
echo "A standalone kiosk will boot up to a display only or an interactive"
|
||||||
|
echo "kiosk that requires no login. This is useful for a system that is to"
|
||||||
|
echo "be used interactively by multiple people or will be in a public place"
|
||||||
|
echo "displaying automatically updating information non-interactively "
|
||||||
|
echo "(digital signage)."
|
||||||
|
echo ""
|
||||||
|
echo "A workstation kiosk is one that can be used on a normal workstation by"
|
||||||
|
echo "users who log in normally and would like to be able to run a kiosk style"
|
||||||
|
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
|
||||||
|
do
|
||||||
|
read -p "Would you like a [S]tandalone or a [W]orkstation configuration? [S/W]?: " -r kconfig
|
||||||
|
case "$kconfig" in
|
||||||
|
"s" | "S")
|
||||||
|
echo "Continuing with standalone configuration."
|
||||||
|
kconfig="standalone"
|
||||||
|
;;
|
||||||
|
"w" | "W")
|
||||||
|
echo "Continuing with workstation configuration."
|
||||||
|
kconfig="workstation"
|
||||||
|
;;
|
||||||
|
"c" | "C")
|
||||||
|
echo "Cancelling installation."
|
||||||
|
clean_exit
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Please enter S or W, or enter C to cancel installation."
|
||||||
|
kconfig=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Preparing for $kconfig installation. Please wait..."
|
||||||
|
|
||||||
disable_unattended_upgrades
|
disable_unattended_upgrades
|
||||||
|
|
||||||
@@ -80,332 +442,68 @@ cat /etc/os-release
|
|||||||
echo ""
|
echo ""
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
# Copy in the needed files
|
|
||||||
echo "Copying files..."
|
|
||||||
chmod +x usr/local/bin/*
|
chmod +x usr/local/bin/*
|
||||||
cp -Rvf etc/* /etc/
|
|
||||||
cp -vf usr/local/bin/* /usr/local/bin
|
|
||||||
cp -vf 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."
|
|
||||||
|
|
||||||
# Make sure OS is up to date
|
case "$kconfig in
|
||||||
echo "Updating Operating System..."
|
"standalone")
|
||||||
sleep 5
|
# Copy in the needed files
|
||||||
if apt-get update && apt-get dist-upgrade -y
|
echo "Copying files..."
|
||||||
then
|
cp -vf usr/local/bin/* /usr/local/bin
|
||||||
echo "...done."
|
cp -Rvf etc/* /etc/
|
||||||
echo ""
|
cp -vf lib/systemd/system/getty@tty1.service /lib/systemd/system
|
||||||
else
|
rm /lib/systemd/system/ctrl-alt-del.target
|
||||||
echo "A problem was encountered during installation."
|
ln -s /dev/null /lib/systemd/system/ctrl-alt-del.target
|
||||||
echo "the command that failed was:"
|
|
||||||
echo " apt-get update && apt-get dist-upgrade -y"
|
|
||||||
abort_exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove snap if installed
|
|
||||||
if snap list >/dev/null 2>&1; then
|
|
||||||
echo "Removing snap..."
|
|
||||||
snap remove lxd
|
|
||||||
snap remove core20
|
|
||||||
snap remove snapd
|
|
||||||
systemctl stop snapd
|
|
||||||
systemctl disable snapd
|
|
||||||
systemctl mask snapd
|
|
||||||
apt-get purge snapd -y
|
|
||||||
apt-mark hold snapd
|
|
||||||
rm -rf /home/*/snap/
|
|
||||||
rm -rf /root/snap/
|
|
||||||
rm -rf /snap
|
|
||||||
rm -rf /var/snap
|
|
||||||
rm -rf /var/lib/snapd
|
|
||||||
echo "...done."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install packages
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "Installing required kiosk packages..."
|
|
||||||
sleep 5
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# If we are on a Raspberry Pi 5, we'll need to install this for the
|
|
||||||
# xorg server to start
|
|
||||||
if cat /proc/cpuinfo|grep -q "Raspberry Pi 5" >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo "Installing gl driver for Raspberry Pi 5..."
|
|
||||||
if apt-get install -y gldriver-test
|
|
||||||
then
|
|
||||||
echo "...done."
|
echo "...done."
|
||||||
echo ""
|
echo ""
|
||||||
else
|
update_os
|
||||||
echo "A problem was encountered during installation."
|
remove_snap
|
||||||
echo "the command that failed was:"
|
# If we are on a Raspberry Pi 5, we'll need to install this for the
|
||||||
echo " apt-get install -y gldriver-test"
|
# xorg server to start
|
||||||
|
if cat /proc/cpuinfo|grep -q "Raspberry Pi 5" >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
install_rpi5_gl
|
||||||
|
fi
|
||||||
|
install_x_server
|
||||||
|
install_chromium
|
||||||
|
install_webmin
|
||||||
|
install_cups
|
||||||
|
create_standalone_user
|
||||||
|
set_kiosk_url
|
||||||
|
set_kiosk_type
|
||||||
|
echo ""
|
||||||
|
echo "Kiosk configuration is now complete. "
|
||||||
|
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
|
||||||
|
case "$rebootok" in
|
||||||
|
"y" | "Y" | "")
|
||||||
|
reboot
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
clean_exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
"workstation")
|
||||||
|
# Copy in the needed files
|
||||||
|
echo "Copying files..."
|
||||||
|
cp -vf usr/local/bin/* /usr/local/bin
|
||||||
|
cp -vf etc/openkiosk.conf /etc/
|
||||||
|
install_chromium
|
||||||
|
install_cups
|
||||||
|
set_kiosk_url
|
||||||
|
set_kiosk_type
|
||||||
|
echo ""
|
||||||
|
echo "Kiosk configuration is now complete. "
|
||||||
|
echo ""
|
||||||
|
clean_exit
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown configuration type. Aborting."
|
||||||
abort_exit
|
abort_exit
|
||||||
fi
|
;;
|
||||||
fi
|
esac
|
||||||
|
|
||||||
# Install X server
|
|
||||||
echo "Installing X server..."
|
|
||||||
if apt-get install -y --no-install-recommends xorg openbox xterm xpdf
|
|
||||||
then
|
|
||||||
echo "...done."
|
|
||||||
systemctl enable getty@tty1.service
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo "A problem was encountered during installation."
|
|
||||||
echo "the command that failed was:"
|
|
||||||
echo " apt-get install -y --no-install-recommends xorg openbox"
|
|
||||||
abort_exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try to install chromium-browser package, but if that fails, add
|
|
||||||
# repository and install chromium package
|
|
||||||
while ! apt-get install -y chromium
|
|
||||||
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 " apt-get install -y gldriver-test"
|
|
||||||
abort_exit
|
|
||||||
fi
|
|
||||||
apt-get update
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check for webmin installation and prompt for install
|
|
||||||
echo ""
|
|
||||||
echo "Checking for webmin installation..."
|
|
||||||
echo ""
|
|
||||||
if dpkg -l|grep webmin >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
echo "webmin is installed. Continuing."
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo "webmin doesn't seem to be installed."
|
|
||||||
echo "It is an optional package that enables system administration"
|
|
||||||
echo "using a friendly GUI. It is highly recommended, especially for"
|
|
||||||
echo "headless servers without any way to log in directly on the machine."
|
|
||||||
echo "Note that this has the potential to be a security risk, especially"
|
|
||||||
echo "if your passwords aren't sufficiently strong."
|
|
||||||
echo -n "Install it now? [Y/n]: "
|
|
||||||
read reqinstall
|
|
||||||
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
|
|
||||||
then
|
|
||||||
echo "Proceeding without installing webmin. System administration"
|
|
||||||
echo "will require login to the server either directly or via ssh."
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "Proceeding with webmin installation"
|
|
||||||
echo ""
|
|
||||||
sleep 3
|
|
||||||
echo "Installing webmin..."
|
|
||||||
skipwebmin="false"
|
|
||||||
if ! curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
|
|
||||||
then
|
|
||||||
echo "Warning: failed to download Webmin repo setup script."
|
|
||||||
echo -n "Ignore and [c]ontinue or [A]bort? [c/A]: "
|
|
||||||
read wmfailchoice
|
|
||||||
if [ "$wmfailchoice" = "C" -o "$wmfailchoice" = "c" ]
|
|
||||||
then
|
|
||||||
skipwebmin="true"
|
|
||||||
echo "Continuing without installing Webmin. You should investigate the failure"
|
|
||||||
echo "and install Webmin manually after the server is set up if you would like"
|
|
||||||
echo "to be able to manage the server from another computer with a GUI instead"
|
|
||||||
echo "of through ssh only."
|
|
||||||
echo -n "Press enter to continue."
|
|
||||||
read continueok
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ "$skipwebmin" = "false" ]
|
|
||||||
then
|
|
||||||
sh setup-repos.sh -f
|
|
||||||
apt-get install -y --install-recommends webmin
|
|
||||||
fi
|
|
||||||
echo "...done."
|
|
||||||
echo ""
|
|
||||||
echo "You can now access webmin using a web browser pointed to:"
|
|
||||||
echo "https://$HOSTNAME:10000"
|
|
||||||
echo "Unless you have obtained valid ssl certificates, your server is"
|
|
||||||
echo "using self-signed certs. This is not necessarily a problem, but"
|
|
||||||
echo "your browser will complain. You can tell the browser to accept the"
|
|
||||||
echo "self signed certificates and the traffic will still be encrypted,"
|
|
||||||
echo "however you may be vulnerable to man-in-the-middle attacks. You can"
|
|
||||||
echo "get free valid certificates through LetsEncrypt."
|
|
||||||
echo "See http://letsencrypt.org for more information."
|
|
||||||
echo ""
|
|
||||||
echo -n "Press enter to continue."
|
|
||||||
read continueok
|
|
||||||
echo ""
|
|
||||||
echo "Finished with webmin installation"
|
|
||||||
echo ""
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prompt whether to install print server
|
|
||||||
echo ""
|
|
||||||
echo "Checking for cups print server and driver installation..."
|
|
||||||
echo ""
|
|
||||||
if dpkg -l|grep cups-common >/dev/null 2>&1 && \
|
|
||||||
test -f "/usr/share/cups/drv/brlaser.drv" >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
echo "cups is installed. Continuing."
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo "The cups print server or driver doesn't seem to be installed."
|
|
||||||
echo "If this will be an interactive kiosk and you would like to"
|
|
||||||
echo "be able to print from it, cups will need to be installed."
|
|
||||||
read -p "Install it now? [Y/n]: " -r reqinstall
|
|
||||||
if [ "$reqinstall" = "N" -o "$reqinstall" = "n" ]
|
|
||||||
then
|
|
||||||
echo "Proceeding without installing cups."
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "Proceeding with cups installation"
|
|
||||||
echo ""
|
|
||||||
sleep 3
|
|
||||||
echo "Installing cups print server and drivers..."
|
|
||||||
apt-get install -y cups libcups2-dev cmake
|
|
||||||
cd brlaser-master && cmake . && make && make install && cd ..
|
|
||||||
chmod -R a+w brlaser-master
|
|
||||||
usermod -G lpadmin $(who am i|cut -d" " -f1)
|
|
||||||
myhn=`hostname`
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "The cups print server has been installed."
|
|
||||||
echo "After the kiosk is set up and working, edit /etc/openkiosk.conf"
|
|
||||||
echo "and set the TGT_URL parameter to:"
|
|
||||||
echo " https://localhost:631"
|
|
||||||
echo "to add or manage printers via the kiosk browser."
|
|
||||||
echo "When you are finished, change it back to your normal URL."
|
|
||||||
echo "Note that the kiosk browser will, by default, print to the server"
|
|
||||||
echo "default printer."
|
|
||||||
echo ""
|
|
||||||
echo -n "Press enter to continue."
|
|
||||||
read continueok
|
|
||||||
echo ""
|
|
||||||
echo "Finished with cups print server installation"
|
|
||||||
echo ""
|
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install user config
|
|
||||||
echo ""
|
|
||||||
echo "Creating kiosk user..."
|
|
||||||
cloneuser.sh `who am i | awk '{print $1}'` kioskuser
|
|
||||||
mkdir -p /home/kioskuser/.config/openbox
|
|
||||||
cp -Rv home/kioskuser /home/
|
|
||||||
cp home/kioskuser/.profile /home/kioskuser
|
|
||||||
cp home/kioskuser/.config/openbox/rc.xml /home/kioskuser/.config/openbox
|
|
||||||
chown -R kioskuser:kioskuser /home/kioskuser/.config /home/kioskuser/.profile
|
|
||||||
echo "...done."
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Prompt for URL and kiosk type
|
|
||||||
echo ""
|
|
||||||
echo "This web browser based kiosk will need to know the site you would"
|
|
||||||
echo "like to load. This can be a normal website or a file to be displayed"
|
|
||||||
echo "in the browser, but must be available as a web URL (http://something)."
|
|
||||||
echo ""
|
|
||||||
echo "Note that in kiosk mode, your normal navigation buttons and mouse"
|
|
||||||
echo "right-click menus are not available, so you will have no way to go"
|
|
||||||
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
|
|
||||||
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
|
|
||||||
if [[ $server_url == "" ]]
|
|
||||||
then
|
|
||||||
server_url="file:/home/kioskuser/openkiosk_welcome.html"
|
|
||||||
fi
|
|
||||||
if [[ $server_url == "test" ]]
|
|
||||||
then
|
|
||||||
url_ok=true
|
|
||||||
elif echo "$server_url" | grep -q '^file:'
|
|
||||||
then
|
|
||||||
filepath=$(echo "$server_url"|cut -d":" -f2-)
|
|
||||||
if [ ! -f "$filepath" ]
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
echo "There was an error reading the file you entered. The URL must"
|
|
||||||
echo "be a complete valid path specification of the format:"
|
|
||||||
echo "\"file:/path/to/file.name\" on the kiosk's filesystem."
|
|
||||||
else
|
|
||||||
url_ok=true
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if ! `wget --no-check-certificate -q -o /dev/null -O /dev/null $server_url`
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
echo "There was an error retrieving the URL you entered. The URL must"
|
|
||||||
echo "be a complete URL of the format \"http://somesite.com/somepage\"."
|
|
||||||
echo "If this URL is on the local network, try using the IP address or"
|
|
||||||
echo "the local domain. For example, instead of \"http://myserver/mypage\","
|
|
||||||
echo "try \"http://192.168.1.1/mypage\" or \"http://myserver.local/mypage\"."
|
|
||||||
else
|
|
||||||
url_ok=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
sed -i 's,'TGT_URL=.*','TGT_URL="\"$server_url\""',' /etc/openkiosk.conf
|
|
||||||
echo ""
|
|
||||||
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] :"
|
|
||||||
read kiosk_type
|
|
||||||
echo ""
|
|
||||||
if [[ $kiosk_type == "D" || $kiosk_type == "d" ]]
|
|
||||||
then
|
|
||||||
echo "Configuring for display-only kiosk."
|
|
||||||
echo "How often would you like to check for changes to the page being"
|
|
||||||
echo "displayed? Specify the number of seconds. Enter 0 to disable"
|
|
||||||
echo "periodic checking."
|
|
||||||
echo -n "Seconds between checks? [60] :"
|
|
||||||
read poll_interval
|
|
||||||
echo ""
|
|
||||||
if [[ $poll_interval == "" ]]; then poll_interval=60; fi
|
|
||||||
sed -i 's,'POLL_INTERVAL=.*','POLL_INTERVAL="\"$poll_interval\""',' /etc/openkiosk.conf
|
|
||||||
echo "Disabling screen blanking."
|
|
||||||
sed -i 's,'INHIBIT_BLANK=.*','INHIBIT_BLANK="\"1\""',' /etc/openkiosk.conf
|
|
||||||
type_choice="D"
|
|
||||||
elif [[ $kiosk_type == "I" || $kiosk_type = "i" || $kiosk_type == "" ]]
|
|
||||||
then
|
|
||||||
echo "Configuring for interactive kiosk."
|
|
||||||
type_choice="I"
|
|
||||||
else
|
|
||||||
echo "Please enter I for interactive or D for display-only."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo ""
|
|
||||||
echo "Kiosk configuration is now complete. "
|
|
||||||
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
|
|
||||||
if [[ $rebootok == "Y" || $rebootok == "y" || $rebootok == "" ]]
|
|
||||||
then
|
|
||||||
reboot
|
|
||||||
else
|
|
||||||
clean_exit
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# kiosk_cleanup
|
# kiosk_cleanup
|
||||||
|
|
||||||
rm -rf /home/kioskuser/.{config,cache}/chromium/
|
rm -rf $HOME/.{config,cache}/chromium/
|
||||||
rm -rf /dev/shm/target.pdf
|
rm -rf /dev/shm/target.pdf
|
||||||
pkill xmessage
|
pkill xmessage
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# kiosk_startkiosk
|
# kiosk_startkiosk
|
||||||
|
|
||||||
source /etc/openkiosk.conf
|
if [[ "$EUID" == "0" || $(who|cut -d" " -f1) == "kioskuser" ]]
|
||||||
|
then
|
||||||
|
conf_file="/etc/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/
|
||||||
|
fi
|
||||||
|
conf_file="$HOME/.config/openkiosk/openkiosk.conf"
|
||||||
|
run_type="workstation"
|
||||||
|
fi
|
||||||
|
if [[ ! -e "$conf_file" ]]
|
||||||
|
then
|
||||||
|
echo "Couldn't find config file. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source $conf_file
|
||||||
|
|
||||||
|
|
||||||
function set_commands() {
|
function set_commands() {
|
||||||
source /etc/openkiosk.conf
|
source $conf_file
|
||||||
if [[ $TGT_URL == "test" ]]
|
if [[ $TGT_URL == "test" ]]
|
||||||
then
|
then
|
||||||
# Enter test mode
|
# Enter test mode
|
||||||
@@ -16,29 +36,29 @@ function set_commands() {
|
|||||||
elif echo "$TGT_URL" | grep -q '\.pdf$'
|
elif echo "$TGT_URL" | grep -q '\.pdf$'
|
||||||
then
|
then
|
||||||
# The URL is a pdf file
|
# The URL is a pdf file
|
||||||
APP_CMD="viewpdf.sh $TGT_URL"
|
APP_CMD="kiosk_viewpdf $TGT_URL"
|
||||||
ALIVE_STRING="xpdf"
|
ALIVE_STRING="xpdf"
|
||||||
KILL_CMD="pkill xpdf"
|
KILL_CMD="pkill xpdf"
|
||||||
CLEANUP_CMD="kiosk_cleanup.sh"
|
CLEANUP_CMD="kiosk_cleanup"
|
||||||
debuglog "URL is a pdf file. Command is $PDF_APP_CMD"
|
debuglog "URL is a pdf file. Command is $PDF_APP_CMD"
|
||||||
else
|
else
|
||||||
# Assume the URL returns HTML
|
# Assume the URL returns HTML
|
||||||
APP_CMD="viewhtml.sh $TGT_URL"
|
APP_CMD="kiosk_viewhtml $TGT_URL"
|
||||||
ALIVE_STRING="chromium"
|
ALIVE_STRING="chromium"
|
||||||
KILL_CMD="pkill chromium"
|
KILL_CMD="pkill chromium"
|
||||||
CLEANUP_CMD="kiosk_cleanup.sh"
|
CLEANUP_CMD="kiosk_cleanup"
|
||||||
debuglog "URL is an HTML file. Command is $HTML_APP_CMD"
|
debuglog "URL is an HTML file. Command is $HTML_APP_CMD"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_conf() {
|
function check_conf() {
|
||||||
debuglog "Checking configuration file for changes."
|
debuglog "Checking configuration file for changes."
|
||||||
new_conf_md5=`md5sum /etc/openkiosk.conf|cut -d " " -f1`
|
new_conf_md5=$(md5sum $conf_file|cut -d " " -f1)
|
||||||
debuglog "New config file checksum: $new_conf_md5"
|
debuglog "New config file checksum: $new_conf_md5"
|
||||||
curr_conf_md5=`cat /dev/shm/curr_conf_md5.txt`
|
curr_conf_md5=$(cat /dev/shm/curr_conf_md5.txt)
|
||||||
debuglog "Current config file checksum: $curr_conf_md5"
|
debuglog "Current config file checksum: $curr_conf_md5"
|
||||||
diff <(echo $new_conf_md5) <(echo $curr_conf_md5) >/dev/null 2>&1
|
diff <(echo $new_conf_md5) <(echo $curr_conf_md5) >/dev/null 2>&1
|
||||||
if [ "$?" -eq "1" ]
|
if [[ "$?" == "1" ]]
|
||||||
then
|
then
|
||||||
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
|
||||||
@@ -59,19 +79,19 @@ function check_url() {
|
|||||||
fi
|
fi
|
||||||
if echo "$TGT_URL"|grep -q '^http'
|
if echo "$TGT_URL"|grep -q '^http'
|
||||||
then
|
then
|
||||||
new_url_md5=`wget -q -o /dev/null -O - $TGT_URL|md5sum|cut -d " " -f1`
|
new_url_md5=$(wget -q -o /dev/null -O - $TGT_URL|md5sum|cut -d " " -f1)
|
||||||
elif echo "$TGT_URL"|grep -q '^file'
|
elif echo "$TGT_URL"|grep -q '^file'
|
||||||
then
|
then
|
||||||
filepath=$(echo "$TGT_URL"|cut -d":" -f2-)
|
filepath=$(echo "$TGT_URL"|cut -d":" -f2-)
|
||||||
new_url_md5=`md5sum $filepath|cut -d " " -f1`
|
new_url_md5=$(md5sum $filepath|cut -d " " -f1)
|
||||||
else
|
else
|
||||||
new_url_md5=""
|
new_url_md5=""
|
||||||
fi
|
fi
|
||||||
debuglog "New URL checksum: $new_url_md5"
|
debuglog "New URL checksum: $new_url_md5"
|
||||||
curr_url_md5=`cat /dev/shm/curr_url_md5.txt`
|
curr_url_md5=$(cat /dev/shm/curr_url_md5.txt)
|
||||||
debuglog "Current URL checksum: $curr_url_md5"
|
debuglog "Current URL checksum: $curr_url_md5"
|
||||||
diff <(echo $new_url_md5) <(echo $curr_url_md5) >/dev/null 2>&1
|
diff <(echo $new_url_md5) <(echo $curr_url_md5) >/dev/null 2>&1
|
||||||
if [ "$?" -eq "1" ]
|
if [[ "$?" == "1" ]]
|
||||||
then
|
then
|
||||||
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
|
||||||
@@ -85,18 +105,24 @@ function check_url() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function debuglog() {
|
function debuglog() {
|
||||||
if [ "$DEBUG" -eq "1" ]
|
if [[ "$DEBUG" == "1" ]]
|
||||||
then
|
then
|
||||||
if [ ! -e "/home/kioskuser/startkiosk.log" ]
|
if [[ "$run_type" == "standalone" ]]
|
||||||
then
|
then
|
||||||
echo "startkiosk log started : "`date +%Y-%m-%d %H:%M:%S` > /home/kioskuser/startkiosk.log
|
logfile_path="/var/log/startkiosk.log"
|
||||||
|
else
|
||||||
|
logfile_path="$HOME/startkiosk.log"
|
||||||
fi
|
fi
|
||||||
echo `date +%H:%M:%S` "$1">>/home/kioskuser/startkiosk.log
|
if [[ ! -e "$logfile_path" ]]
|
||||||
|
then
|
||||||
|
echo "startkiosk log started : "$(date +%Y-%m-%d %H:%M:%S) > $logfile_path
|
||||||
|
fi
|
||||||
|
echo $(date +%H:%M:%S) "$1">>$logfile_path
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_blank_params() {
|
function set_blank_params() {
|
||||||
if [ "$INHIBIT_BLANK" -eq "1" ]
|
if [[ "$INHIBIT_BLANK" == "1" ]]
|
||||||
then
|
then
|
||||||
xset s off
|
xset s off
|
||||||
xset -dpms
|
xset -dpms
|
||||||
@@ -108,20 +134,23 @@ function set_blank_params() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function set_rot_params() {
|
function set_rot_params() {
|
||||||
output_name=`xrandr --listactivemonitors|grep 0:|rev|cut -d " " -f1|rev`
|
output_name=$(xrandr --listactivemonitors|grep 0:|rev|cut -d " " -f1|rev)
|
||||||
xrandr --output $output_name --rotate "normal"
|
xrandr --output $output_name --rotate "normal"
|
||||||
sleep 1
|
sleep 1
|
||||||
xrandr --output $output_name --rotate $ROTATION
|
xrandr --output $output_name --rotate $ROTATION
|
||||||
}
|
}
|
||||||
|
|
||||||
set_commands
|
set_commands
|
||||||
openbox-session &
|
if [[ "$run_type" == "standalone" ]]
|
||||||
|
then
|
||||||
|
openbox-session &
|
||||||
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
set_blank_params
|
set_blank_params
|
||||||
pkill xpdf
|
pkill xpdf
|
||||||
pkill chromium
|
pkill chromium
|
||||||
pkill xterm
|
pkill xterm
|
||||||
kiosk_cleanup.sh
|
kiosk_cleanup
|
||||||
|
|
||||||
# start application
|
# start application
|
||||||
|
|
||||||
@@ -130,16 +159,16 @@ sleep 3
|
|||||||
|
|
||||||
if echo "$TGT_URL"|grep -q '^http'
|
if echo "$TGT_URL"|grep -q '^http'
|
||||||
then
|
then
|
||||||
new_url_md5=`wget -q -o /dev/null -O - $TGT_URL|md5sum|cut -d " " -f1`
|
new_url_md5=$(wget -q -o /dev/null -O - $TGT_URL|md5sum|cut -d " " -f1)
|
||||||
elif echo "$TGT_URL"|grep -q '^file'
|
elif echo "$TGT_URL"|grep -q '^file'
|
||||||
then
|
then
|
||||||
filepath=$(echo "$TGT_URL"|cut -d":" -f2-)
|
filepath=$(echo "$TGT_URL"|cut -d":" -f2-)
|
||||||
new_url_md5=`md5sum $filepath|cut -d " " -f1`
|
new_url_md5=$(md5sum $filepath|cut -d " " -f1)
|
||||||
else
|
else
|
||||||
new_url_md5=""
|
new_url_md5=""
|
||||||
fi
|
fi
|
||||||
echo $new_url_md5>/dev/shm/curr_url_md5.txt
|
echo $new_url_md5>/dev/shm/curr_url_md5.txt
|
||||||
new_conf_md5=`md5sum /etc/openkiosk.conf|cut -d " " -f1`
|
new_conf_md5=$(md5sum $conf_file|cut -d " " -f1)
|
||||||
echo $new_conf_md5 > /dev/shm/curr_conf_md5.txt
|
echo $new_conf_md5 > /dev/shm/curr_conf_md5.txt
|
||||||
|
|
||||||
while true
|
while true
|
||||||
@@ -148,7 +177,7 @@ do
|
|||||||
debuglog "Monitoring for URL and config file changes..."
|
debuglog "Monitoring for URL and config file changes..."
|
||||||
# Pull in changes in the configuration file
|
# Pull in changes in the configuration file
|
||||||
debuglog "Reading config file"
|
debuglog "Reading config file"
|
||||||
source /etc/openkiosk.conf
|
source $conf_file
|
||||||
|
|
||||||
if ! pgrep $ALIVE_STRING
|
if ! pgrep $ALIVE_STRING
|
||||||
then
|
then
|
||||||
@@ -157,7 +186,7 @@ then
|
|||||||
$APP_CMD &
|
$APP_CMD &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$POLL_INTERVAL" -eq "0" ]
|
if [[ "$POLL_INTERVAL" == "0" ]]
|
||||||
then
|
then
|
||||||
sleep 1
|
sleep 1
|
||||||
debuglog "Polling not enabled"
|
debuglog "Polling not enabled"
|
||||||
|
|||||||
Reference in New Issue
Block a user