Come installo i plugin del browser in modo centralizzato?

4

Ho 5 utenti su una scatola di Ubuntu e voglio che ogni utente abbia AdBlock+ (e pochi altri) sia per FireFox sia per Chrome.

C'è un modo per evitare l'accesso come ciascuno con GUI e avviare entrambi i browser e installare i plug-in manualmente?

    
posta sds 19.08.2013 - 03:16

2 risposte

1

Firefox:

C'è un modo semplice per farlo copiando semplicemente il profilo di Firefox dalla directory ~/.mozilla/firefox di user1, che ha reso pronto il profilo (ad esempio questo è l'account con Adblock, ecc. installato) agli account dell'utente2 , user3, ...:

sudo mkdir -p /home/user2/.mozilla/firefox 
sudo mkdir -p /home/user3/.mozilla/firefox
sudo cp -rv /home/user1/.mozilla/firefox /home/user2/.mozilla
sudo cp -rv /home/user1/.mozilla/firefox /home/user3/.mozilla
sudo chown -R user2 /home/user2/.mozilla
sudo chown -R user3 /home/user3/.mozilla

Ho provato questo, e ha funzionato. Un'alternativa è usare Firefox Sync . Tuttavia, ciò manterrà tutti i segnalibri e la cronologia uguali se cambia qualcosa.

Cromo:

La stessa tecnica può essere utilizzata con Chromium:

sudo mkdir -p /home/user2/.config/chromium 
sudo mkdir -p /home/user3/.config/chromium
sudo cp -rv /home/user1/.config/chromium/Default/ /home/user2/.config/chromium
sudo cp -rv /home/user1/.config/chromium/Default/ /home/user3/.config/chromium
sudo chown -R user2 /home/user2/.config/chromium
sudo chown -R user3 /home/user3/.config/chromium

Chromium ha anche un'opzione in cui puoi accedere con il tuo account Google e avere tutte le impostazioni, i segnalibri e la cronologia sunc attraverso le tue installazioni Chromium. Tuttavia, come con Firefox, questo potrebbe non essere applicabile alle tue esigenze.

    
risposta data Richard 19.08.2013 - 04:42
0

C'è uno script che ti farà installare Firefox-Add on per tutti gli utenti di Ubuntu. Devi leggere questo & amp; questo è dove va il credito .

#! /bin/bash
#
# Version 0.1
#   http://www.linuxquestions.org/questions/linux-software-2/how-to-install-firefox-extensions-for-all-users-808367/
#   05-22-2010, 04:22 PM
#   Narnie
# Version 0.2
#   24-07-2010
#   Maelvon
# FF-3.6.*


function Usage()
{
  echo ""
  echo "Usage: "
  echo "    add_global_firefox_extension.sh [-hof]"
  echo ""
  echo "OPTIONS:"
  echo "    -o  linux|osx"
  echo "        Operating system (mandatory)"
  echo "    -f  /path/xpi_filename"
  echo "        path to the original xpi file to install in the operating system's global directory (mandatory)"
  echo "    -h  this usage information"
  echo ""
  echo "EXAMPLE:"
  echo "    add_global_firefox_extension.sh -o osx -f ./thesupergood.xpi"
  echo ""
  ## Usage always exits
  exit $E_OPTERROR
}

