diff --git a/Dockerfile b/Dockerfile index fe8442b..f7278aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,11 +101,6 @@ RUN \ # del-pkg build-dependencies && \ # rm -rf /tmp/* /tmp/.[!.]* -# Enable log monitoring. -RUN \ - sed-patch 's|LOG_FILES=|LOG_FILES=/config/log/firefox/error.log|' /etc/logmonitor/logmonitor.conf && \ - sed-patch 's|STATUS_FILES=|STATUS_FILES=/tmp/.firefox_shm_check,/tmp/.firefox_membarrier_check|' /etc/logmonitor/logmonitor.conf - # Generate and install favicons. RUN \ APP_ICON_URL=https://github.com/jlesage/docker-templates/raw/master/jlesage/images/firefox-icon.png && \ diff --git a/rootfs/etc/cont-init.d/55-firefox.sh b/rootfs/etc/cont-init.d/55-firefox.sh index ab4a68b..49ce48d 100755 --- a/rootfs/etc/cont-init.d/55-firefox.sh +++ b/rootfs/etc/cont-init.d/55-firefox.sh @@ -17,13 +17,6 @@ fi # Copy default preferences. [ -f /config/profile/prefs.js ] || cp /defaults/prefs.js /config/profile/prefs.js -if /usr/bin/membarrier_check 2>/dev/null; then - echo 'MEMBARRIER_CHECK_PASS' > /tmp/.firefox_membarrier_check -else - echo 'MEMBARRIER_CHECK_FAIL' > /tmp/.firefox_membarrier_check -fi -chown $USER_ID:$GROUP_ID /tmp/.firefox_membarrier_check - # 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/ diff --git a/rootfs/etc/logmonitor/notifications.d/membarrier/desc b/rootfs/etc/logmonitor/notifications.d/membarrier/desc deleted file mode 100755 index 648f482..0000000 --- a/rootfs/etc/logmonitor/notifications.d/membarrier/desc +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "$APP_NAME is likely to crash because it requires the membarrier system call. See the documentation of this Docker container to find out how this system call can be allowed." diff --git a/rootfs/etc/logmonitor/notifications.d/membarrier/filter b/rootfs/etc/logmonitor/notifications.d/membarrier/filter deleted file mode 100755 index 9d76b41..0000000 --- a/rootfs/etc/logmonitor/notifications.d/membarrier/filter +++ /dev/null @@ -1,16 +0,0 @@ -#!/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" = "MEMBARRIER_CHECK_FAIL" ]; then - echo 'MEMBARRIER_CHECK_ACK' > /tmp/.firefox_membarrier_check - exit 0 -fi - -# No match found. -exit 1 - -# vim: set ft=sh : diff --git a/rootfs/etc/logmonitor/notifications.d/membarrier/level b/rootfs/etc/logmonitor/notifications.d/membarrier/level deleted file mode 100644 index e2500fa..0000000 --- a/rootfs/etc/logmonitor/notifications.d/membarrier/level +++ /dev/null @@ -1 +0,0 @@ -WARNING diff --git a/rootfs/etc/logmonitor/notifications.d/membarrier/title b/rootfs/etc/logmonitor/notifications.d/membarrier/title deleted file mode 100755 index 6f2e0da..0000000 --- a/rootfs/etc/logmonitor/notifications.d/membarrier/title +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -echo "$APP_NAME requires the membarrier system call." diff --git a/rootfs/startapp.sh b/rootfs/startapp.sh index c861cc4..8a40a61 100755 --- a/rootfs/startapp.sh +++ b/rootfs/startapp.sh @@ -5,5 +5,27 @@ set -u # Treat unset variables as an error. export HOME=/config +PIDS= + +notify() { + for N in $(ls /etc/logmonitor/targets.d/*/send) + do + "$N" "$1" "$2" "$3" & + PIDS="$PIDS $!" + done +} + +# Verify support for membarrier. +if ! /usr/bin/membarrier_check 2>/dev/null; then + notify "$APP_NAME requires the membarrier system call." "$APP_NAME is likely to crash because it requires the membarrier system call. See the documentation of this Docker container to find out how this system call can be allowed." "WARNING" +fi + +# Wait for all PIDs to terminate. +set +e +for PID in "$PIDS"; do + wait $PID +done +set -e + /usr/bin/firefox --version exec /usr/bin/firefox "$@" >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log