Initial commit for version 1.0.0

This commit is contained in:
2026-02-24 21:24:38 -05:00
commit e2dba6ee86
33 changed files with 3836 additions and 0 deletions

19
usr/local/bin/cloneuser Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
SRC=$1
DEST=$2
SRC_GROUPS=`id -Gn ${SRC}`
SRC_SHELL=$(awk -F : -v name=${SRC} '(name == $1) { print $7 }' /etc/passwd)
RAND_PW=`date +%s | sha256sum | base64 | head -c 32 ; echo`
echo "Creating user $DEST"
useradd --shell ${SRC_SHELL} --password ${RAND_PW} --create-home ${DEST}
for grp in ${SRC_GROUPS};do
if [ "$grp" != "$SRC" ]; then
echo "Adding user $DEST to group $grp."
usermod -a -G $grp ${DEST}
fi
done

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# kiosk_cleanup.sh
rm -rf /home/customer/.{config,cache}/chromium/
rm -rf /home/customer/.cache/mozilla
rm -rf /home/customer/.mozilla
tar -C /home/customer -xf /home/customer/openkiosk_mozilla_profile.tar.gz
chown -R customer:customer /home/customer/.mozilla

116
usr/local/bin/startkiosk.sh Normal file
View File

@@ -0,0 +1,116 @@
#!/bin/bash
# startkiosk.sh
source /etc/openkiosk.conf
function check_conf() {
debuglog "Checking configuration file for changes."
new_conf_md5=`md5sum /etc/openkiosk.conf|cut -d " " -f1`
debuglog "New config file checksum: $new_conf_md5"
curr_conf_md5=`cat /home/customer/curr_conf_md5.txt`
debuglog "Current config file checksum: $curr_conf_md5"
diff <(echo $new_conf_md5) <(echo $curr_conf_md5) >/dev/null 2>&1
if [ "$?" -eq "1" ]
then
debuglog "Config file has changed!"
echo $new_conf_md5 > /home/customer/curr_conf_md5.txt
debuglog "Killing browser"
$KILL_CMD
return 1
else
return 0
fi
}
function check_url() {
debuglog "Checking URL for changes"
new_url_md5=`wget -q -o /dev/null -O - $TGT_URL|md5sum|cut -d " " -f1`
debuglog "New URL checksum: $new_url_md5"
curr_url_md5=`cat /home/customer/curr_url_md5.txt`
debuglog "Current URL checksum: $curr_url_md5"
diff <(echo $new_url_md5) <(echo $curr_url_md5) >/dev/null 2>&1
if [ "$?" -eq "1" ]
then
debuglog "URL has changed!"
echo $new_url_md5>/home/customer/curr_url_md5.txt
debuglog "Killing browser"
$KILL_CMD
return 1
else
return 0
fi
}
function debuglog() {
if [ "$DEBUG" -eq "1" ]
then
if [ ! -e "/home/customer/startkiosk.log" ]
then
echo "startkiosk log started : "`date +%Y-%m-%d %H:%M:%S` > /home/customer/startkiosk.log
fi
echo `date +%H:%M:%S` "$1">>/home/customer/startkiosk.log
fi
}
function set_blank_params() {
if [ "$INHIBIT_BLANK" -eq "1" ]
then
xset s off
xset -dpms
else
xset s off
xset +dpms
xset dpms $DSP_STBY_SEC $DSP_SUSP_SEC $DSP_OFF_SEC
fi
}
function set_rot_params() {
output_name=`xrandr --listactivemonitors|grep 0:|rev|cut -d " " -f1|rev`
xrandr --output $output_name --rotate $ROTATION
}
openbox-session &
sleep 1
set_blank_params
$KILL_CMD
$CLEANUP_CMD
# start application
$APP_CMD &
sleep 3
new_url_md5=`wget -q -o /dev/null -O - $TGT_URL|md5sum|cut -d " " -f1`
echo $new_url_md5>/home/customer/curr_url_md5.txt
new_conf_md5=`md5sum /etc/openkiosk.conf|cut -d " " -f1`
echo $new_conf_md5 > /home/customer/curr_conf_md5.txt
while true
do
debuglog "Monitoring for URL and config file changes..."
# Pull in changes in the configuration file
debuglog "Reading config file"
source /etc/openkiosk.conf
if ! pgrep $ALIVE_STRING
then
# relaunch application if it terminates
debuglog "Restarting browser"
$APP_CMD &
fi
if [ "$POLL_INTERVAL" -eq "0" ]
then
sleep 1
debuglog "Polling not enabled"
if ! check_conf; then set_blank_params;set_rot_params;fi
else
sleep $POLL_INTERVAL
debuglog "Polling enabled"
if ! check_conf; then set_blank_params;set_rot_params;fi
check_url
fi
done
exit 0