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:
@@ -106,6 +106,14 @@ get_info_pkg() {
|
|||||||
installed=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.installed)' | jq -r '.[].version')
|
installed=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.installed)' | jq -r '.[].version')
|
||||||
pinned=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned)')
|
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
|
if [ "$pinned" = "true" ]; then
|
||||||
pinned_v=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned_version)')
|
pinned_v=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned_version)')
|
||||||
|
|
||||||
@@ -195,11 +203,12 @@ fi
|
|||||||
touch /tmp/checkpoint
|
touch /tmp/checkpoint
|
||||||
|
|
||||||
# Updating packages
|
# 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
|
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
|
if [ "$no_distract" = false ]; then
|
||||||
a=$(echo -e "Do you wanna run ${bold}brew upgrade "$upd_pkg_notpinned"${reset} ? (y/n/a) ")
|
a=$(echo -e "Do you wanna run ${bold}brew upgrade "$upd_pkg_notpinned"${reset} ? (y/n/a) ")
|
||||||
# yes/no/all
|
# yes/no/all
|
||||||
@@ -290,6 +299,9 @@ fi
|
|||||||
#Casks update
|
#Casks update
|
||||||
echo -e "🍺 ${underline}Search for casks update...${reset}\n"
|
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
|
# Find infos about updated casks
|
||||||
nb_casks_upd=$(echo "$upd_casks" | wc -w | xargs)
|
nb_casks_upd=$(echo "$upd_casks" | wc -w | xargs)
|
||||||
if [ "$nb_casks_upd" -gt 0 ]; then
|
if [ "$nb_casks_upd" -gt 0 ]; then
|
||||||
@@ -305,14 +317,12 @@ if [ "$nb_casks_upd" -gt 0 ]; then
|
|||||||
else
|
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}"
|
[ "$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
|
||||||
fi
|
|
||||||
|
|
||||||
# Updating casks
|
# Updating casks
|
||||||
echo -e "\n🍺 ${underline}Updating casks...${reset}\n"
|
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"
|
[ "${#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
|
if [ -n "$casks_not_pinned" ]; then
|
||||||
@@ -341,6 +351,7 @@ if [ -n "$casks_not_pinned" ]; then
|
|||||||
else
|
else
|
||||||
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
|
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\n${italic}No update cask available...${reset}\n"
|
echo -e "\n${italic}No update cask available...${reset}\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user