handle new option of add-apt-repository to avoid useless update (20.04)

This commit is contained in:
Francois B. (Makoto) 2020-05-23 18:07:27 +02:00
parent bd79903672
commit fdc1f2b720
2 changed files with 22 additions and 6 deletions

View file

@ -79,11 +79,11 @@ function pressKey () {
} }
# #
# check if OS is Mint 18 # check if OS is Mint 18 / Ubuntu 16.04
# #
function isMint18 () { function isMint18 () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'` 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 return 0
else else
return 1 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 () { function isMint19 () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'` 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 return 0
else else
return 1 return 1
@ -207,7 +219,11 @@ function addPPA () {
if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -q ${str2search}; then if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -q ${str2search}; then
printf "[PPA] adding : $* " printf "[PPA] adding : $* "
printf "\n[PPA] adding $*\n" &>> $logFile printf "\n[PPA] adding $*\n" &>> $logFile
if isMint20; then
sudo add-apt-repository -yn $* &>> $logFile
else
sudo add-apt-repository -y $* &>> $logFile sudo add-apt-repository -y $* &>> $logFile
fi
ret_code=$? ret_code=$?
retCode $ret_code retCode $ret_code
else else

View file

@ -13,7 +13,7 @@
# #
# app version number # app version number
# #
version="0.6.0-b2" version="0.6.0-b3"
# #
# myHomedir is used in full paths to the homedir # myHomedir is used in full paths to the homedir