mirror of
https://github.com/woodchen-ink/docker-firefox.git
synced 2025-07-18 22:02:01 +08:00
35 lines
988 B
Bash
Executable File
35 lines
988 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e # Exit immediately if a command exits with a non-zero status.
|
|
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
|
|
|
|
# Generate machine id.
|
|
if [ ! -f /config/machine-id ]; then
|
|
echo "generating machine-id..."
|
|
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
|
|
do
|
|
touch "$LOG_FILE"
|
|
|
|
# Make sure the file doesn't grow indefinitely.
|
|
if [ "$(stat -c %s "$LOG_FILE")" -gt 1048576 ]; then
|
|
echo > "$LOG_FILE"
|
|
fi
|
|
done
|
|
|
|
# vim:ft=sh:ts=4:sw=4:et:sts=4
|