This commit is contained in:
kyodev 2017-07-22 23:13:25 +02:00
parent 1f11f888c9
commit 99a3094961
2 changed files with 23 additions and 24 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
version=0.7.4
version=0.7.5
date="22/07/2017"
projet="Kyodev"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues"
@ -334,16 +334,23 @@ ffx_upt_altern(){
if update-alternatives --get-selections | grep firefox | grep x-www-browser &>/dev/null; then
update-alternatives --quiet --remove-all x-www-browser
fi
if [ "$1" == "install" ]; then
update-alternatives --quiet --install /usr/bin/firefox x-www-browser "/usr/bin/firefox-$product" 100
elif [ "$1" == "remove" ]; then
# définition du plus "bas" canal pour alternatives
if [ "$1" == "install" ]; then
update-alternatives --quiet --install /usr/bin/firefox x-www-browser "/usr/bin/firefox-$product" 100
elif [ "$1" == "remove" ]; then
for i in nightly dev beta esr latest; do
if [ -d "$dirInstall$i/" ]; then firefoxBas="$i"; fi
done
update-alternatives --quiet --install /usr/bin/firefox x-www-browser "/usr/bin/firefox-$firefoxBas" 100
f__info "alternatives installées pour <$firefoxBas>"
fi
}
# lien /usr/bin/firefox pour la plus basse version firefox installée
ffx_usr_bin(){
for i in nightly dev beta esr latest; do
if [ -d "/home/$user_/.mozilla/firefox/$i" ]; then firefoxAlternative="$i"; fi
if [ -d "$dirInstall$i/" ]; then firefoxBas="$i"; fi
done
update-alternatives --quiet --install /usr/bin/firefox x-www-browser "/usr/bin/firefox-$firefoxAlternative" 100
f__info "alternatives installées pour <$firefoxAlternative>"
fi
ln -sf "/usr/bin/firefox-$firefoxBas" "/usr/bin/firefox"
}
# traitement utilisateur, $1 user, si appel indépendant pour reconfiguration
@ -424,14 +431,11 @@ ffx_install(){
echo "#!/bin/sh" > /usr/bin/firefox-"$product"
echo "exec $dirInstall$product/firefox -P $product" "\$@" >> /usr/bin/firefox-"$product"
chmod a+x /usr/bin/firefox-"$product"
# lien dans /usr/bin pour latest ou esr en tant que firefox, supersedé par alternative sur debian
if [ "$product" == "latest" ]; then ln -sf "/usr/bin/firefox-latest" "/usr/bin/firefox"
elif [ "$product" == "esr" ]; then ln -sf "/usr/bin/firefox-esr" "/usr/bin/firefox"; fi
# lien icone Firefox
ln -sf "$dirInstall$product"/browser/chrome/icons/default/default48.png /usr/share/pixmaps/firefox-"$product".png
# traitement user
ffx_usr_bin
ffx_profilUser
f__info "$GREEN""Firefox-$product installé."
}
@ -443,20 +447,18 @@ ffx_remove(){
# si pas de lanceur desktop, on considère que ce canal firefox n'est pas installé, retour
if [ ! -e "/usr/share/applications/firefox-$product.desktop" ]; then
f__info "$GREEN" "Firefox-$product n'est pas installé."
return 0
return 1
fi
# suppression du répertoire firefox
if [ -d "$dirInstall$product/" ]; then rm -rf "$dirInstall$product/"; fi
if [ -d "/opt/firefox-$product" ]; then rm -rf "/opt/firefox-$product/"; fi # ancien répertoire éventuel
if [ -d "/opt/firefox-$product/" ]; then rm -rf "/opt/firefox-$product/"; fi # ancien répertoire éventuel
if [ -d "$dirInstall$product/" ]; then rm -rf "$dirInstall$product/"; fi
# suppression lanceurs
rm -f /usr/share/applications/firefox-"$product".desktop
rm -f /usr/bin/firefox-"$product"
# suppression des liens
unlink "/usr/share/pixmaps/firefox-$product.png" &>/dev/null
if [ "$product" == "latest" ]; then unlink "/usr/bin/firefox" &>/dev/null
elif [ "$product" == "esr" ]; then unlink "/usr/bin/firefox" &>/dev/null; fi
unlink "/usr/bin/firefox-$product" &>/dev/null
ffx_usr_bin
ffx_upt_altern "remove"
f__info "$GREEN""Firefox-$product désinstallé."
}

View File

@ -1,15 +1,12 @@
# changelog getFirefox
## todo
* usr/bin/firefox pour la plus basse version installée
## 0.7.4 22/07/2017
## 0.7.5 22/07/2017
* pas d'update-alternatives si hors debian
* opti mineure
* fix bug: création lanceur usr/bin sans options
* remove: bascule pour la plus basse version restante installée pour usr/bin/firefox et alternatives (fix)
## 0.7.2 21/07/17