This commit is contained in:
kyodev 2017-07-22 04:13:19 +02:00
parent 32b38513ab
commit d28786584e
3 changed files with 36 additions and 32 deletions

View File

@ -221,12 +221,10 @@ getFirefox u-latest
\__, |\___|\__|_| |_|_| \___|_| \___/_/\_\
|___/
pour Debian, version 0.7.1 - 21/07/2017
pour Debian, version 0.7.3 - 22/07/2017
récupération du profil default existant <moq4laqz.default>
alternatives installées pour <latest>
profil <latest> configuré pour kyodev
```

View File

@ -1,7 +1,7 @@
#!/bin/bash
version=0.7.2
date="21/07/2017"
version=0.7.3
date="22/07/2017"
projet="Kyodev"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues"
script="getFirefox"
@ -121,7 +121,6 @@ f__root(){
if [ $EUID -eq 0 ]; then return 0; else return 1; fi
}
# install du script dans le système
fscript_install(){
# si script inexistant ou inaccessible en écriture, ou si cronAnacron non installé: root requis
@ -310,7 +309,7 @@ ffx_lanceur_desktop(){
echo "StartupNotify=true" >> "$fileDesktopEnCeation"
}
# traitement de profile.ini, inscription si utlle (pas déjà existante)
# traitement de profile.ini, inscription si utile (pas déjà existante)
ffx_profilIni(){
#si déjà profil existant dans profil.ini, sortir
if [ "$(grep -rc Name=$product $fileProfileIni)" != 0 ]; then return; fi
@ -329,7 +328,26 @@ ffx_profilIni(){
else echo "" >> "$fileProfileIni"; fi
}
# traitement utilisateur
# traitement update-alternatives, $1 install|remove,
ffx_upt_altern(){
which update-alternatives &>/dev/null || return 0
# suppression alternatives x-www-browser si existantes
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
for i in nightly dev beta esr latest; do
if [ -d "/home/$user_/.mozilla/firefox/$i" ]; then firefoxAlternative="$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
}
# traitement utilisateur, $1 user, si appel indépendant pour reconfiguration
ffx_profilUser(){
if [ "$1" == "user" ] && [ ! -x "/usr/bin/firefox-$product" ]; then
f__error "firefox <$product> n'est pas installé" " il faut donc utiliser l'installation et pas l'ajout d'un nouveau profil"
@ -358,12 +376,7 @@ ffx_profilUser(){
chmod g-rx,o-rx "$dirProfil/$product/" # droits répertoire comme firefox officiel
ffx_profilIni
ffx_lanceur_desktop
# suppression alternatives x-www-browser si existantes
if update-alternatives --get-selections | grep firefox | grep x-www-browser &>/dev/null; then
update-alternatives --quiet --remove-all x-www-browser
fi
update-alternatives --quiet --install /usr/bin/firefox x-www-browser "/usr/bin/firefox-$product" 100
if [ "$1" == "user" ]; then f__info "alternatives installées pour <$product>"; fi
ffx_upt_altern "install"
if [ "$1" == "user" ]; then f__info "profil <$product> configuré pour $user_"; fi
}
@ -445,16 +458,7 @@ ffx_remove(){
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
# suppression alternatives x-www-browser si existantes
if update-alternatives --get-selections | grep firefox-"$product" | grep x-www-browser &>/dev/null; then
update-alternatives --quiet --remove-all x-www-browser
fi
# définition du plus "bas" canal pour alternatives
for i in nightly dev beta esr latest; do
if [ -d "/home/$user_/.mozilla/firefox/$i" ]; then firefoxAlternative="$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>"
ffx_upt_altern "remove"
f__info "$GREEN""Firefox-$product désinstallé."
}

View File

@ -3,20 +3,22 @@
## todo
* suppression profil?
* update-alternative spécifique debian, utile conserver?
## 0.7.2
## 0.7.3 22/07/2017
* pas d'update-alternatives si hors debian
## 0.7.2 21/07/17
* mieux: alternatives
* installation: alternatives pour canal installé, seulement pour x-www-browser
* remove: alternatives pour canal le plus faible (latest ou esr) si existant
* révision: firefox remove
* mieux, nouvelles options appel install ou remove (plus homogène avec u-): i-canal & r-canal
* fix mineur: protection multi-inscription dans lanceurs usr/bin
* fix mineur: upgrade script
## 0.7.0 21/07/17
* mieux: alternatives
* installation: alternatives pour canal installé
* remove: alternatives pour canal le plus faible (latest ou esr) si existant
* révision: firefox remove
## 0.6.1 21/07/17
* fix bug: copie profile default si profil existant pour latest ou esr