Adaptations for the new baseimage version 4.

This commit is contained in:
Jocelyn Le Sage 2022-10-07 09:37:43 -04:00
parent 1b36ec0101
commit 32b23d080a
14 changed files with 52 additions and 149 deletions

View file

@ -1,22 +1,18 @@
#!/usr/bin/with-contenv sh
#!/bin/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): $*"
}
SND_DEV="/dev/snd"
if [ ! -d "$SND_DEV" ]; then
log "sound not supported: device $SND_DEV not exposed to the container."
echo "sound not supported: device $SND_DEV not exposed to the container."
exit 0
fi
# Save the associated group.
SND_GRP="$(find "$SND_DEV" -maxdepth 1 -not -type d -exec stat -c "%g" {} \; | sort -u | tail -n1)"
log "sound device group $SND_GRP."
echo "sound device group $SND_GRP."
if [ -f /var/run/s6/container_environment/SUP_GROUP_IDS ]; then
echo -n "," >> /var/run/s6/container_environment/SUP_GROUP_IDS
fi

View file

@ -1,15 +1,11 @@
#!/usr/bin/with-contenv sh
#!/bin/sh
set -e
log() {
echo "[cont-init.d] $(basename $0): $*"
}
PREF_FILE="${1:-/config/profile/prefs.js}"
if [ -z "$PREF_FILE" ]; then
log "ERROR: Preference file not set."
echo "ERROR: Preference file not set."
exit 1
fi
@ -22,7 +18,7 @@ do
EVAL="$(echo "$ENV" | cut -d '=' -f2-)"
if [ -z "$EVAL" ]; then
log "Skipping environment variable '$ENAME': no value set."
echo "Skipping environment variable '$ENAME': no value set."
continue
fi
@ -36,13 +32,13 @@ do
fi
if [ "$PVAL" = "UNSET" ]; then
log "Removing preference '$PNAME'..."
echo "Removing preference '$PNAME'..."
sed -i "/user_pref(\"$PNAME\",.*);/d" "$PREF_FILE"
elif grep -q "user_pref(\"$PNAME\"," "$PREF_FILE"; then
log "Setting preference '$PNAME'..."
echo "Setting preference '$PNAME'..."
sed -i "s/user_pref(\"$PNAME\",.*);/user_pref(\"$PNAME\", $PVAL);/" "$PREF_FILE"
else
log "Setting new preference '$PNAME'..."
echo "Setting new preference '$PNAME'..."
echo "user_pref(\"$PNAME\", $PVAL);" >> "$PREF_FILE"
fi
done

View file

@ -1,19 +1,15 @@
#!/usr/bin/with-contenv sh
#!/bin/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.
if [ ! -f /etc/machine-id ]; then
log "generating machine-id..."
echo "generating machine-id..."
cat /proc/sys/kernel/random/uuid | tr -d '-' > /etc/machine-id
fi
@ -24,12 +20,14 @@ if [ "$SHM_SIZE_MB" -eq 64 ]; then
else
echo 'SHM_CHECK_PASS' > /tmp/.firefox_shm_check
fi
chown $USER_ID:$GROUP_ID /tmp/.firefox_shm_check
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
@ -53,7 +51,7 @@ if [ -n "$(ls /config/profile/sessionstore-backups/*.jsonlz4 2>/dev/null)" ]; th
if ! diff "$WORKDIR"/json "$WORKDIR"/json.orig >/dev/null; then
jsonlz4 "$WORKDIR"/json "$WORKDIR"/jsonlz4
mv "$WORKDIR"/jsonlz4 "$FILE"
log "fixed display size in $FILE."
echo "fixed display size in $FILE."
fi
rm -r "$WORKDIR"

View file

@ -0,0 +1,2 @@
<Type>normal</Type>
<Name>^Navigator</Name>

View file

@ -1,2 +1,2 @@
#!/usr/bin/with-contenv sh
#!/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."

View file

@ -1,2 +1,2 @@
#!/usr/bin/with-contenv sh
#!/bin/sh
echo "$APP_NAME requires the membarrier system call."

View file

@ -1,2 +1,2 @@
#!/usr/bin/with-contenv sh
#!/bin/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 of the Docker container to find out how this can be done."

View file

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

View file

@ -1,2 +1,2 @@
#!/usr/bin/with-contenv sh
#!/bin/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 of this Docker container to find out how this can be done."

View file

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

14
rootfs/etc/services.d/app/kill Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
#
# When receiving SIGTERM, Firefox doesn't qui immediately and instead ask for
# confirmation. Instead, terminate Firefox by sending the CTRL+q key presses.
#
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.
xdotool key "Escape"
xdotool key "ctrl+q"
# vim:ft=sh:ts=4:sw=4:et:sts=4