Switch to Chromium
This commit is contained in:
parent
e9df645b49
commit
d9fc5df080
8 changed files with 24 additions and 154 deletions
|
@ -1,10 +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.
|
||||
|
||||
# Override what is set by the baseimage and do not set the variable. Needed for
|
||||
# WebGL support.
|
||||
exit 100
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
|
@ -5,8 +5,7 @@ set -u # Treat unset variables as an error.
|
|||
|
||||
# Make sure some directories are created.
|
||||
mkdir -p /config/downloads
|
||||
mkdir -p /config/log/firefox
|
||||
mkdir -p /config/profile
|
||||
mkdir -p /config/log/chromium
|
||||
|
||||
# Generate machine id.
|
||||
if [ ! -f /config/machine-id ]; then
|
||||
|
@ -14,14 +13,8 @@ if [ ! -f /config/machine-id ]; then
|
|||
cat /proc/sys/kernel/random/uuid | tr -d '-' > /config/machine-id
|
||||
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
|
||||
|
||||
# Initialize log files.
|
||||
for LOG_FILE in /config/log/firefox/output.log /config/log/firefox/error.log
|
||||
for LOG_FILE in /config/log/chromium/output.log /config/log/chromium/error.log
|
||||
do
|
||||
touch "$LOG_FILE"
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
PREF_FILE="${1:-/config/profile/prefs.js}"
|
||||
|
||||
if [ -z "$PREF_FILE" ]; then
|
||||
echo "ERROR: Preference file not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$PREF_FILE")"
|
||||
[ -f "$PREF_FILE" ] || touch "$PREF_FILE"
|
||||
|
||||
env | grep "^FF_PREF_" | while read -r ENV
|
||||
do
|
||||
ENAME="$(echo "$ENV" | cut -d '=' -f1)"
|
||||
EVAL="$(echo "$ENV" | cut -d '=' -f2-)"
|
||||
|
||||
if [ -z "$EVAL" ]; then
|
||||
echo "Skipping environment variable '$ENAME': no value set."
|
||||
continue
|
||||
fi
|
||||
|
||||
if echo "$EVAL" | grep -q "="; then
|
||||
PNAME="$(echo "$EVAL" | cut -d '=' -f1)"
|
||||
PVAL="$(echo "$EVAL" | cut -d '=' -f2-)"
|
||||
[ -n "$PVAL" ] || PVAL='""'
|
||||
else
|
||||
PNAME="$EVAL"
|
||||
PVAL='""'
|
||||
fi
|
||||
|
||||
if [ "$PVAL" = "UNSET" ]; then
|
||||
echo "Removing preference '$PNAME'..."
|
||||
sed -i "/user_pref(\"$PNAME\",.*);/d" "$PREF_FILE"
|
||||
elif grep -q "user_pref(\"$PNAME\"," "$PREF_FILE"; then
|
||||
echo "Setting preference '$PNAME'..."
|
||||
sed -i "/user_pref(\"$PNAME\",.*);/d" "$PREF_FILE"
|
||||
echo "user_pref(\"$PNAME\", $(echo "$PVAL" | sed 's|\\|\\\\|g'));" >> "$PREF_FILE"
|
||||
else
|
||||
echo "Setting new preference '$PNAME'..."
|
||||
echo "user_pref(\"$PNAME\", $(echo "$PVAL" | sed 's|\\|\\\\|g'));" >> "$PREF_FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Firefox doesn't gracefully shutdown when receiving SIGTERM. For example, last
|
||||
# opened tabs may not be saved. Instead, terminate Firefox by sending the
|
||||
# Chromium doesn't gracefully shutdown when receiving SIGTERM. For example, last
|
||||
# opened tabs may not be saved. Instead, terminate Chromium by sending the
|
||||
# CTRL+q key presses.
|
||||
#
|
||||
|
||||
|
@ -14,7 +14,7 @@ xdotool key "ctrl+q"
|
|||
|
||||
for i in $(seq 1 10)
|
||||
do
|
||||
if ! ps | grep "/usr/lib/firefox/firefox" | grep -q -v grep
|
||||
if ! ps | grep "/usr/lib/chromium/chromium" | grep -q -v grep
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
|
|
@ -3,25 +3,8 @@
|
|||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
set -u # Treat unset variables as an error.
|
||||
|
||||
# Set location of profile.
|
||||
echo "--profile"
|
||||
echo "/config/profile"
|
||||
# Always make browser take up full screen
|
||||
echo "--start-maximized"
|
||||
|
||||
# Make sure we don't get ask to be the default browser.
|
||||
echo "--setDefaultBrowser"
|
||||
|
||||
# Check if kiosk mode is enabled.
|
||||
if is-bool-val-true "${FF_KIOSK:-0}"; then
|
||||
echo "--kiosk"
|
||||
fi
|
||||
|
||||
# URL to open.
|
||||
# NOTE: This should be the last argument.
|
||||
if [ -n "${FF_OPEN_URL:-}" ]; then
|
||||
echo "$FF_OPEN_URL"
|
||||
fi
|
||||
|
||||
# Custom arguments.
|
||||
if [ -n "${FF_CUSTOM_ARGS:-}" ]; then
|
||||
eval 'for word in '$FF_CUSTOM_ARGS'; do echo "$word"; done'
|
||||
fi
|
||||
# Disable sandboxing, which isn't supported in containers
|
||||
echo "--no-sandbox"
|
||||
|
|
|
@ -27,7 +27,7 @@ for PID in "$PIDS"; do
|
|||
done
|
||||
set -e
|
||||
|
||||
/usr/bin/firefox --version
|
||||
exec /usr/bin/firefox "$@" >> /config/log/firefox/output.log 2>> /config/log/firefox/error.log
|
||||
/usr/bin/chromium --version
|
||||
exec /usr/bin/chromium "$@" >> /config/log/chromium/output.log 2>> /config/log/chromium/error.log
|
||||
|
||||
# vim:ft=sh:ts=4:sw=4:et:sts=4
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// Default download directory.
|
||||
pref("browser.download.dir", "/config/downloads");
|
||||
pref("browser.download.folderList", 2);
|
||||
// Disable the privacy notice page.
|
||||
pref("toolkit.telemetry.reportingpolicy.firstRun", false);
|
||||
// Disable some warning messages.
|
||||
pref("security.sandbox.warn_unprivileged_namespaces", false);
|
||||
// Prevent closing Firefox when closing the last tab.
|
||||
pref("browser.tabs.closeWindowWithLastTab", false);
|
||||
// Disable confirmation before quitting with Ctrl+Q. Needed to allow Firefox
|
||||
// to quit cleanly when container is shutted down.
|
||||
pref("browser.warnOnQuitShortcut", false);
|
Loading…
Add table
Add a link
Reference in a new issue