Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f1a1a94886
|
|||
|
7b78bbd1ca
|
|||
|
e6c7db1711
|
|||
|
9a9bf77fb7
|
@@ -102,18 +102,32 @@ get_info_pkg() {
|
||||
#urls=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.urls)' | jq -r '.stable | .url')
|
||||
keg_only=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.keg_only)')
|
||||
caveats=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.caveats)')
|
||||
stable=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.versions)' | jq -r '.stable')
|
||||
installed=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.installed)' | jq -r '.[].version')
|
||||
#stable=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.versions)' | jq -r '.stable')
|
||||
#installed=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.installed)' | jq -r '.[].version')
|
||||
pinned=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned)')
|
||||
#echo -e "installed: $installed\n"
|
||||
|
||||
installed_versions=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.installed_versions)' | jq -r '.[]')
|
||||
current_version=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.current_version)')
|
||||
#echo -e "installed_versions: $installed_versions\n"
|
||||
#echo "stable: $current_version"
|
||||
|
||||
# Python@3.9 : multiples versions
|
||||
ins=""
|
||||
for i in $installed_versions
|
||||
do
|
||||
ins=$i
|
||||
done
|
||||
installed=$ins
|
||||
|
||||
if [ "$pinned" = "true" ]; then
|
||||
pinned_v=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned_version)')
|
||||
|
||||
l1+="${red}$name: installed: $installed stable: $stable [pinned at $pinned_v]"
|
||||
l1+="${red}$name: installed: $installed stable: $current_version [pinned at $pinned_v]"
|
||||
[ "$keg_only" = true ] && l1+=" [keg-only]"
|
||||
l1+="${reset}\n"
|
||||
else
|
||||
l1+="${bold}$name: installed: $installed stable: $stable"
|
||||
l1+="${bold}$name: installed: $installed stable: $current_version"
|
||||
[ "$keg_only" = true ] && l1+=" [keg-only]"
|
||||
l1+="${reset}\n"
|
||||
fi
|
||||
@@ -195,11 +209,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 +305,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,41 +323,40 @@ 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
|
||||
# Updating casks
|
||||
echo -e "\n🍺 ${underline}Updating casks...${reset}\n"
|
||||
|
||||
if [ "$no_distract" = false ]; then
|
||||
a=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_not_pinned${reset} ? (y/n/a) ")
|
||||
# yes/no/all
|
||||
read -p "$a" choice
|
||||
[ "${#cask_to_not_update[@]}" -gt 0 ] && echo -e "${red}Do not update: ${cask_to_not_update[@]} . It won't be updated!'${reset}\n"
|
||||
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||
echo ""
|
||||
for i in $casks_not_pinned;
|
||||
do
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||
# --cask required for Cask like 'docker'. It can be a formula or a cask.
|
||||
echo "$i" | xargs -p -n 1 brew upgrade --cask
|
||||
echo ""
|
||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||
echo "$i" | xargs -n 1 brew upgrade --cask
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$casks_not_pinned" ]; then
|
||||
|
||||
if [ "$no_distract" = false ]; then
|
||||
a=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_not_pinned${reset} ? (y/n/a) ")
|
||||
# yes/no/all
|
||||
read -p "$a" choice
|
||||
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||
echo ""
|
||||
for i in $casks_not_pinned;
|
||||
do
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||
# --cask required for Cask like 'docker'. It can be a formula or a cask.
|
||||
echo "$i" | xargs -p -n 1 brew upgrade --cask
|
||||
echo ""
|
||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||
echo "$i" | xargs -n 1 brew upgrade --cask
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "OK, let's continue..."
|
||||
fi
|
||||
else
|
||||
echo -e "OK, let's continue..."
|
||||
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
|
||||
fi
|
||||
else
|
||||
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
# No distract mode (no user interaction)
|
||||
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||
#
|
||||
# Display PHP informations
|
||||
display_info=true
|
||||
# Open PHP info in Safari
|
||||
php_info=true
|
||||
#
|
||||
#########################################
|
||||
|
||||
italic="\033[3m"
|
||||
@@ -43,20 +48,18 @@ echo ""
|
||||
echo -e "${bold}❗️ plugin en test (beta) ${reset}"
|
||||
echo ""
|
||||
|
||||
# /usr/local/Cellar/php/7.4.11/bin/pecl
|
||||
# /usr/local/Cellar/php@7.3/7.3.23/bin/pecl
|
||||
# /usr/local/Cellar/php@7.2/7.2.33/bin/pecl
|
||||
|
||||
#pecl_upgrade=$(pecl list-upgrades)
|
||||
|
||||
version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}')
|
||||
v=${version:0:3}
|
||||
echo -e "Current PHP version: ${bold}$version${reset}\n"
|
||||
|
||||
if [ "$v" = "7.3" ]; then
|
||||
php_path=$(brew --prefix)/opt/php@7.3/bin
|
||||
elif [ "$v" = "7.2" ]; then
|
||||
php_path=$(brew --prefix)/opt/php@7.2/bin
|
||||
elif [ "$v" = "7.4" ]; then
|
||||
php_path=$(brew --prefix)/opt/php@7.4/bin
|
||||
elif [ "$v" = "8.0" ]; then
|
||||
php_path=$(brew --prefix)/opt/php/bin
|
||||
fi
|
||||
|
||||
@@ -99,9 +102,11 @@ if [ -n "$pecl_upgrade" ]; then
|
||||
if [ "$no_distract" = false ]; then
|
||||
#echo "$b" | xargs -p -n 1 pecl upgrade
|
||||
echo "$b" | xargs -p -n 1 $php_path/pecl upgrade
|
||||
php_info=true
|
||||
else
|
||||
#echo "$b" | xargs -n 1 pecl upgrade
|
||||
echo "$b" | xargs -n 1 $php_path/pecl upgrade
|
||||
php_info=true
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
@@ -119,6 +124,16 @@ dir=$(dirname "$conf_php")
|
||||
name=$(basename "$conf_php")
|
||||
notif2="$conf_php was modified in the last 5 minutes"
|
||||
|
||||
if [ "$display_info" = true ]; then
|
||||
echo -e "php.ini path: ${bold}$conf_php${reset}"
|
||||
echo -e "Additionnals ini files:\n $(ls $dir/conf.d/*.ini)"
|
||||
echo -e "\nTo change php version: ${italic}$ sphp 7.4${reset}"
|
||||
echo -e "${italic}https://gist.github.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2${reset}\n"
|
||||
|
||||
host=$(hostname)
|
||||
[ "$php_info" = true ] && echo -e "Opening PHP info in Safari..." && open "https://$host.local/info.php"
|
||||
fi
|
||||
|
||||
test=$(find "$dir" -name "$name" -mmin -5 -maxdepth 1)
|
||||
|
||||
if [ -n "$test" ]; then
|
||||
|
||||
@@ -33,7 +33,7 @@ user=""
|
||||
# Add module to the do_not_update array for prevent to update.
|
||||
#declare -a do_not_update=()
|
||||
#declare -a do_not_update=("parso" "asgiref")
|
||||
declare -a do_not_update=("asgiref")
|
||||
declare -a do_not_update=("lunr")
|
||||
#
|
||||
#########################################
|
||||
|
||||
@@ -65,7 +65,7 @@ echo -e "Current ${underline}pip3${reset} version: $(pip3 -V)"
|
||||
#$pip_version install --upgrade pip > /dev/null
|
||||
echo ""
|
||||
|
||||
# Do not update casks
|
||||
# Do not update packages
|
||||
if (( ${#do_not_update[@]} )); then
|
||||
|
||||
nbp=${#do_not_update[*]}
|
||||
@@ -83,7 +83,6 @@ echo -e "🐍 ${underline}Search for packages update...${reset}\n"
|
||||
|
||||
pip_outdated=$($pip_version list --outdated --format columns)
|
||||
upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}')
|
||||
#upd="asgiref CairoSVG setuptools"
|
||||
|
||||
# Find infos about updated packages
|
||||
if [ -n "$upd" ]; then
|
||||
@@ -99,27 +98,44 @@ if [ -n "$upd" ]; then
|
||||
info=$($pip_version show "$i")
|
||||
|
||||
l=$(echo "$info" | sed -n '1p')
|
||||
m=$(sed "1s/.*/\\${bold}$l\\${reset}/" <<< "$info")
|
||||
|
||||
if [[ ! " ${do_not_update[@]} " =~ " ${i} " ]]; then
|
||||
m=$(sed "1s/.*/\\${bold}$l\\${reset}/" <<< "$info")
|
||||
else
|
||||
m=$(sed "1s/.*/\\${redbold}$l\\${reset}/" <<< "$info")
|
||||
fi
|
||||
echo -e "$m" | head -4
|
||||
echo ""
|
||||
|
||||
z+="$i "
|
||||
|
||||
done
|
||||
# z = asgiref setuptools lunr
|
||||
|
||||
# Check dependancies
|
||||
if [ -x "$(command -v pipdeptree)" ] && [ "$display_depend" == true ]; then
|
||||
|
||||
echo -e "🐍 ${underline}Check dependancies:${reset}\n"
|
||||
echo -e "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version.\n"
|
||||
|
||||
z=$(echo "$z" | sed 's/.$//' | sed 's/ /,/g')
|
||||
dependencies=$(echo "$z" | xargs pipdeptree -r -p )
|
||||
|
||||
# packages dont on recherche les dépendances (x = asgiref,setuptools,lunr)
|
||||
x=$(echo "$z" | sed 's/.$//' | sed 's/ /,/g')
|
||||
# on filtre les lignes (y = asgiref|setuptools|lunr)
|
||||
y=$(echo "$z" | sed 's/.$//' | sed 's/ /|/g')
|
||||
|
||||
dependencies=$(echo "$x" | xargs pipdeptree -r -p | grep -E $y)
|
||||
# if [[ $line =~ $y ]]; then
|
||||
|
||||
while IFS= read -r line; do
|
||||
z=$(echo "${line}" | grep -i ^[a-z])
|
||||
if [ -n "$z" ] ; then
|
||||
echo -e "\n${bold}${line}${reset}"
|
||||
|
||||
if [[ " ${do_not_update[@]} " =~ " ${line} " ]]; then
|
||||
echo -e "\n${bold}${line}${reset}"
|
||||
else
|
||||
echo -e "\n${redbold}${line}${reset}"
|
||||
fi
|
||||
|
||||
elif [[ "${line}" = *"<"* ]]; then
|
||||
echo -e "${red}${line}${reset}"
|
||||
elif [[ "${line}" = *"~="* ]]; then
|
||||
|
||||
Reference in New Issue
Block a user