homebrew.sh

Feature:
-mask ‘Updating pkg/cask’ if no update awailable

Bugfix:
-display multiples versions (i e python@3.9)
This commit is contained in:
2021-01-11 09:34:16 +01:00
parent 9a9bf77fb7
commit e6c7db1711

View File

@@ -106,6 +106,14 @@ get_info_pkg() {
installed=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.installed)' | jq -r '.[].version')
pinned=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned)')
# Python@3.9 : multiples versions
ins=""
for i in $installed
do
ins=$i
done
installed=$ins
if [ "$pinned" = "true" ]; then
pinned_v=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned_version)')
@@ -195,11 +203,12 @@ fi
touch /tmp/checkpoint
# Updating packages
echo -e "\n🍺 ${underline}Updating packages...${reset}\n"
[ -n "$upd_pkg_notpinned" ] && echo -e "${red}Pinned: $upd_pkg_pinned . It won't be updated!'${reset}\n"
if [ -n "$upd_pkg_notpinned" ]; then
echo -e "\n🍺 ${underline}Updating packages...${reset}\n"
[ -n "$pkg_pinned" ] && echo -e "${red}Pinned: $upd_pkg_pinned . It won't be updated!'${reset}\n"
if [ "$no_distract" = false ]; then
a=$(echo -e "Do you wanna run ${bold}brew upgrade "$upd_pkg_notpinned"${reset} ? (y/n/a) ")
# yes/no/all
@@ -290,6 +299,9 @@ fi
#Casks update
echo -e "🍺 ${underline}Search for casks update...${reset}\n"
[ -n "$casks_latest_not_pinned" ] && echo -e "Some Casks have ${italic}auto_updates true${reset} or ${italic}version :latest${reset}. Homebrew Cask cannot track versions of those apps."
[ -n "$casks_latest_not_pinned" ] && echo -e "Edit this script and change the setting ${italic}latest=false${reset} to ${italic}true${reset}\n"
# Find infos about updated casks
nb_casks_upd=$(echo "$upd_casks" | wc -w | xargs)
if [ "$nb_casks_upd" -gt 0 ]; then
@@ -305,14 +317,12 @@ if [ "$nb_casks_upd" -gt 0 ]; then
else
[ "$nb_casks_upd" -gt 1 ] && echo -e "${box} $nb_casks_upd ${reset} ${array[@]/%/s}: ${bold}$upd_casks${reset}" || echo -e "${box} $nb_casks_upd ${reset} ${array[@]}: ${bold}$upd_casks${reset}"
fi
fi
# Updating casks
echo -e "\n🍺 ${underline}Updating casks...${reset}\n"
[ "${#cask_to_not_update[@]}" -gt 0 ] && echo -e "${red}Do not update: ${cask_to_not_update[@]} . It won't be updated!'${reset}\n"
[ -n "$casks_latest_not_pinned" ] && echo -e "Some Casks have ${italic}auto_updates true${reset} or ${italic}version :latest${reset}. Homebrew Cask cannot track versions of those apps."
[ -n "$casks_latest_not_pinned" ] && echo -e "Edit this script and change the setting ${italic}latest=false${reset} to ${italic}true${reset}\n"
if [ -n "$casks_not_pinned" ]; then
@@ -341,6 +351,7 @@ if [ -n "$casks_not_pinned" ]; then
else
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
fi
fi
else
echo -e "\n${italic}No update cask available...${reset}\n"