From 0c20cb826c0846618af308c366fb3ed823abc4c8 Mon Sep 17 00:00:00 2001 From: kyodev <> Date: Fri, 26 Jan 2018 19:56:39 +0100 Subject: [PATCH] getThunderbird 2.6.0 --- scripts/getThunderbird | 17 +++++++++++------ scripts/getThunderbird_changelog.md | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/getThunderbird b/scripts/getThunderbird index a8e7167..bd23f84 100755 --- a/scripts/getThunderbird +++ b/scripts/getThunderbird @@ -1,6 +1,6 @@ #!/bin/bash -version=2.5.0 +version=2.6.0 date="26/01/2018" projet="simpledeb" contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/" @@ -145,9 +145,10 @@ f__requis(){ # 26/01/2018 # $@=cmd à lancer en root avec su ou sudo. si $@ contient :x: x=nombre de tentatives, sinon 2 tentatives par défaut # si bash inexistant, return 2 -f__sudo(){ # 14/01/2018 - local nb sudo isudo toBash options +f__sudo(){ # 26/01/2018 + local nb sudo isudo toBash options nbDefault=2 + # détermination sudo possible type -p bash &>/dev/null && toBash=$( type -p bash ) || return 2 # sudo --shell bash équivalent su ? if sudo -v &>/dev/null && [ $EUID -ne 0 ] ; then @@ -155,14 +156,18 @@ f__sudo(){ # 14/01/2018 else sudo="su --shell $toBash --preserve-environment -c " fi - if [[ "$@" =~ :??: ]]; then + # extraction nb de tentatives éventuel + if [[ "$@" =~ :.{1,2}: ]]; then nb="$@" nb=${nb#*:} nb=${nb%:*} + options=${@//:$nb:/ } + (( ${nb}+1 )) 2>/dev/null || nb="$nbDefault" # test si numérique, sinon, else - nb=2 + nb="$nbDefault" + options="$@" fi - options=${@//:$nb:/ } + # lancement cmds for (( isudo=1 ; isudo<="$nb" ; isudo++ )); do $sudo " $options" [ "$?" == 0 ] && break diff --git a/scripts/getThunderbird_changelog.md b/scripts/getThunderbird_changelog.md index d859303..da65af2 100644 --- a/scripts/getThunderbird_changelog.md +++ b/scripts/getThunderbird_changelog.md @@ -1,10 +1,11 @@ # changelog getThunderbird -## getThunderbird 2.5.0 26/01/2018 +## getThunderbird 2.6.0 26/01/2018 * révision: mineur, fscript_cronAnacron fscript_install fscript_remove fscript_update * révision: f__requis +* fix: f__sudo, extraction nb tentatives ## getThunderbird 2.4.0 24/01/2018