Initial code drop.
This commit is contained in:
commit
1447b6640a
15 changed files with 685 additions and 0 deletions
41
rootfs/etc/cont-init.d/firefox.sh
Executable file
41
rootfs/etc/cont-init.d/firefox.sh
Executable 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 :
|
2
rootfs/etc/logmonitor/notifications.d/shm_size/desc
Executable file
2
rootfs/etc/logmonitor/notifications.d/shm_size/desc
Executable 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."
|
16
rootfs/etc/logmonitor/notifications.d/shm_size/filter
Executable file
16
rootfs/etc/logmonitor/notifications.d/shm_size/filter
Executable 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 :
|
1
rootfs/etc/logmonitor/notifications.d/shm_size/level
Normal file
1
rootfs/etc/logmonitor/notifications.d/shm_size/level
Normal file
|
@ -0,0 +1 @@
|
|||
WARNING
|
2
rootfs/etc/logmonitor/notifications.d/shm_size/title
Executable file
2
rootfs/etc/logmonitor/notifications.d/shm_size/title
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/with-contenv sh
|
||||
echo "$APP_NAME lacks of shared memory."
|
2
rootfs/etc/logmonitor/notifications.d/tab_crash/desc
Executable file
2
rootfs/etc/logmonitor/notifications.d/tab_crash/desc
Executable 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."
|
17
rootfs/etc/logmonitor/notifications.d/tab_crash/filter
Executable file
17
rootfs/etc/logmonitor/notifications.d/tab_crash/filter
Executable 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 :
|
1
rootfs/etc/logmonitor/notifications.d/tab_crash/level
Normal file
1
rootfs/etc/logmonitor/notifications.d/tab_crash/level
Normal file
|
@ -0,0 +1 @@
|
|||
ERROR
|
2
rootfs/etc/logmonitor/notifications.d/tab_crash/title
Executable file
2
rootfs/etc/logmonitor/notifications.d/tab_crash/title
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/with-contenv sh
|
||||
echo "$APP_NAME lacks of shared memory."
|
4
rootfs/startapp.sh
Executable file
4
rootfs/startapp.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue