#!/bin/bash set -e PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin FIREFOX_PREFS_DIRS="/etc/firefox/pref /etc/firefox-3.0/pref" FIREFOX_PREFS_FILE="lliurex.js" gen_firefox_prefs(){ echo "pref(\"browser.cache.disk.parent_directory\",\"/tmp\");" case $PROXY_MODE in auto) echo "pref(\"network.proxy.autoconfig_url\", \"http://proxy/${PROXY_PATH}/proxy.pac\");" echo "pref(\"network.proxy.type\", 2);" echo "pref(\"browser.cache.disk.enable\", true);" echo "pref(\"browser.cache.offline.cache\", true);" echo "pref(\"browser.cache.disk.capacity\", 5120);" echo "pref(\"browser.cache.offline.capacity\", 5120);" echo "pref(\"image.cache.size\", 5120);" echo "pref(\"media.cache_size\", 5120);" ;; manual) echo "pref(\"network.proxy.http\", \"proxy\");" echo "pref(\"network.proxy.http_port\", $PROXY_HTTP_PORT);" echo "pref(\"network.proxy.type\", 1);" echo "pref(\"browser.cache.disk.enable\", true);" echo "pref(\"browser.cache.offline.cache\", true);" echo "pref(\"browser.cache.disk.capacity\", 5120);" echo "pref(\"browser.cache.offline.capacity\", 5120);" echo "pref(\"image.cache.size\", 5120);" echo "pref(\"media.cache_size\", 5120);" ;; esac } # main # modify /etc/environment to set http_proxy # TODO ... # configure firefox VAR_LIST="PROXY_MODE PROXY_AUTOCONFIG_URL PROXY_HOST PROXY_HTTP_PORT PROXY_PATH" eval `/usr/sbin/llxcfg-showvars ${VAR_LIST}` for d in $FIREFOX_PREFS_DIRS ; do if [ -d "$d" ] ; then FIREFOX_PREFS="${d}/$FIREFOX_PREFS_FILE" gen_firefox_prefs |skel-install "$FIREFOX_PREFS" fi done exit 0