[ lsmod | wc -l -lt 3 ] && { dunstify -u critical -i /usr/share/icons/oxygen/48x48/status/dialog-warning.png "Kernel version: uname -r does not match the modules version: ls /lib/modules/ | tr '\n' ' '\nPerhaps the system was booted from usb stick while older kiosk installation exist on the hard drive.\nTo force booting from removable device please install the system with following parameter added to kiosk config: 'kernel_parameters=boot_from_usb'."; sleep 60; init 0; }
Load snd-usb-audio so USB audio devices are always on the last sound card slot:
modprobe snd-usb-audio
Start battery polling:
battery=ls -1 /sys/class/power_supply/*/capacity 2>/dev/null | head -n1 | cut -d/ -f5
[ "battery" ] && sh /opt/scripts/battery_polling battery &
Disable input devices or configure them:
#disable_input=yes
if [ "line 2>/dev/null; done
else
# Set keyboard mapping:
setxkbmap -layout us,lay2 -variant ,var2 2>/dev/null
We are in the GUI - this is good, lets keep the PC running infinitely. Network issues can be resolved by 'run_command=':
[ -e /dev/watchdog ] && /usr/sbin/wd_keepalive
Launch first-run wizard:
[ -e /opt/scripts/first-run ] && su -c /opt/scripts/first-run
Wait on network connection before proceeding (skip gateway check for dialup connections):
GTW=route -n | grep -c " UG "; [ route -n | grep -c -w ppp0 = 1 ] && GTW=1
if [ GTW−lt1];thenSLEEP=120while[GTW -lt 1 -a SLEEP−gt0];do[SLEEP = 60 ] && sh /etc/rc.d/rc.inet1; sleep 1; let SLEEP=SLEEP-1; GTW=route -n | grep -c " UG "; done
fi
[ "GTW" -lt 1 ] && dunstify -u normal -i PTH/status/dialog-warning.png "Gateway is not set - network may be not available."
Pull time from NTP server and set hardware clock to system time:
( while true; do ntpdate pool.ntp.org && hwclock --utc -w; sleep 24h; done; ) &
Setup proxy auto configuration:
#proxypac=
if [ "proxypac"];thenpkgetproxypac /opt/scripts/proxy.pac
# Default to first IP in case multiple proxies are returned:
proxy=pactester -p /opt/scripts/proxy.pac -u http://porteus-kiosk.org 2>/dev/null | tr -s ' ' | cut -d" " -f2 | sed 's/[^0-9a-zA-Z.:]*//g'
[ -n "proxy"−a"proxy" != DIRECT ] && sed -i 's_^proxy=DIRECT_proxy='$proxy'_g' /etc/profile.d/proxy.sh
. /etc/profile.d/proxy.sh
fi
Perform kiosk auto reconfiguration:
[ -e /opt/scripts/update-config ] && su -c /opt/scripts/update-config
Perform kiosk auto update (paid subscription is required):
[ -e /opt/scripts/update ] && su -c /opt/scripts/update
This shell script appears to be an initialization script for a desktop session in the Porteus Kiosk, which is a specialized Linux distribution designed for web kiosks and digital signage. The script is executed when a user session starts, and it performs various configuration and setup tasks. It looks fairly comprehensive and touches upon the following areas:
Basic setup and configuration through various variables sourced from /etc/profile.d/variables.sh.
Input device configuration, keyboard mapping, mouse behavior adjustments, etc.
Screen setup, wallpaper setting, and display power management settings (dpms).
Idle behavior management to handle system freeze, standby, suspend, or shutdown based on system idleness.
Restriction of access to system directories and files for security.
Sound level setup.
Network watchdog initialization to keep the system running and addressed network issues.
Waiting on network connection before proceeding with further initializations.
Time synchronization with NTP servers.
Proxy auto-configuration if needed.
System update initiation if there's a paid subscription for updates.
SSH and VNC service startup based on configuration flags.
Tunnel service initialization.
Local network dependent commands execution.
Printer setup and configuration.
Scheduled actions and RTC (Real-Time Clock) wake configuration.
Improvements in power efficiency if applicable.
Adjustments to the homepage URL based on certain device identifiers.
Checking of homepage accessibility after the browser has started.
Bookmarks management.
Certificates import functionality.
Screensaver slideshow setup if configured.
Browser preferences setup and customization.
Handling removable device support.
Automatic toggling of browser tabs if configured.
Webpage refresh functionality.
Cleanup of temporary files and logs.
Preserving the user's home directory.
Screensaver and browser/session idle handling.
Launching the main GUI application.
This script is a nice illustration of the various tasks a kiosk-centric Linux distribution performs in the background to provide users with a streamlined and controlled environment. It's designed to only show a web browser or other predefined applications, reduce maintenance, and provide a secure browsing experience.
Remember, scripts like this should not be modified without understanding their purpose and consequences, as they handle critical configuration and system services.