From fdc1f2b72096c64a18fa7b7d308b44e7939c5fc8 Mon Sep 17 00:00:00 2001 From: "Francois B. (Makoto)" Date: Sat, 23 May 2020 18:07:27 +0200 Subject: [PATCH] handle new option of add-apt-repository to avoid useless update (20.04) --- core_functions.sh | 26 +++++++++++++++++++++----- vars.sh | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/core_functions.sh b/core_functions.sh index 1246a66..4592591 100644 --- a/core_functions.sh +++ b/core_functions.sh @@ -79,11 +79,11 @@ function pressKey () { } # -# check if OS is Mint 18 +# check if OS is Mint 18 / Ubuntu 16.04 # function isMint18 () { OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'` - if [[ $OS == *"Linux Mint 18"* ]]; then + if [[ $OS == *"Linux Mint 18"* || $OS == *"Ubuntu 16.04"* ]]; then return 0 else return 1 @@ -91,11 +91,23 @@ function isMint18 () { } # -# check if OS is Mint 19 +# check if OS is Mint 19 / Ubuntu 18.04 # function isMint19 () { OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'` - if [[ $OS == *"Linux Mint 19"* ]]; then + if [[ $OS == *"Linux Mint 19"* || $OS == *"Ubuntu 18.04"* ]]; then + return 0 + else + return 1 + fi +} + +# +# check if OS is Mint 20 / Ubuntu 20.04 +# +function isMint20 () { + OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'` + if [[ $OS == *"Linux Mint 20"* || $OS == *"Ubuntu 20.04"* ]]; then return 0 else return 1 @@ -207,7 +219,11 @@ function addPPA () { if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -q ${str2search}; then printf "[PPA] adding : $* " printf "\n[PPA] adding $*\n" &>> $logFile - sudo add-apt-repository -y $* &>> $logFile + if isMint20; then + sudo add-apt-repository -yn $* &>> $logFile + else + sudo add-apt-repository -y $* &>> $logFile + fi ret_code=$? retCode $ret_code else diff --git a/vars.sh b/vars.sh index c86bd49..ccc3d96 100644 --- a/vars.sh +++ b/vars.sh @@ -13,7 +13,7 @@ # # app version number # -version="0.6.0-b2" +version="0.6.0-b3" # # myHomedir is used in full paths to the homedir