4 Commits
v2.2 ... v2.3

Author SHA1 Message Date
f1a1a94886 pip.sh
Features:
-check dependances
2021-01-13 19:32:46 +01:00
7b78bbd1ca homebrew.sh
Bugfix:
- n° de version des paquets (info)
2021-01-13 14:49:41 +01:00
e6c7db1711 homebrew.sh
Feature:
-mask ‘Updating pkg/cask’ if no update awailable

Bugfix:
-display multiples versions (i e python@3.9)
2021-01-11 09:34:16 +01:00
9a9bf77fb7 pecl.sh
Features:
+display info about php config
+open php info in Safari
+support PHP 8.0
2021-01-10 18:42:18 +01:00
3 changed files with 97 additions and 49 deletions

View File

@@ -102,18 +102,32 @@ get_info_pkg() {
#urls=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.urls)' | jq -r '.stable | .url') #urls=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.urls)' | jq -r '.stable | .url')
keg_only=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.keg_only)') keg_only=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.keg_only)')
caveats=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.caveats)') caveats=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.caveats)')
stable=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.versions)' | jq -r '.stable') #stable=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.versions)' | jq -r '.stable')
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)')
#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 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)')
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]" [ "$keg_only" = true ] && l1+=" [keg-only]"
l1+="${reset}\n" l1+="${reset}\n"
else else
l1+="${bold}$name: installed: $installed stable: $stable" l1+="${bold}$name: installed: $installed stable: $current_version"
[ "$keg_only" = true ] && l1+=" [keg-only]" [ "$keg_only" = true ] && l1+=" [keg-only]"
l1+="${reset}\n" l1+="${reset}\n"
fi fi
@@ -195,11 +209,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 +305,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,41 +323,40 @@ 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
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 [ "${#cask_to_not_update[@]}" -gt 0 ] && echo -e "${red}Do not update: ${cask_to_not_update[@]} . It won't be updated!'${reset}\n"
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 "" if [ -n "$casks_not_pinned" ]; then
for i in $casks_not_pinned;
do if [ "$no_distract" = false ]; then
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then a=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_not_pinned${reset} ? (y/n/a) ")
# --cask required for Cask like 'docker'. It can be a formula or a cask. # yes/no/all
echo "$i" | xargs -p -n 1 brew upgrade --cask read -p "$a" choice
echo ""
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
echo "$i" | xargs -n 1 brew upgrade --cask echo ""
echo "" for i in $casks_not_pinned;
fi do
done 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 else
echo -e "OK, let's continue..." echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
fi fi
else
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
fi fi
else else

View File

@@ -12,6 +12,11 @@
# No distract mode (no user interaction) # No distract mode (no user interaction)
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false [[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
# #
# Display PHP informations
display_info=true
# Open PHP info in Safari
php_info=true
#
######################################### #########################################
italic="\033[3m" italic="\033[3m"
@@ -43,20 +48,18 @@ echo ""
echo -e "${bold}❗️ plugin en test (beta) ${reset}" echo -e "${bold}❗️ plugin en test (beta) ${reset}"
echo "" 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}') version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}')
v=${version:0:3} v=${version:0:3}
echo -e "Current PHP version: ${bold}$version${reset}\n"
if [ "$v" = "7.3" ]; then if [ "$v" = "7.3" ]; then
php_path=$(brew --prefix)/opt/php@7.3/bin php_path=$(brew --prefix)/opt/php@7.3/bin
elif [ "$v" = "7.2" ]; then elif [ "$v" = "7.2" ]; then
php_path=$(brew --prefix)/opt/php@7.2/bin php_path=$(brew --prefix)/opt/php@7.2/bin
elif [ "$v" = "7.4" ]; then 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 php_path=$(brew --prefix)/opt/php/bin
fi fi
@@ -99,9 +102,11 @@ if [ -n "$pecl_upgrade" ]; then
if [ "$no_distract" = false ]; then if [ "$no_distract" = false ]; then
#echo "$b" | xargs -p -n 1 pecl upgrade #echo "$b" | xargs -p -n 1 pecl upgrade
echo "$b" | xargs -p -n 1 $php_path/pecl upgrade echo "$b" | xargs -p -n 1 $php_path/pecl upgrade
php_info=true
else else
#echo "$b" | xargs -n 1 pecl upgrade #echo "$b" | xargs -n 1 pecl upgrade
echo "$b" | xargs -n 1 $php_path/pecl upgrade echo "$b" | xargs -n 1 $php_path/pecl upgrade
php_info=true
fi fi
fi fi
echo "" echo ""
@@ -119,6 +124,16 @@ dir=$(dirname "$conf_php")
name=$(basename "$conf_php") name=$(basename "$conf_php")
notif2="$conf_php was modified in the last 5 minutes" 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) test=$(find "$dir" -name "$name" -mmin -5 -maxdepth 1)
if [ -n "$test" ]; then if [ -n "$test" ]; then

View File

@@ -33,7 +33,7 @@ user=""
# Add module to the do_not_update array for prevent to update. # Add module to the do_not_update array for prevent to update.
#declare -a do_not_update=() #declare -a do_not_update=()
#declare -a do_not_update=("parso" "asgiref") #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 #$pip_version install --upgrade pip > /dev/null
echo "" echo ""
# Do not update casks # Do not update packages
if (( ${#do_not_update[@]} )); then if (( ${#do_not_update[@]} )); then
nbp=${#do_not_update[*]} 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) pip_outdated=$($pip_version list --outdated --format columns)
upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}') upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}')
#upd="asgiref CairoSVG setuptools"
# Find infos about updated packages # Find infos about updated packages
if [ -n "$upd" ]; then if [ -n "$upd" ]; then
@@ -99,27 +98,44 @@ if [ -n "$upd" ]; then
info=$($pip_version show "$i") info=$($pip_version show "$i")
l=$(echo "$info" | sed -n '1p') 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 -e "$m" | head -4
echo "" echo ""
z+="$i " z+="$i "
done done
# z = asgiref setuptools lunr
# Check dependancies # Check dependancies
if [ -x "$(command -v pipdeptree)" ] && [ "$display_depend" == true ]; then if [ -x "$(command -v pipdeptree)" ] && [ "$display_depend" == true ]; then
echo -e "🐍 ${underline}Check dependancies:${reset}\n" 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" 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') # packages dont on recherche les dépendances (x = asgiref,setuptools,lunr)
dependencies=$(echo "$z" | xargs pipdeptree -r -p ) 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 while IFS= read -r line; do
z=$(echo "${line}" | grep -i ^[a-z]) z=$(echo "${line}" | grep -i ^[a-z])
if [ -n "$z" ] ; then 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 elif [[ "${line}" = *"<"* ]]; then
echo -e "${red}${line}${reset}" echo -e "${red}${line}${reset}"
elif [[ "${line}" = *"~="* ]]; then elif [[ "${line}" = *"~="* ]]; then