getFirefox 4.4.0

This commit is contained in:
kyodev 2017-12-25 08:59:48 +01:00
parent 9b22e083b7
commit 90bc7738c5
2 changed files with 80 additions and 68 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
version=4.3.0
date="24/12/2017"
version=4.4.0
date="25/12/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
script="getFirefox"
@ -268,20 +268,20 @@ EOF
}
# affichage help
f_help(){ # 23/12/2017
local ih help=(
f_help(){ # 25/12/2017
local appli="Firefox" ih help=(
" ----------------------------------------------------------------------"
" canaux possibles:$GREEN latest, beta, nightly, dev, esr$STD"
" <all> = tous les canaux"
" "
" exemple, installation version Release (latest): $BLUE$script i-latest$STD"
" "
" $BLUE$script i-$STD$GREEN""canal$STD : $RED""i$STD""nstallation de Firefox <canal> $RED(root)$STD"
" $BLUE$script i-$STD$GREEN""canal$STD : $RED""i$STD""nstallation de $appli <canal> $RED(root)$STD"
" "
" $BLUE$script d-$STD$GREEN""canal$STD : copier un profil $RED"".d$STD""efault existant sur <canal>"
" $BLUE$script m-$STD$GREEN""canal$STD : installation sur le <canal> d'une archive téléchargée $RED""m$STD""anuellement $RED(root)$STD"
" $BLUE$script r-$STD$GREEN""canal$STD : désinstallation ($RED""r$STD""emove) de Firefox <canal> $RED(root)$STD"
" $BLUE$script s-$STD$GREEN""canal$STD : canal comme défaut du $RED""s$STD""ystème (update-alternatives & commande$BLUE firefox$STD) $RED(root)$STD"
" $BLUE$script r-$STD$GREEN""canal$STD : désinstallation ($RED""r$STD""emove) du <canal> $RED(root)$STD"
" $BLUE$script s-$STD$GREEN""canal$STD : canal comme défaut du $RED""s$STD""ystème (profil défaut, update-alternatives & commande$BLUE firefox$STD) $RED(root)$STD"
" $BLUE$script u-$STD$GREEN""canal$STD : ajouter un profil pour l'$RED""u$STD""tilisateur en cours"
" "
" $BLUE$script p-$STD$GREEN""canal$STD : $RED""p$STD""ersonnalisation sur le <canal> de user.js & userChrome.css"
@ -306,7 +306,7 @@ f_help(){ # 23/12/2017
echo -e "\n$STD plus d'infos: $YELLOW$url_notice\n$STD"
}
# copie du répertoire fault dans canal, $1=canal
# copie du répertoire .default dans canal, $1=canal
ffx_copie_default(){ # 22/12/2017
local canal="$1" profileDefault
@ -314,7 +314,7 @@ ffx_copie_default(){ # 22/12/2017
f__info "$appli $canal n'a pas de profil et ne peut donc pas recevoir .default"
return 1
fi
profileDefault=$( sed -En 's/Path=(.*\.default).*$/\1/p' "$dirProfilFfx/profiles.ini" ) # recherche profil .default dans profile.ini
profileDefault=$( sed -En 's/Path=(.*\.default).*$/\1/p' "$dirProfilFfx/profiles.ini" ) # recherche profil .default
if [ -z "$profileDefault" ] || [ ! -d "$dirProfilFfx/$profileDefault" ]; then
f__info "pas de profil .default existant, opération abandonnée"
return 1
@ -326,7 +326,7 @@ ffx_copie_default(){ # 22/12/2017
chmod g-rx,o-rx "$dirProfilFfx/$canal/" # droits répertoire
}
# lien /usr/bin/firefox & alternatives, $1 canal
# lien /usr/bin & alternatives, $1 canal
ffx_defaut_system(){ # 23/12/2017
local canal="$1" appli="Firefox"
@ -343,7 +343,7 @@ ffx_defaut_system(){ # 23/12/2017
ffx_profil_user "$canal"
fi
unlink "/usr/bin/firefox" &>/dev/null
unlink "/usr/bin/firefox" &>/dev/null # lien éventuel
ln -sf "/usr/bin/firefox-$canal" "/usr/bin/firefox"
# update-alternatives
if type -p "update-alternatives" &>/dev/null ; then # update-alternatives existe?
@ -352,6 +352,7 @@ ffx_defaut_system(){ # 23/12/2017
update-alternatives --quiet --set 'x-www-browser' "/usr/bin/firefox-$canal" # si le priorité n'est pas suffisante
update-alternatives --quiet --set 'gnome-www-browser' "/usr/bin/firefox-$canal" # si le priorité n'est pas suffisante
fi
f__info "$appli $canal est le canal par défaut du système"
}
@ -360,15 +361,15 @@ ffx_get_canalBas(){ # 18/12/2017
local ii
for ii in $produit_all_inverse; do
[ -d "$dirInstallFfx$ii/" ] && ffx_canal_bas="$ii"
[ -d "$dirInstallFfx$ii" ] && ffx_canal_bas="$ii"
done
[ "$ffx_canal_bas" ] && return || return 1
[ "$ffx_canal_bas" ] && return 0 || return 1
}
# version en ligne et installée, affichage
ffx_get_version(){ # 24/12/2017
ffx_get_version(){ # 25/12/2017
local recup_url ver_latest ver_esr ver_beta ver_nightly ii
local verFfxInstall='' verFfxOnline='' pointeur appli="Firefox" fileTmp="/tmp/$script-getVersion_${appli// }"
local verFfxInstall='' verFfxOnline='' pointeur fileTmp="/tmp/$script-getVersion_ffx" appli="Firefox"
echo -n " ."
#recup url
@ -420,8 +421,8 @@ ffx_get_version(){ # 24/12/2017
[[ $( xargs <<< $verFfxOnline ) ]] || verFfxOnline="$RED""n/a"
echo -e "\n"
f__info "raw" "$appli en place: $GREEN$verFfxOnline"
f__info "$appli en ligne: $YELLOW$verFfxInstall"
f__info "raw" "$appli en place: $GREEN$verFfxInstall"
f__info "$appli en ligne: $YELLOW$verFfxOnline"
}
# ascii art godzilla
@ -447,8 +448,8 @@ EOF
}
# installation, $1 canal [$2='manuel', $3 archive]
ffx_install(){ # 23/12/2017
local fileTemp canal="$1" appli="Firefox" verArchive dirTemp="/tmp/$script-install_${appli// }"
ffx_install(){ # 25/12/2017
local fileTemp canal="$1" verArchive dirTemp="/tmp/$script-install_ffx" appli="Firefox"
if [ "$EUID" -ne 0 ]; then
f__info "vous devez être$RED ROOT$BLUE pour installer $appli $canal dans le système"
@ -463,11 +464,9 @@ ffx_install(){ # 23/12/2017
verArchive=$( sed -E 's/.*firefox-(.*)\.linux.*$/\1/' <<< $(basename $3) )
f__info "installation manuelle dans $canal de $appli version $verArchive ($( basename $3 ))"
fileTemp="$3"
mkdir -p "$dirTemp"
else
f__info "installation $appli-$canal"
fileTemp="$dirTemp/firefox-$canal.$fu_archi.tar.bz2"
mkdir -p "$dirTemp"
# téléchargement & test archive
f__info " - téléchargement..."
# url téléchargement
@ -485,6 +484,7 @@ ffx_install(){ # 23/12/2017
fi
f__archive_test "$fileTemp" || f__error "Le fichier $fileTemp n'est pas une archive tar.gz valide"
echo
mkdir -p "$dirTemp"
# décompression archive téléchargée dans dossier de travail
f__info " - décompression..."
tar -xaf "$fileTemp" -C "$dirTemp/"
@ -499,22 +499,22 @@ ffx_install(){ # 23/12/2017
chmod -R g+wrs,a+r "$dirInstallFfx$canal/"
rm -rf "$dirTemp/"
# finalisation utilisateur
ffx_profil_user "$canal" # profiles.ini, répertoire profil , profil default
# traitement finaux système
ln -sf "$dirInstallFfx$canal/browser/chrome/icons/default/default48.png" "/usr/share/pixmaps/firefox-$canal.png"
ffx_lanceur_desktop "$canal"
# liens lanceurs
# suppression liens lanceurs éventuels
unlink "/usr/bin/firefox-$canal" &>/dev/null # lien éventuel paquet debian
unlink "/usr/bin/firefox" &>/dev/null
# lanceur /usr/bin
# lanceur dans /usr/bin
echo "#!/bin/sh" > "/usr/bin/firefox-$canal"
echo >> "/usr/bin/firefox-$canal"
echo "echo \"\$@\" | grep -qE '\-P|\-\-ProfileManager' && exec $dirInstallFfx$canal/firefox -P || \\" >> "/usr/bin/firefox-$canal"
echo " exec $dirInstallFfx$canal/firefox -P $canal \"\$@\"" >> "/usr/bin/firefox-$canal"
echo " exec $dirInstallFfx$canal/firefox -P $canal \"\$@\"" >> "/usr/bin/firefox-$canal"
chmod a+x "/usr/bin/firefox-$canal"
# lien /usr/bin & alternatives
ffx_defaut_system "$canal"
# finalisation utilisateur
ffx_profil_user "$canal"
if [ "$2" == "manuel" ]; then
f__info "log" "archive $appli-$canal $verArchive installée"
@ -529,31 +529,38 @@ ffx_install_manuel(){ # 18/12/2017
[ -e "$2" ] || f__error "fichier archive $2 introuvable"
ffx_install "$1" "manuel" "$2"
[ -e "$fileDev" ] || rm "$2" &>/dev/null ## on efface pas si fileDev (dev)
[ -e "$fileDev" ] || rm "$2" &>/dev/null ## on n'efface pas si fileDev (dev)
}
# création lanceur.desktop, $1=canal
ffx_lanceur_desktop(){ # 18/12/2017
local fileDesktop="/usr/share/applications/firefox-$1.desktop" canal="$1" appli="Firefox"
ffx_lanceur_desktop(){ # 25/12/2017
local canal="$1" fileDesktop="/usr/share/applications/firefox-$1.desktop" appli="Firefox"
echo "[Desktop Entry]" > "$fileDesktop"
echo "Name=$appli $canal" >> "$fileDesktop"
echo "Name[fr]=$appli $canal" >> "$fileDesktop"
echo "X-GNOME-FullName=$appli-$canal Web Browser" >> "$fileDesktop"
echo "X-GNOME-FullName[fr]=$appli-$canal Navigateur Web" >> "$fileDesktop"
echo "StartupWMClass=$appli-$canal" >> "$fileDesktop"
echo "Exec=$dirInstallFfx$canal/firefox %u" >> "$fileDesktop"
echo "Icon=$dirInstallFfx$canal/browser/chrome/icons/default/default128.png" >> "$fileDesktop"
echo "Comment=Browse the World Wide Web" >> "$fileDesktop"
echo "Comment[fr]=Naviguer sur Internet" >> "$fileDesktop"
echo "GenericName=Web Browser" >> "$fileDesktop"
echo "GenericName[fr]=Navigateur Web" >> "$fileDesktop"
echo "Terminal=false" >> "$fileDesktop"
echo "X-MultipleArgs=false" >> "$fileDesktop"
echo "Type=Application" >> "$fileDesktop"
echo "Categories=Network;WebBrowser;" >> "$fileDesktop"
echo "[Desktop Entry]" > "$fileDesktop"
echo "Name=$appli $canal" >> "$fileDesktop"
echo "Name[fr]=$appli $canal" >> "$fileDesktop"
echo "X-GNOME-FullName=$appli-$canal Web Browser" >> "$fileDesktop"
echo "X-GNOME-FullName[fr]=$appli-$canal Navigateur Web" >> "$fileDesktop"
echo "StartupWMClass=$appli-$canal" >> "$fileDesktop"
echo "Exec=$dirInstallFfx$canal/firefox %u" >> "$fileDesktop"
# default128.png: disparu dans beta, esr, latest (48.png max), mozicon128 ok sauf nightly! mais default128 ok nightly
if [ -e "$dirInstallFfx$canal/browser/icons/mozicon128.png" ]; then
echo "Icon=$dirInstallFfx$canal/browser/icons/mozicon128.png" >> "$fileDesktop"
elif [ -e "$dirInstallFfx$canal/browser/chrome/icons/default/default128.png" ]; then
echo "Icon=$dirInstallFfx$canal/browser/chrome/icons/default/default128.png" >> "$fileDesktop"
else
echo "Icon=$dirInstallFfx$canal/browser/chrome/icons/default/default48.png" >> "$fileDesktop"
fi
echo "Comment=Browse the World Wide Web" >> "$fileDesktop"
echo "Comment[fr]=Naviguer sur Internet" >> "$fileDesktop"
echo "GenericName=Web Browser" >> "$fileDesktop"
echo "GenericName[fr]=Navigateur Web" >> "$fileDesktop"
echo "Terminal=false" >> "$fileDesktop"
echo "X-MultipleArgs=false" >> "$fileDesktop"
echo "Type=Application" >> "$fileDesktop"
echo "Categories=Network;WebBrowser;" >> "$fileDesktop"
echo "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;x-scheme-handler/http;x-scheme-handler/https;" >> "$fileDesktop"
echo "StartupNotify=true" >> "$fileDesktop"
echo "StartupNotify=true" >> "$fileDesktop"
}
# version personnalisation en ligne, [$1=quiet], assigne $perso_ffx_afaire
@ -585,8 +592,8 @@ ffx_pers_get_version(){ # 24/12/2017
}
# recup user.js et chrome/userChrome.css, $1=canal à personnaliser ou mettre à jour
ffx_pers_install(){ # 23/12/2017
local verPersDL canal="$1" appli="Firefox" dirTemp="/tmp/$script-persInstall_${appli// }"
ffx_pers_install(){ # 25/12/2017
local verPersDL canal="$1" dirTemp="/tmp/$script-persInstall_ffx" appli="Firefox"
if [ ! -d "$dirProfilFfx/$canal" ]; then
f__info "profil $appli $canal inexistant"
@ -643,8 +650,8 @@ ffx_pers_upgrade(){ # 21/12/2017
fi
}
# traitement utilisateur, $1=canal, [$2='user'] si appel indépendant pour reconfiguration
ffx_profil_user(){ # 22/12/2017
# traitement utilisateur, $1=canal, [$2='user' si appel indépendant pour reconfiguration]
ffx_profil_user(){ # 25/12/2017
local nbProfiles canal="$1" appli="Firefox"
if [ ! -d "$dirInstallFfx$canal" ] && [ "$2" == "user" ]; then
@ -652,19 +659,19 @@ ffx_profil_user(){ # 22/12/2017
return 1
fi
if [ ! -e "$dirProfilFfx/profiles.ini" ]; then # si profile.ini inexistant, on crée profile.ini avec entête minimum
echo -e "[General]\nStartWithLastProfile=1" > "$dirProfilFfx/profiles.ini"
chown "$fu_user:" "$dirProfilFfx/profiles.ini" # propriété du fichier profile.ini à l'user
chmod u+rw,go+r "$dirProfilFfx/profiles.ini" # permissions du fichier profile.ini à l'user
fi
if [ ! -d "$dirProfilFfx/$canal" ] ; then # création répertoire cible si existant, test si réinstallation
if [ ! -d "$dirProfilFfx/$canal" ] ; then # création répertoire cible si inexistant
mkdir -p "$dirProfilFfx/$canal" # répertoire du répertoire profil
chown -R "$fu_user:" "$dirProfilFfx/$canal/" # propriété du répertoire profil à l'user
chmod g-rx,o-rx "$dirProfilFfx/$canal/" # droits répertoire
fi
# inscription dans profil.ini, si profil inexistant dans profil.ini
if [ ! -e "$dirProfilFfx/profiles.ini" ]; then # si profile.ini inexistant, on crée profile.ini avec entête minimum
echo -e "[General]\nStartWithLastProfile=1" > "$dirProfilFfx/profiles.ini"
chown "$fu_user:" "$dirProfilFfx/profiles.ini" # propriété du fichier profile.ini à l'user
chmod u+rw,go+r "$dirProfilFfx/profiles.ini" # permissions du fichier profile.ini à l'user
fi
# inscription dans profil.ini, si ProfilX inexistant dans profiles.ini
if ! grep -q "Name=$canal" "$dirProfilFfx/profiles.ini" ; then
# comptage profils existants
# comptage profils existants
nbProfiles=$( grep -cEs '\[Profile[0-9]+\]' "$dirProfilFfx/profiles.ini" )
# création profil dans profile.ini
echo >> "$dirProfilFfx/profiles.ini"
@ -672,17 +679,18 @@ ffx_profil_user(){ # 22/12/2017
echo "Name=$canal" >> "$dirProfilFfx/profiles.ini"
echo "IsRelative=1" >> "$dirProfilFfx/profiles.ini"
echo "Path=$canal" >> "$dirProfilFfx/profiles.ini"
# Default=1 au dernier installé, si besoin utiliser u-
sed -i '/Default=1/d' "$dirProfilFfx/profiles.ini" # effacement éventuel Default=existant
echo "Default=1" >> "$dirProfilFfx/profiles.ini" # réinscription
echo "$( uniq $dirProfilFfx/profiles.ini )" > "$dirProfilFfx/profiles.ini" # suppression lignes vides en double
fi
# Default=1 au dernier installé, si besoin autre utiliser u-
sed -i '/Default=1/d' "$dirProfilFfx/profiles.ini" # effacement éventuel Default=existant
echo "Default=1" >> "$dirProfilFfx/profiles.ini" # réinscription
echo "$( uniq $dirProfilFfx/profiles.ini )" > "$dirProfilFfx/profiles.ini" # suppression lignes vides en double
[ "$2" == "user" ] && f__info "log" "profil $appli $canal configuré pour $fu_user"
}
# désinstallation, $1=canal
ffx_remove(){ # 22/12/2017
local fileDesktop="/usr/share/applications/firefox-$1.desktop" canal="$1" appli="Firefox"
ffx_remove(){ # 25/12/2017
local canal="$1" fileDesktop="/usr/share/applications/firefox-$1.desktop" appli="Firefox"
if [ "$EUID" -ne 0 ]; then
f__info "vous devez être$RED ROOT$BLUE pour désinstaller $appli $canal"
@ -1008,10 +1016,6 @@ for j in $options; do
ffx_profil_user "$k" "user" # configurer un canal pour user en cours
done
exit ;;
v-ffx )
ffx_get_version # versions
ffx_pers_get_version
;;
version | versions ) # versions en ligne & installées
fscript_get_version

View File

@ -1,6 +1,14 @@
# changelog getFirefox
## getFirefox 4.4.0 25/12/2017
* cosmétique
* révision: ffx_install, ffx_profil_user
* révision: général, plus de variables composées avec variable dans local
* révision: ffx_lanceur_desktop changement en cours ou bug mozilla sur icon
* fix: ffx_get_version, affichage
## getFirefox 4.3.0 24/12/2017
* cosmétique