Initial code drop.

This commit is contained in:
Jocelyn Le Sage 2018-02-14 20:32:28 -05:00
commit 1447b6640a
15 changed files with 685 additions and 0 deletions

View file

@ -0,0 +1,41 @@
#!/usr/bin/with-contenv sh
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.
log() {
echo "[cont-init.d] $(basename $0): $*"
}
# Make sure some directories are created.
mkdir -p /config/downloads
mkdir -p /config/log/firefox
# Generate machine id.
log "generating machine-id..."
cat /proc/sys/kernel/random/uuid | tr -d '-' > /etc/machine-id
# Verify the size of /dev/shm.
SHM_SIZE_MB="$(df -m /dev/shm | tail -n 1 | tr -s ' ' | cut -d ' ' -f2)"
if [ "$SHM_SIZE_MB" -eq 64 ]; then
echo 'FAIL' > /tmp/.firefox_shm_check
else
echo 'PASS' > /tmp/.firefox_shm_check
fi
# Clean/optimize Firefox databases.
#if [ -d /config/.mozilla/firefox ] && [ -d /config/profile ]; then
# [ -f /config/.mozilla/firefox/profiles.ini ] || cp /defaults/profiles.ini /config/.mozilla/firefox/
# env HOME=/config /usr/bin/profile-cleaner f
#fi
# Make sure monitored log files exist.
for LOG_FILE in /config/log/firefox/error.log
do
touch "$LOG_FILE"
done
# Take ownership of the config directory content.
chown -R $USER_ID:$GROUP_ID /config/*
# vim: set ft=sh :

View file

@ -0,0 +1,2 @@
#!/usr/bin/with-contenv sh
echo "$APP_NAME is likely to crash because of the lack of shared memory. Size of shared memory needs to be increased. See the documentation to find out how this can be done."

View file

@ -0,0 +1,16 @@
#!/bin/sh
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.
LINE="$1"
if [ "$LINE" = "FAIL" ]; then
echo 'ACK' > /tmp/.firefox_shm_check
exit 0
fi
# No match found.
exit 1
# vim: set ft=sh :

View file

@ -0,0 +1 @@
WARNING

View file

@ -0,0 +1,2 @@
#!/usr/bin/with-contenv sh
echo "$APP_NAME lacks of shared memory."

View file

@ -0,0 +1,2 @@
#!/usr/bin/with-contenv sh
echo "A $APP_NAME tab crashed because of the lack of shared memory. Size of shared memory needs to be increased. See the documentation to find out how this can be done."

View file

@ -0,0 +1,17 @@
#!/bin/sh
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.
LINE="$1"
#if echo "$LINE" | grep -q "OutOfMemoryError occurred...RESTARTING!"; then
if [ "$LINE" = "###!!! [Parent][MessageChannel] Error: (msgtype=0x150084,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv" ]
then
exit 0
fi
# No match found.
exit 1
# vim: set ft=sh :

View file

@ -0,0 +1 @@
ERROR

View file

@ -0,0 +1,2 @@
#!/usr/bin/with-contenv sh
echo "$APP_NAME lacks of shared memory."

4
rootfs/startapp.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
export HOME=/config
mkdir -p /config/profile
exec /usr/bin/firefox --profile /config/profile --setDefaultBrowser >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log