Test internet connection

-run scripts only if internet is ok
This commit is contained in:
2023-11-16 15:00:35 +01:00
parent c8ced14004
commit b76e72a1ef
8 changed files with 76 additions and 6 deletions

View File

@@ -152,6 +152,13 @@ get_info_pkg() {
echo -e "${bold}🍺 Homebrew ${reset}" echo -e "${bold}🍺 Homebrew ${reset}"
curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
echo -e "\n🍺 ${underline}Updating brew...${reset}\n" echo -e "\n🍺 ${underline}Updating brew...${reset}\n"
brew update brew update

View File

@@ -82,6 +82,14 @@ echo -e "\n${underline}🌿 npm:${reset}"
echo -e " - current version: ${italic}$npm_v${reset}" echo -e " - current version: ${italic}$npm_v${reset}"
echo -e " - install path: ${italic}$npm_ins${reset}" echo -e " - install path: ${italic}$npm_ins${reset}"
curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
# version installée de nvm par Homebrew # version installée de nvm par Homebrew
# nvm_installed=$(brew info nvm | grep Cellar) # nvm_installed=$(brew info nvm | grep Cellar)

View File

@@ -79,8 +79,8 @@ version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}
v=${version:0:3} v=${version:0:3}
echo -e "${ita_under}${blue}Current PHP version:${reset} ${bold}$version${reset}\n" echo -e "${ita_under}${blue}Current PHP version:${reset} ${bold}$version${reset}\n"
latest="8.0" latest="8.2"
versions=("7.2" "7.3" "7.4" "8.1" "$latest") versions=("7.4" "8.0" "8.1" "8.3" "$latest")
php_installed=$(ls -1 $(brew --prefix)/opt/ | grep php@) php_installed=$(ls -1 $(brew --prefix)/opt/ | grep php@)
echo -e "${ita_under}${blue}Installed PHP versions:${reset}" echo -e "${ita_under}${blue}Installed PHP versions:${reset}"
echo -e "$php_installed\n" echo -e "$php_installed\n"
@@ -94,6 +94,12 @@ fi
pecl version pecl version
curl -Is http://www.google.com | head -1 | grep 200
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
# Note that all public channels can be synced using "update-channels" # Note that all public channels can be synced using "update-channels"
echo -e "\n${ita_under}${blue}Updating all channels...${reset}" echo -e "\n${ita_under}${blue}Updating all channels...${reset}"

View File

@@ -16,6 +16,20 @@ display_info=true
# Also add module for prevent to update it. # Also add module for prevent to update it.
declare -a do_not_update=('') declare -a do_not_update=('')
italic="\033[3m"
underline="\033[4m"
ita_under="\033[3;4m"
bgd="\033[1;4;31m"
red="\033[1;31m"
bold="\033[1m"
bold_ita="\033[1;3m"
box="\033[1;41m"
redbold="\033[1;31m"
redbox="\033[1;41m"
reset="\033[0m"
echo -e "${bold}🐪 Perl ${reset}"
echo
perl_app=$(which perl) perl_app=$(which perl)
perl_v=$(perl -v | sed -n '2p') perl_v=$(perl -v | sed -n '2p')
@@ -42,10 +56,17 @@ else
install_ok=true install_ok=true
fi fi
if [ "$install_ok" == "true" ]; then
echo "$module installed"
# install with cpan curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
if [ "$install_ok" == "true" ]; then
# install with cpan
# % cpan-outdated | xargs cpan -i # % cpan-outdated | xargs cpan -i
# install with cpanm # install with cpanm

View File

@@ -78,6 +78,13 @@ if (( ${#do_not_update[@]} )); then
fi fi
curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
#Packages update #Packages update
echo -e "🐍 ${underline}Search for packages update...${reset}\n" echo -e "🐍 ${underline}Search for packages update...${reset}\n"

View File

@@ -40,6 +40,13 @@ list=$(pipx list --include-injected)
echo -e "\n${underline}List installed packages:${reset}" echo -e "\n${underline}List installed packages:${reset}"
echo "$list" echo "$list"
curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
pipx-outdated() { pipx-outdated() {
echo -e "\n${underline}Outdated Packages:${reset}" echo -e "\n${underline}Outdated Packages:${reset}"
while read -sr pyPkgName pyPkyVersion; do while read -sr pyPkgName pyPkyVersion; do

View File

@@ -11,6 +11,13 @@ reset="\033[0m"
echo -e "\n${bold}🦀 Rust${reset}\n" echo -e "\n${bold}🦀 Rust${reset}\n"
curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
if hash rustup 2>/dev/null; then if hash rustup 2>/dev/null; then
echo -e "🦀 ${underline}rustup check${reset}\n" echo -e "🦀 ${underline}rustup check${reset}\n"

View File

@@ -40,8 +40,15 @@ elif [[ "$OSTYPE" == "linux_gnu" ]]; then
elif [[ "$OSTYPE" == "linux_gnueabihf" ]]; then elif [[ "$OSTYPE" == "linux_gnueabihf" ]]; then
v=$HOME/venv v=$HOME/venv
fi fi
#
############################################################################################### curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
if [[ $? -eq 1 ]]; then
echo -e "\n${red}No Internet connection !${reset}"
echo -e "Exit !"
exit 1
fi
################################################################################################
for app in ${apps[*]} for app in ${apps[*]}
do do