function CheckForFile()
{
  if [ ! -f ${FILENAME} ]
  then
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo "  Error: the file:"
    echo "      ${FILENAME}"
    echo "  Does not exist"
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    Usage
  fi
  FILE=$(basename ${FILENAME}) 
  EXTENSION=${FILE##*.} 
  XPI=${FILE%.*}
  #echo "EXTENSION = ${EXTENSION}"
  if [ "${EXTENSION}" = xpi ]
  then
    continue
  else
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo "  Error: ${FILENAME} is not a *.xpi file"
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    Usage
  fi
}

function CheckForOs()
{
  ## most importantly, the file must exist
  if [ "${OSNAME}" = osx ]
  then
    EXTDIR="/Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
  elif [ "${OSNAME}" = linux ]
  then
    EXTDIR="/usr/lib/firefox-addons/extensions"
  else
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo "  Error: the operating system:"
    echo "      ${OSNAME}"
    echo "  Is not implemented, the defaults are \"osx\" or \"linux\"."
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    Usage
  fi
}

function CheckArgs()
{
  ## Process the arguments passed in
  while getopts ":o:f:h" Option
  do
    case $Option in
    o    ) OSNAME=$OPTARG ## mandatory
           #echo "OSNAME = $OSNAME"
           CheckForOs
           ;;
    f    ) FILENAME=$OPTARG ## mandatory
           ## make sure the file exists
           #echo "FILENAME = $FILENAME"
           CheckForFile
           ;;
           ## show Usage, do not use ?
           ## an unsupported/invalid option will set ? so the switch statement would
           ## never reach the default case. in order to use a default case to explain
           ## that an unsupported/invalid option was used set the "help" switch as -h
           ## or something other than -?
    h    ) Usage
           ;;
           ## default if an invalid option was entered
    *    ) echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
           echo "  Error: invalid option selected"
           echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
           Usage
    esac
  done
  ## Must at least have a file name using the -f switch
  ## check here in case only optional arguments were used
  if [ ! ${OSNAME} ]
  then
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo "  Error: the \"-o linux|osx\" option is mandatory"
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    Usage
  elif [ ! ${FILENAME} ]
  then
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo "  Error: the \"-f /path/filename\" option is mandatory"
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    Usage
  fi
}

setUp () {
    if [ ! -f ${FILENAME} ] ; then
        echo "File doesn't exist"
        exit 1
    fi
    umask 0022
    if [ -d $TMPDIR ] ; then
        (cd $TMPDIR ; sudo rm -rf *)
    else
        sudo mkdir -p "$TMPDIR"
        #cd $TMPDIR
    fi
    echo -e "\n\nworking . . .\n\n"
    sudo unzip "${FILENAME}" -d "$TMPDIR" &> /dev/null
}

getID () {
    local IFS="
"
    FILE="'cat $TMPDIR/install.rdf'"
    for i in $FILE ; do
        if echo "$i"|grep "urn:mozilla:install-manifest" &> /dev/null ; then
            GET=true
        fi
        if [ "$GET" = true ] ; then
            if echo "$i"|grep "<em:id>" ; then
                ID='echo "$i" | sed 's#.*<em:id>\(.*\)</em:id>.*##''
            elif echo "$i"|grep "em:id=\"" ; then
                ID='echo "$i" | sed 's/.*em:id="\(.*\)".*//''
            fi
            if echo "$i"|grep "<em:name>" ; then
                NAME='echo "$i" | sed 's#.*<em:name>\(.*\)</em:name>.*##''
            elif echo "$i"|grep "em:name=\"" ; then
                NAME='echo "$i" | sed 's/.*em:name="\(.*\)".*//''
            fi
            if echo "$i"|grep "<em:version>" ; then
                VERSION='echo "$i" | sed 's#.*<em:version>\(.*\)</em:version>.*##''
            elif echo "$i"|grep "em:version=\"" ; then
                VERSION='echo "$i" | sed 's/.*em:version="\(.*\)".*//''
            fi
            if [ -n "$ID" ] && [ -n "$NAME" ] && [ -n "$VERSION" ] ; then
                return
            fi
        fi
    done
    return 1
}

installExtension () {
    if [ -d "$EXTDIR/$ID" ] ; then
        sudo rm -rvf "$EXTDIR/$ID"
    fi
    sudo mv -vv "$TMPDIR" "$EXTDIR/$ID"
    if [ $? = 0 ] ; then
        echo -e "\n\nThe extension \"$XPI.$EXTENSION\" ($NAME - $VERSION) was globally installed\n\n"
    else
        echo -e "\n\nError installing \"$XPI.$EXTENSION\" extension\n\n"
    fi
}

getPath () {
    (
    cd ${1%%/*}
    pwd
    )
}

cleanUp () {
    if [ -d $TMPDIR ] ; then
        sudo rm -rf $TMPDIR
    fi
    exit 
}

TMPDIR="/tmp/ff_global_xpi"

trap "cleanUp 1" 1 2 3 15

CheckArgs "${@}"

setUp

getID

installExtension

cleanUp

Ciò che devi fare significa, devi solo inviare il firefox xpi richiesto come input per lo script.

    
risposta data Ten-Coin 19.08.2013 - 03:41

Leggi altre domande sui tag