homebrew.sh
Release version 2.0
This commit is contained in:
@@ -13,7 +13,7 @@ display_info=true
|
|||||||
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
||||||
# Also add package for prevent to update whitout pin it.
|
# Also add package for prevent to update whitout pin it.
|
||||||
# declare -a do_not_update=("xnconvert" "yate")
|
# declare -a do_not_update=("xnconvert" "yate")
|
||||||
declare -a cask_to_not_update=("xld" "webpquicklook")
|
declare -a cask_to_not_update=()
|
||||||
|
|
||||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
||||||
no_distract=false
|
no_distract=false
|
||||||
@@ -130,7 +130,7 @@ get_info_pkg() {
|
|||||||
echo -e "${bold}🍺 Homebrew ${reset}"
|
echo -e "${bold}🍺 Homebrew ${reset}"
|
||||||
|
|
||||||
echo -e "\n🍺 ${underline}Updating brew...${reset}\n"
|
echo -e "\n🍺 ${underline}Updating brew...${reset}\n"
|
||||||
#brew update
|
brew update
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
brew_outdated=$(brew outdated --greedy --json=v2)
|
brew_outdated=$(brew outdated --greedy --json=v2)
|
||||||
@@ -173,14 +173,11 @@ if [ "$nb_pkg_upd" -gt 0 ]; then
|
|||||||
if [ "$display_info" = true ]; then
|
if [ "$display_info" = true ]; then
|
||||||
[ "$nb_pkg_upd" -gt 1 ] && echo -e "${box} $nb_pkg_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_pkg_upd ${reset} ${array[@]}:\n"
|
[ "$nb_pkg_upd" -gt 1 ] && echo -e "${box} $nb_pkg_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_pkg_upd ${reset} ${array[@]}:\n"
|
||||||
upd_pkgs_info=$(brew info --json=v2 $upd_pkgs | jq '{formulae} | .[]')
|
upd_pkgs_info=$(brew info --json=v2 $upd_pkgs | jq '{formulae} | .[]')
|
||||||
#echo $upd_pkgs_info | jq
|
|
||||||
for row in $upd_pkgs;
|
for row in $upd_pkgs;
|
||||||
do
|
do
|
||||||
get_info_pkg "$upd_pkgs_info" "$row"
|
get_info_pkg "$upd_pkgs_info" "$row"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
#a="available package update"
|
|
||||||
#array=($a)
|
|
||||||
[ "$nb_pkg_upd" -gt 1 ] && echo -e "${box} $nb_pkg_upd ${reset} ${array[@]/%/s}: ${bold}$upd_pkgs${reset}" || echo -e "${box} $nb_pkg_upd ${reset} ${array[@]}: ${bold}$upd_pkgs${reset}"
|
[ "$nb_pkg_upd" -gt 1 ] && echo -e "${box} $nb_pkg_upd ${reset} ${array[@]/%/s}: ${bold}$upd_pkgs${reset}" || echo -e "${box} $nb_pkg_upd ${reset} ${array[@]}: ${bold}$upd_pkgs${reset}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -218,7 +215,7 @@ if [ -n "$upd_pkg_notpinned" ]; then
|
|||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
echo "$i" | xargs -p -n 1 brew upgrade
|
echo "$i" | xargs -p -n 1 brew upgrade
|
||||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
echo "$i" | xargs -n 1 brew upgrade --dry-run
|
echo "$i" | xargs -n 1 brew upgrade
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@@ -239,11 +236,9 @@ fi
|
|||||||
#############
|
#############
|
||||||
|
|
||||||
#Casks update
|
#Casks update
|
||||||
echo -e "\n🍺 ${underline}Casks...${reset}"
|
echo -e "\n🍺 ${underline}Casks...${reset}\n"
|
||||||
upd_cask=$(echo "$brew_outdated" | jq '{casks} | .[]')
|
upd_cask=$(echo "$brew_outdated" | jq '{casks} | .[]')
|
||||||
#echo "$upd_cask"
|
|
||||||
|
|
||||||
#i=0
|
|
||||||
for row in $(jq -c '.[]' <<< "$upd_cask");
|
for row in $(jq -c '.[]' <<< "$upd_cask");
|
||||||
do
|
do
|
||||||
name=$(echo "$row" | jq -j '.name')
|
name=$(echo "$row" | jq -j '.name')
|
||||||
@@ -266,7 +261,7 @@ if (( ${#cask_to_not_update[@]} )); then
|
|||||||
|
|
||||||
nbp=${#cask_to_not_update[*]}
|
nbp=${#cask_to_not_update[*]}
|
||||||
|
|
||||||
echo -e "\n${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
echo -e "${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
||||||
echo -e "${red}${cask_to_not_update[*]}${reset}"
|
echo -e "${red}${cask_to_not_update[*]}${reset}"
|
||||||
echo -e "To remove package from this list, you need to edit the ${italic}do_not_update${reset} array."
|
echo -e "To remove package from this list, you need to edit the ${italic}do_not_update${reset} array."
|
||||||
echo ""
|
echo ""
|
||||||
@@ -274,9 +269,7 @@ if (( ${#cask_to_not_update[@]} )); then
|
|||||||
casks_not_pinned=""
|
casks_not_pinned=""
|
||||||
for i in $upd_casks
|
for i in $upd_casks
|
||||||
do
|
do
|
||||||
#echo "$i"
|
|
||||||
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
#echo "$i"
|
|
||||||
casks_not_pinned+="$i "
|
casks_not_pinned+="$i "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -285,9 +278,7 @@ if (( ${#cask_to_not_update[@]} )); then
|
|||||||
casks_latest_not_pinned=""
|
casks_latest_not_pinned=""
|
||||||
for i in $upd_casks_latest
|
for i in $upd_casks_latest
|
||||||
do
|
do
|
||||||
#echo "$i"
|
|
||||||
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
#echo "$i"
|
|
||||||
casks_latest_not_pinned+="$i "
|
casks_latest_not_pinned+="$i "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -309,7 +300,6 @@ if [ "$nb_casks_upd" -gt 0 ]; then
|
|||||||
if [ "$display_info" = true ]; then
|
if [ "$display_info" = true ]; then
|
||||||
[ "$nb_casks_upd" -gt 1 ] && echo -e "${box} $nb_casks_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_casks_upd ${reset} ${array[@]}:\n"
|
[ "$nb_casks_upd" -gt 1 ] && echo -e "${box} $nb_casks_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_casks_upd ${reset} ${array[@]}:\n"
|
||||||
upd_casks_info=$(brew info --json=v2 $upd_casks | jq '{casks} | .[]')
|
upd_casks_info=$(brew info --json=v2 $upd_casks | jq '{casks} | .[]')
|
||||||
#echo "$upd_casks_info" | jq
|
|
||||||
for row in $upd_casks;
|
for row in $upd_casks;
|
||||||
do
|
do
|
||||||
get_info_cask "$upd_casks_info" "$row"
|
get_info_cask "$upd_casks_info" "$row"
|
||||||
@@ -348,7 +338,6 @@ if [ -n "$casks_not_pinned" ]; then
|
|||||||
echo -e "OK, let's continue..."
|
echo -e "OK, let's continue..."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
#echo "No distract"
|
|
||||||
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --dry-run
|
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --dry-run
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -372,7 +361,6 @@ if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then
|
|||||||
[ "$nb_casks_latest_upd" -gt 1 ] && echo -e "${box} $nb_casks_latest_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_casks_latest_upd ${reset} ${array[@]}:\n"
|
[ "$nb_casks_latest_upd" -gt 1 ] && echo -e "${box} $nb_casks_latest_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_casks_latest_upd ${reset} ${array[@]}:\n"
|
||||||
|
|
||||||
upd_casks_latest_info=$(brew info --json=v2 $upd_casks_latest | jq '{casks} | .[]')
|
upd_casks_latest_info=$(brew info --json=v2 $upd_casks_latest | jq '{casks} | .[]')
|
||||||
echo "$upd_casks_latest_info" | jq
|
|
||||||
for row in $upd_casks_latest;
|
for row in $upd_casks_latest;
|
||||||
do
|
do
|
||||||
get_info_cask "$upd_casks_latest_info" "$row"
|
get_info_cask "$upd_casks_latest_info" "$row"
|
||||||
@@ -393,10 +381,10 @@ if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then
|
|||||||
for i in $casks_latest_not_pinned
|
for i in $casks_latest_not_pinned
|
||||||
do
|
do
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
echo "\n$i" | xargs -p -n 1 brew upgrade --dry-run
|
echo "\n$i" | xargs -p -n 1 brew upgrade
|
||||||
echo ""
|
echo ""
|
||||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
echo "\n$i" | xargs -n 1 brew upgrade --dry-run
|
echo "\n$i" | xargs -n 1 brew upgrade
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -406,9 +394,8 @@ if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
#echo "No distract"
|
|
||||||
echo -e "Running ${bold}brew upgrade $casks_latest_not_pinned${reset}..."
|
echo -e "Running ${bold}brew upgrade $casks_latest_not_pinned${reset}..."
|
||||||
echo "$casks_latest_not_pinned" | xargs -n 1 brew upgrade --dry-run
|
echo "$casks_latest_not_pinned" | xargs -n 1 brew upgrade
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -439,7 +426,6 @@ do
|
|||||||
if [ -n "$upd_pkg" ]; then
|
if [ -n "$upd_pkg" ]; then
|
||||||
|
|
||||||
# file modified since it was last read
|
# file modified since it was last read
|
||||||
|
|
||||||
php_modified=$(find /usr/local/etc/php/$php/ -name php.ini -newer /tmp/checkpoint)
|
php_modified=$(find /usr/local/etc/php/$php/ -name php.ini -newer /tmp/checkpoint)
|
||||||
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"
|
||||||
@@ -460,7 +446,7 @@ echo ""
|
|||||||
|
|
||||||
echo -e "\n🍺 ${underline}The Doc is checking that everything is ok...${reset}\n"
|
echo -e "\n🍺 ${underline}The Doc is checking that everything is ok...${reset}\n"
|
||||||
|
|
||||||
#brew doctor
|
brew doctor
|
||||||
|
|
||||||
brew missing
|
brew missing
|
||||||
status=$?
|
status=$?
|
||||||
|
|||||||
Reference in New Issue
Block a user