Work on standalone mode
This commit is contained in:
@@ -31,7 +31,8 @@ ConditionPathExists=/dev/tty0
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
# the VT is cleared by TTYVTDisallocate
|
# the VT is cleared by TTYVTDisallocate
|
||||||
ExecStart=-/sbin/agetty -a kioskuser --noclear %I $TERM
|
ExecStart=
|
||||||
|
ExecStart=-/sbin/agetty --autologin kioskuser --noclear %I $TERM
|
||||||
Type=idle
|
Type=idle
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=0
|
RestartSec=0
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ url="$1"
|
|||||||
conf_file="$2"
|
conf_file="$2"
|
||||||
|
|
||||||
source $conf_file
|
source $conf_file
|
||||||
if [[ "$EUID" == "0" || $(who|cut -d" " -f1) == "kioskuser" ]]
|
if [[ "$EUID" == "0" || $(whoami) == "kioskuser" ]]
|
||||||
then
|
then
|
||||||
# Use standalone args
|
# Use standalone args
|
||||||
chromargs="--test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito"
|
chromargs="--test-type --ignore-certificate-errors --kiosk --no-first-run --check-for-update-interval=1 --simulate-upgrade --incognito"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# openkiosk
|
# openkiosk
|
||||||
|
|
||||||
if [[ "$EUID" == "0" || $(who|cut -d" " -f1) == "kioskuser" ]]
|
if [[ "$EUID" == "0" || $(whoami) == "kioskuser" ]]
|
||||||
then
|
then
|
||||||
conf_file="/etc/openkiosk/openkiosk.conf"
|
conf_file="/etc/openkiosk/openkiosk.conf"
|
||||||
run_type="standalone"
|
run_type="standalone"
|
||||||
@@ -111,17 +111,12 @@ function check_url() {
|
|||||||
function debuglog() {
|
function debuglog() {
|
||||||
if [[ "$DEBUG" == "1" ]]
|
if [[ "$DEBUG" == "1" ]]
|
||||||
then
|
then
|
||||||
if [[ "$run_type" == "standalone" ]]
|
logfile="$HOME/openkiosk.log"
|
||||||
|
if [[ ! -e "$logfile" ]]
|
||||||
then
|
then
|
||||||
logfile_path="/var/log/openkiosk.log"
|
echo "openkiosk log started : "$(date +%Y-%m-%d %H:%M:%S) > $logfile
|
||||||
else
|
|
||||||
logfile_path="$HOME/openkiosk.log"
|
|
||||||
fi
|
fi
|
||||||
if [[ ! -e "$logfile_path" ]]
|
echo $(date +%H:%M:%S) "$1">>$logfile
|
||||||
then
|
|
||||||
echo "openkiosk log started : "$(date +%Y-%m-%d %H:%M:%S) > $logfile_path
|
|
||||||
fi
|
|
||||||
echo $(date +%H:%M:%S) "$1">>$logfile_path
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
116
kiosk-setup.sh
116
kiosk-setup.sh
@@ -44,20 +44,23 @@ function disable_unattended_upgrades() {
|
|||||||
function update_os() {
|
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
|
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
if [[ "$kconfig" == "standalone" ]]
|
if [[ "$kconfig" == "standalone" ]]
|
||||||
then
|
then
|
||||||
if apt-get dist-upgrade -y
|
if ((apt-get dist-upgrade -y >/dev/null 2>&1)&
|
||||||
|
task_pid=$!
|
||||||
|
spinner $task_pid
|
||||||
|
unset task_pid)
|
||||||
then
|
then
|
||||||
echo "...done."
|
echo "...done."
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "A problem was encountered during installation."
|
echo "A problem was encountered during installation."
|
||||||
echo "the command that failed was:"
|
echo "the command that failed was:"
|
||||||
echo " apt-get update && apt-get dist-upgrade -y"
|
echo " apt-get dist-upgrade -y"
|
||||||
abort_exit
|
abort_exit
|
||||||
fi
|
fi
|
||||||
|
unset task_result
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,34 +85,29 @@ function remove_snap() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_rpi5_gl() {
|
function install_package() {
|
||||||
echo "Installing gl driver for Raspberry Pi 5..."
|
# Install a specified package.
|
||||||
if apt-get install -y gldriver-test
|
local pkg=$1
|
||||||
|
echo "Checking for $pkg installation..."
|
||||||
|
if dpkg -l|grep -q $pkg
|
||||||
then
|
then
|
||||||
echo "...done."
|
echo ""
|
||||||
|
echo "$pkg is installed. Continuing."
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "A problem was encountered during installation."
|
echo "Installing $pkg..."
|
||||||
echo "the command that failed was:"
|
if ! ((apt-get install -y --no-install-recommends $pkg >/dev/null 2>&1)&
|
||||||
echo " apt-get install -y gldriver-test"
|
task_pid=$!
|
||||||
abort_exit
|
spinner $task_pid
|
||||||
fi
|
unset task_pid)
|
||||||
}
|
|
||||||
|
|
||||||
function install_x_server() {
|
|
||||||
# Install X server
|
|
||||||
echo "Installing X server..."
|
|
||||||
if apt-get install -y --no-install-recommends xorg openbox xterm xpdf
|
|
||||||
then
|
then
|
||||||
echo "...done."
|
|
||||||
systemctl enable getty@tty1.service
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo "A problem was encountered during installation."
|
echo "A problem was encountered during installation."
|
||||||
echo "the command that failed was:"
|
echo "the command that failed was:"
|
||||||
echo " apt-get install -y --no-install-recommends xorg openbox"
|
echo " apt-get install -y --no-install-recommends $pkg"
|
||||||
abort_exit
|
abort_exit
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
echo "...done."
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_webmin() {
|
function install_webmin() {
|
||||||
@@ -142,7 +140,7 @@ function install_webmin() {
|
|||||||
sleep 3
|
sleep 3
|
||||||
echo "Installing webmin..."
|
echo "Installing webmin..."
|
||||||
skipwebmin="false"
|
skipwebmin="false"
|
||||||
if ! curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
|
if ! curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
echo "Warning: failed to download Webmin repo setup script."
|
echo "Warning: failed to download Webmin repo setup script."
|
||||||
echo -n "Ignore and [c]ontinue or [A]bort? [c/A]: "
|
echo -n "Ignore and [c]ontinue or [A]bort? [c/A]: "
|
||||||
@@ -161,8 +159,13 @@ function install_webmin() {
|
|||||||
fi
|
fi
|
||||||
if [ "$skipwebmin" = "false" ]
|
if [ "$skipwebmin" = "false" ]
|
||||||
then
|
then
|
||||||
sh setup-repos.sh -f
|
(
|
||||||
apt-get install -y --install-recommends webmin
|
sh setup-repos.sh -f >/dev/null 2>&1
|
||||||
|
apt-get install -y --install-recommends webmin >/dev/null 2>&1
|
||||||
|
)&
|
||||||
|
task_pid=$!
|
||||||
|
spinner $task_pid
|
||||||
|
unset task_pid
|
||||||
fi
|
fi
|
||||||
echo "...done."
|
echo "...done."
|
||||||
echo ""
|
echo ""
|
||||||
@@ -211,8 +214,11 @@ function install_cups() {
|
|||||||
echo ""
|
echo ""
|
||||||
sleep 3
|
sleep 3
|
||||||
echo "Installing cups print server..."
|
echo "Installing cups print server..."
|
||||||
apt-get install -y cups
|
(apt-get install -y cups > /dev/null 2>&1)&
|
||||||
usermod -G lpadmin $(who|cut -d" " -f1)
|
task_pid=$!
|
||||||
|
spinner $task_pid
|
||||||
|
unset task_pid
|
||||||
|
usermod -aG lpadmin $SUDO_USER
|
||||||
myhn=`hostname`
|
myhn=`hostname`
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
@@ -240,11 +246,11 @@ function create_standalone_user() {
|
|||||||
# Install standalone kiosk user config
|
# Install standalone kiosk user config
|
||||||
echo ""
|
echo ""
|
||||||
echo "Creating kiosk user..."
|
echo "Creating kiosk user..."
|
||||||
cloneuser.sh `who am i | awk '{print $1}'` kioskuser
|
cloneuser $SUDO_USER kioskuser >/dev/null 2>&1
|
||||||
mkdir -p /home/kioskuser/.config/openbox
|
mkdir -p /home/kioskuser/.config/openbox
|
||||||
cp -Rv home/kioskuser /home/
|
cp -R distfiles/home/kioskuser /home/
|
||||||
cp home/kioskuser/.profile /home/kioskuser
|
cp distfiles/home/kioskuser/.profile /home/kioskuser
|
||||||
cp home/kioskuser/.config/openbox/rc.xml /home/kioskuser/.config/openbox
|
cp distfiles/home/kioskuser/.config/openbox/rc.xml /home/kioskuser/.config/openbox
|
||||||
chown -R kioskuser:kioskuser /home/kioskuser/.config /home/kioskuser/.profile
|
chown -R kioskuser:kioskuser /home/kioskuser/.config /home/kioskuser/.profile
|
||||||
echo "...done."
|
echo "...done."
|
||||||
echo ""
|
echo ""
|
||||||
@@ -380,7 +386,10 @@ function install_required_packages() {
|
|||||||
echo "Proceeding with $preferred_pkg installation"
|
echo "Proceeding with $preferred_pkg installation"
|
||||||
echo ""
|
echo ""
|
||||||
sleep 3
|
sleep 3
|
||||||
apt-get install -y $preferred_pkg
|
(apt-get install -y $preferred_pkg > /dev/null 2>&1)&
|
||||||
|
task_pid=$!
|
||||||
|
spinner $task_pid
|
||||||
|
unset task_pid
|
||||||
echo ""
|
echo ""
|
||||||
echo "Finished with $preferred_pkg installation"
|
echo "Finished with $preferred_pkg installation"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -391,6 +400,19 @@ function install_required_packages() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function spinner() {
|
||||||
|
local pid="$1"
|
||||||
|
local delay="0.1"
|
||||||
|
local spinstr='|/-\\'
|
||||||
|
local i=0
|
||||||
|
|
||||||
|
while ps -p "$pid" > /dev/null; do
|
||||||
|
i=$(( (i+1) % 4 ))
|
||||||
|
printf "\r[%c]" "${spinstr:$i:1}"
|
||||||
|
sleep "$delay"
|
||||||
|
done
|
||||||
|
printf "\r \r" # Clear the spinner line
|
||||||
|
}
|
||||||
|
|
||||||
# -------------- Begin execution --------------
|
# -------------- Begin execution --------------
|
||||||
|
|
||||||
@@ -467,14 +489,7 @@ echo "Preparing for $kconfig installation. Please wait..."
|
|||||||
|
|
||||||
disable_unattended_upgrades
|
disable_unattended_upgrades
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
install_required_packages "chromium" "xpdf"
|
install_required_packages "rsync" "curl" "psmisc"
|
||||||
|
|
||||||
# Determine OS Release version
|
|
||||||
echo -n "OS information: "
|
|
||||||
echo ""
|
|
||||||
cat /etc/os-release
|
|
||||||
echo ""
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
chmod +x distfiles/usr/local/bin/*
|
chmod +x distfiles/usr/local/bin/*
|
||||||
|
|
||||||
@@ -482,22 +497,29 @@ case "$kconfig" in
|
|||||||
"standalone")
|
"standalone")
|
||||||
# Copy in the needed files
|
# Copy in the needed files
|
||||||
echo "Copying files..."
|
echo "Copying files..."
|
||||||
cp -vf distfiles/usr/local/bin/* /usr/local/bin
|
cp -f distfiles/usr/local/bin/* /usr/local/bin
|
||||||
cp -Rvf distfiles/etc/* /etc/
|
cp -Rf distfiles/etc/* /etc/
|
||||||
cp -vf distfiles/lib/systemd/system/getty@tty1.service /lib/systemd/system
|
cp -f 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."
|
||||||
echo ""
|
echo ""
|
||||||
update_os
|
update_os
|
||||||
remove_snap
|
remove_snap
|
||||||
|
install_package "xorg"
|
||||||
|
install_package "openbox"
|
||||||
|
install_package "xterm"
|
||||||
|
echo "Enabling autologin for standalone kiosk mode."
|
||||||
|
systemctl enable getty@tty1.service >/dev/null 2>&1
|
||||||
# If we are on a Raspberry Pi 5, we'll need to install this for the
|
# If we are on a Raspberry Pi 5, we'll need to install this for the
|
||||||
# xorg server to start
|
# xorg server to start
|
||||||
if cat /proc/cpuinfo|grep -q "Raspberry Pi 5" >/dev/null 2>&1
|
if cat /proc/cpuinfo|grep -q "Raspberry Pi 5" >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
install_rpi5_gl
|
echo "Raspberry Pi 5 detected."
|
||||||
|
install_package "gldriver-test"
|
||||||
fi
|
fi
|
||||||
install_x_server
|
install_package "chromium"
|
||||||
|
install_package "xpdf"
|
||||||
install_webmin
|
install_webmin
|
||||||
install_cups
|
install_cups
|
||||||
create_standalone_user
|
create_standalone_user
|
||||||
@@ -529,6 +551,8 @@ case "$kconfig" in
|
|||||||
mkdir -p /etc/openkiosk
|
mkdir -p /etc/openkiosk
|
||||||
cp -vf distfiles/etc/openkiosk/openkiosk.conf /etc/openkiosk/
|
cp -vf distfiles/etc/openkiosk/openkiosk.conf /etc/openkiosk/
|
||||||
cp -vf distfiles/etc/openkiosk/openkiosk_welcome.html /etc/openkiosk/
|
cp -vf distfiles/etc/openkiosk/openkiosk_welcome.html /etc/openkiosk/
|
||||||
|
install_package "chromium"
|
||||||
|
install_package "xpdf"
|
||||||
install_cups
|
install_cups
|
||||||
set_kiosk_url
|
set_kiosk_url
|
||||||
set_kiosk_type
|
set_kiosk_type
|
||||||
|
|||||||
Reference in New Issue
Block a user