Skip to content

Instantly share code, notes, and snippets.

@nightsh
Created March 5, 2013 21:21
Show Gist options
  • Save nightsh/5094394 to your computer and use it in GitHub Desktop.
Save nightsh/5094394 to your computer and use it in GitHub Desktop.
iceweasel-killer.sh
#!/bin/bash
echo -n "Introdu numele utilizatorului care va folosi Mozilla Firefox [$(whoami)]: "
read USER
echo -n "Introdu grupul care va utiliza Firefox [$(id -gn)]: "
read GROUP
echo -n "URL-ul arhivei pentru instalare: "
read URL
echo -n "Vrei să blochezi actualizările Iceweasel (recomandat) - doar dacă ești logat ca root [D/n] "
read DPKG
if [ -n "$DPKG" ] || DPKG='Y'
if [ -z "$URL" ]; then
URL="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/15.0.1/linux-i686/en-US/firefox-15.0.1.tar.bz2"
else
#if [ -n "$(curl -sr 0-1 $URL | grep '404')" || $URL =~ '[.]*firefox-([0-9\.-_]*).tar.bz2' ]; then
if [ -n "$(curl -sr 0-1 $URL | grep '404')" ]; then
echo 'Eroare: URL nevalid!' ;
exit;
else
echo 'URL valid, continuă...'
fi
fi
echo '==========[ Pasul 1/3: Descărcarea navigatorului Mozilla Firefox ]=========='
curl $URL | tar -jxv
echo '==========[ Pasul 2/3: Copierea navigatorului Mozilla Firefox În sistem ]=========='
mv firefox/ /opt
if [ -z "$USER" ]; then
USER=$(id -un)
fi
if [ -z "$GROUP" ]; then
GROUP=$(id -gn)
chown $USER:$GROUP /opt/firefox/ -R
chmod 754 /opt/firefox/ -R
else
chown $USER:$GROUP /opt/firefox/ -R
chmod 774 /opt/firefox/ -R
fi
echo '==========[ Pasul 3/3: Crearea legăturilor în sistem ]=========='
ln -s /usr/lib/mozilla/plugins /opt/firefox/plugins
mv /usr/bin/firefox /usr/bin/firefox-iceweasel
ln -sf /opt/firefox/firefox /usr/bin/firefox
echo '[Desktop Entry]
Name=Firefox
GenericName=Web Browser
Comment=Mozilla Firefox
Exec=/opt/firefox/firefox %u
Terminal=false
Icon=/opt/firefox/icons/mozicon128.png
Type=Application
Categories=Application;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;
StartupWMClass=Firefox-bin
StartupNotify=true' > /usr/share/applications/firefox.desktop
update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 100
update-alternatives --set x-www-browser /opt/firefox/firefox
if [ "$DPKG" = "Y" ] ; then
echo "iceweasel hold" | dpkg --set-selections
else
echo "Atenție: pentru a dezactiva actualizările Iceweasel, execută ca root comanda:"
echo 'echo "iceweasel hold" | dpkg --set-selections"'
fi
echo '==========[ Instalarea a reușit! Mozilla Firefox este navigatorul implicit și se află în meniul cu aplicații de rețea ]=========='
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment