homebrew.sh

-bugfix si aucune màj de paquet n’est dispo
This commit is contained in:
2019-12-20 08:43:32 +01:00
parent be093d2455
commit 648bd9d211
2 changed files with 49 additions and 33 deletions

View File

@@ -86,6 +86,7 @@ if [ -x "$(command -v jq)" ]; then
done done
upd3=$(echo "$upd3" | sed 's/.$//') upd3=$(echo "$upd3" | sed 's/.$//')
if [ -n "$upd3" ]; then
# Only 1 request 'brew info' for all updated packages # Only 1 request 'brew info' for all updated packages
info=$(brew info --json=v1 $upd3) info=$(brew info --json=v1 $upd3)
@@ -111,11 +112,12 @@ if [ -x "$(command -v jq)" ]; then
done done
nb=$i nb=$i
i=0 i=0
fi
else else
brew_outdated=$(brew outdated) brew_outdated=$(brew outdated)
upd3=$(echo "$brew_outdated" | awk '{print $1}') upd3=$(echo "$brew_outdated" | awk '{print $1}')
if [ -n "$upd3" ]; then
info=$(brew info $upd3) info=$(brew info $upd3)
for i in $upd3 for i in $upd3
do do
@@ -124,6 +126,7 @@ else
done done
nb=${#array_info[@]} nb=${#array_info[@]}
fi fi
fi
# Get infos for all updated packages # Get infos for all updated packages
@@ -210,6 +213,8 @@ if [ -n "$upd3" ]; then
done done
not_pinned=$(echo "$not_pinned" | sed 's/.$//') not_pinned=$(echo "$not_pinned" | sed 's/.$//')
echo "np:$not_pinned:"
# Update outdated packages # Update outdated packages
if [ "$no_distract" = false ]; then if [ "$no_distract" = false ]; then
@@ -238,8 +243,8 @@ if [ -n "$upd3" ]; then
else else
echo "Ok, let's continue" echo "Ok, let's continue"
fi fi
else #else
echo "No package to update" # echo "No package to update"
fi fi
else # no distract = true else # no distract = true
@@ -247,15 +252,20 @@ if [ -n "$upd3" ]; then
if [ -n "$not_pinned" ]; then if [ -n "$not_pinned" ]; then
echo "$not_pinned" | awk '{print $1}' | xargs -n 1 brew upgrade echo "$not_pinned" | awk '{print $1}' | xargs -n 1 brew upgrade
#echo "Running update package $not_pinned" #echo "Running update package $not_pinned"
else #else
echo "No package to update" # echo "No package to update"
fi fi
fi fi
echo "" echo ""
else
echo -e "\033[4mNo package to update.\033[0m"
fi fi
echo ""
# Casks # Casks
echo "🍺 Casks upgrade." echo "🍺 Casks upgrade."
@@ -313,6 +323,9 @@ name=$(basename $conf_apa)
notif1="$dir has been modified in the last 5 minutes" notif1="$dir has been modified in the last 5 minutes"
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1) test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
echo "$test"
[ ! -z $test ] && echo -e "\033[1;31m❗ $notif1\033[0m" [ ! -z $test ] && echo -e "\033[1;31m❗ $notif1\033[0m"
[ ! -z $test ] && notification "$notif1" [ ! -z $test ] && notification "$notif1"
@@ -328,6 +341,8 @@ do
php_ini=/usr/local/etc/php/$php/php.ini php_ini=/usr/local/etc/php/$php/php.ini
notif2="$php_ini has been modified" notif2="$php_ini has been modified"
echo "$php_modified"
[ ! -z $php_modified ] && echo -e "\033[1;31m❗ $notif2\033[0m" [ ! -z $php_modified ] && echo -e "\033[1;31m❗ $notif2\033[0m"
[ ! -z $php_modified ] && notification "$notif2" [ ! -z $php_modified ] && notification "$notif2"

View File

@@ -12,6 +12,7 @@ if [[ $1 == "--nodistract" ]]; then
no_distract=true no_distract=true
fi fi
# https://github.com/mas-cli/mas
# On teste si mas est installé # On teste si mas est installé
if hash mas 2>/dev/null; then if hash mas 2>/dev/null; then