Skip to content

Commit

Permalink
Make change to work with gui module useing /opt/custompios/scripts #525
Browse files Browse the repository at this point in the history
  • Loading branch information
guysoft committed Mar 23, 2024
1 parent 06fb106 commit 73a536a
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/config
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export BASE_IMAGE_ENLARGEROOT=2000
# if set will resize root partition on image after build to minimum size +
# provided size in MB
export BASE_IMAGE_RESIZEROOT=200
export GUI_STARTUP_SCRIPT=/home/pi/scripts/run_onepageos
export GUI_STARTUP_SCRIPT=/opt/custompios/scripts/run_onepageos

export RPI_IMAGER_NAME="${DIST_NAME}"
export RPI_IMAGER_DESCRIPTION="A raspberrypi distro to display a full page browser on boot"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Geck

while true
do
if [[ $(curl -sL -b cookiefile -w "%{http_code}\\n" -H "user-agent: ${USER_AGENT}" "$(/home/pi/scripts/get_url)" -o /dev/null) =~ ^([23][0-9]{2,2}|401)$ ]] || grep -q disabled "/boot/firmware/check_for_httpd" ; then
if [[ $(curl -sL -b cookiefile -w "%{http_code}\\n" -H "user-agent: ${USER_AGENT}" "$(/opt/custompios/scripts/get_url)" -o /dev/null) =~ ^([23][0-9]{2,2}|401)$ ]] || grep -q disabled "/boot/firmware/check_for_httpd" ; then
xdotool mousemove 9000 9000
%BROWSER_START_SCRIPT%
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This script attempts a refresh, but only if the requested page returns successfully.

curl --fail "$(/home/pi/scripts/get_url)" &> /dev/null
curl --fail "$(/opt/custompios/scripts/get_url)" &> /dev/null
curlRetr="$?"

if [[ "$curlRetr" -ne "0" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ flags=(
)

# Standard behavior - runs chromium
chromium-browser "${flags[@]}" --app=$(/home/pi/scripts/get_url)
chromium-browser "${flags[@]}" --app=$(/opt/custompios/scripts/get_url)
exit;

# Remove the two lines above to enable signage mode - refresh the browser whenever errors are seen in log

chromium-browser --enable-logging --log-level=2 --v=0 "${flags[@]}" --app=$(/home/pi/scripts/get_url) &
chromium-browser --enable-logging --log-level=2 --v=0 "${flags[@]}" --app=$(/opt/custompios/scripts/get_url) &

export logfile="/home/pi/.config/chromium/chrome_debug.log"
export logfile="/home/$(id -nu 1000)/.config/chromium/chrome_debug.log"


# Refreshes after a crash by watching logs
tail -n 0 -F "$logfile" | while read LOGLINE &> /dev/null; do

echo "Refreshing after crash"
echo "Restarting at `date` after a reported crash. Logline: ${LOGLINE}" >> /tmp/crashlog
[[ ("${LOGLINE}" == *"ERROR"*) || ("${LOGLINE}" == *"FATAL"*) ]] && /home/pi/scripts/refresh
[[ ("${LOGLINE}" == *"ERROR"*) || ("${LOGLINE}" == *"FATAL"*) ]] && /home/$(id -nu 1000)/scripts/refresh

done
16 changes: 8 additions & 8 deletions src/modules/fullpageos/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -e

source /common.sh

unpack /filesystem/home/pi /home/pi pi
unpack /filesystem/opt /opt
unpack /filesystem/boot /"${BASE_BOOT_MOUNT_PATH}"
unpack /filesystem/root_init /

Expand Down Expand Up @@ -37,7 +37,7 @@ apt-get -y --force-yes install git screen checkinstall avahi-daemon libavahi-com
if [ "$FULLPAGEOS_INCLUDE_CHROMIUM" == "yes" ]
then
apt-get install -y --force-yes chromium-browser
sudo -u pi sed -i 's@%BROWSER_START_SCRIPT%@/home/pi/scripts/start_chromium_browser@g' /home/pi/scripts/run_onepageos
sed -i 's@%BROWSER_START_SCRIPT%@/opt/custompios/scripts/start_chromium_browser@g' /opt/custompios/scripts/run_onepageos
fi

#Install web stack
Expand Down Expand Up @@ -124,11 +124,11 @@ then
# Set x11vnc password
if [ "$FULLPAGEOS_OVERRIDE_PASSWORD" != "default" ]
then
sudo -u pi /home/pi/scripts/setX11vncPass "$FULLPAGEOS_OVERRIDE_PASSWORD"
sudo -u pi /opt/custompios/scripts/setX11vncPass "$FULLPAGEOS_OVERRIDE_PASSWORD"
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created. Trying again."
sudo -u pi /home/pi/scripts/setX11vncPass "$FULLPAGEOS_OVERRIDE_PASSWORD"
sudo -u pi /opt/custompios/scripts/setX11vncPass "$FULLPAGEOS_OVERRIDE_PASSWORD"
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created again. Giving up."
Expand All @@ -137,11 +137,11 @@ then
fi
fi
else
sudo -u pi /home/pi/scripts/setX11vncPass raspberry
sudo -u pi /opt/custompios/scripts/setX11vncPass raspberry
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created. Trying again."
sudo -u pi /home/pi/scripts/setX11vncPass raspberry
sudo -u pi /opt/custompios/scripts/setX11vncPass raspberry
sync
if [ ! -f /home/pi/.vnc/passwd ] || [ ! -s /home/pi/.vnc/passwd ]; then
echo "/home/pi/.vnc/passwd was not created again. Giving up."
Expand All @@ -156,8 +156,8 @@ then
systemctl enable x11vnc.service
fi

#echo "sudo -u pi startx /home/pi/scripts/run_onepageos &" >> /etc/rc.local
#echo "(sleep 15 ; sudo -u pi /home/pi/scripts/fullscreen) &" >> /etc/rc.local
#echo "sudo -u pi startx /opt/custompios/scripts/run_onepageos &" >> /etc/rc.local
#echo "(sleep 15 ; sudo -u pi /opt/custompios/scripts/fullscreen) &" >> /etc/rc.local

#####################################################################
### setup services
Expand Down

0 comments on commit 73a536a

Please sign in to comment.