Update may 2021

-node.sh: info about local pacakges
-mas.sh: mas v1.8.2
-homebrew.sh: minor bugfixes
-pecl.sh: add update-channels command
This commit is contained in:
2021-05-17 16:03:20 +02:00
parent 6d98e2043e
commit 9fc8f9668f
4 changed files with 133 additions and 23 deletions

View File

@@ -92,9 +92,17 @@ get_info_cask() {
get_info_pkg() {
info="$1"
pkg="$2"
pkg2="$2"
l1=""
#echo "pkg: $pkg"
if [[ " ${pkg} " =~ "/" ]]; then
pkg=$(echo "$pkg" | awk -F"/" '{print $NF}')
fi
#echo "pkg: $pkg"
name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.name)')
#name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'")')
full_name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.full_name)')
desc=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.desc)')
homepage=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.homepage)')
@@ -107,11 +115,14 @@ get_info_pkg() {
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)')
installed_versions=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg2}'") | (.installed_versions)' | jq -r '.[]')
current_version=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg2}'") | (.current_version)')
#echo -e "installed_versions: $installed_versions\n"
#echo "stable: $current_version"
#echo "name: $name"
#echo "desc: $desc"
# Python@3.9 : multiples versions
ins=""
for i in $installed_versions
@@ -171,7 +182,10 @@ do
upd_pkg_notpinned+="$name "
fi
done
#echo "$upd_pkgs"
upd_pkgs=$(echo "$upd_pkgs" | sed 's/.$//')
#echo "$upd_pkgs"
upd_pkg_pinned=$(echo "$upd_pkg_pinned" | sed 's/.$//')
upd_pkg_notpinned=$(echo "$upd_pkg_notpinned" | sed 's/.$//')
@@ -183,8 +197,10 @@ if [ "$nb_pkg_upd" -gt 0 ]; 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"
upd_pkgs_info=$(brew info --json=v2 $upd_pkgs | jq '{formulae} | .[]')
#echo "$upd_pkgs_info"
for row in $upd_pkgs;
do
#echo "$row"
get_info_pkg "$upd_pkgs_info" "$row"
done
else
@@ -251,6 +267,10 @@ echo ""
#Casks update
echo -e "\n🍺 ${underline}Casks...${reset}\n"
upd_cask=$(echo "$brew_outdated" | jq '{casks} | .[]')
# erreur avec PureVPN et plusieurs versions installées.
# parse error: Unfinished string at EOF at line 2, column 0
# parse error: Invalid numeric literal at line 1, column 7
for row in $(jq -c '.[]' <<< "$upd_cask");
do

View File

@@ -6,6 +6,8 @@
# No distract mode (no user interaction)
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
testing=1
italic="\033[3m"
underline="\033[4m"
ita_under="\033[3;4m"
@@ -20,37 +22,101 @@ reset="\033[0m"
echo -e "${bold}🍏 Mac App Store updates come fast as lightning ${reset}"
echo -e "https://github.com/mas-cli/mas"
echo ""
echo -e "mas : https://github.com/mas-cli/mas"
latest_v=$(curl -s https://api.github.com/repos/mas-cli/mas/releases/latest | jq -j '.tag_name')
current_v=$(mas version)
echo -e "Current version: $current_v"
echo -e "Latest version: $latest_v"
# On teste si mas est installé
if hash mas 2>/dev/null; then
massy=$(mas outdated)
echo ""
echo "$massy"
#echo "$massy"
nomoreatstore=$(echo "$massy" | grep "not found in store")
outdated=$(echo "$massy" | grep -v "not found in store")
if [ -n "$(mas outdated)" ]; then
if [ -n "$outdated" ]; then
echo -e "${underline}Availables updates:${reset}"
echo "$massy" | cut -d " " -f2-5
echo "$outdated" | awk '{ $1=""; print}'
echo "--"
#echo "$outdated" | awk '{ $1=""; $3=""; print}'
echo ""
if [ "$no_distract" = false ]; then
#if [ "$no_distract" = false ]
if [[ $testing -ne 1 ]]; then
#if (( $testing == 1 )); then
a=$(echo -e "Do you wanna run \033[1mmas upgrade${reset} ? (y/n)")
read -pr "$a" choice
case "$choice" in
y|Y|o ) mas upgrade;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
#a=$(echo -e "Do you wanna run \033[1mmas upgrade${reset} ? (y/n)")
#read -pr "$a" choice
a=$(echo -e "Do you wanna run \033[1mmas upgrade${reset} ? (y/n) ")
read -p "$a" choice
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
#case "$choice" in
# y|Y|o ) mas upgrade;;
# n|N ) echo "Ok, let's continue";;
# * ) echo "invalid";;
#esac
while IFS=\n read -r line
#for line in "$outdated"
do
echo "$line"
idendifiant=$(echo "$line" | awk '{print $1}')
nom=$(echo "$line" | awk -F "(" '{print $1}' | awk '{ $1=""; print}' | xargs)
nom_version=$(echo "$line" | awk '{ $1=""; print}')
version=$(echo "$line" | awk -F "(" '{print $2}' | sed 's/.$//')
echo "$idendifiant - $nom - $version"
#echo "$version"
#b=$(echo -e "Do you wanna run ${bold}mas upgrade $nom ${reset} ${italic}$version${reset} ? (y/n) ")
#read -p "$b" upg
#echo "-- $upg --"
#if [ "$upg" == "y" ] || [ "$upg" == "Y" ]; then
# mas upgrade "$idendifiant"
#fi
echo "-- fin --"
#echo "$line" | awk '{print $1}' | xargs -p -n 1 mas upgrade
done <<< "$outdated"
#done
else
echo -e "OK, let's continue..."
fi
else
mas upgrade
#else
# mas upgrade
fi
else
echo -e "${italic}No availables mas updates.${reset}"
fi
if [ -n "$nomoreatstore" ]; then
echo -e "\n${underline}Apps no more in App Store:${reset}"
while IFS= read -r line
do
id=$(echo "$line" | awk '{print $3}')
#name=$(echo "$line" | awk '{print $12}' | sed 's/.$//')
name=$(echo "$line" | awk -F "identify" '{print $2}' | sed 's/.$//' | xargs)
echo -e "$name ($id)"
done <<< "$nomoreatstore"
fi
else
echo -e "Please install mas: ${italic}brew install mas${reset}"
fi

View File

@@ -152,7 +152,11 @@ if [ -d "$local_path" ]; then
while IFS= read -r line
do
if [[ "${line}" =~ "──" ]] || [[ "${line}" =~ "─┬" ]]; then
local_pkg=$(echo "${line}" | awk '{print $2}' | awk -F"@" '{print $1}')
echo -e "${bold}${line}${reset}"
info_pkg=$(npm view "$local_pkg" | sed -n '3,4p')
q=$(echo "$info_pkg" | sed "s/^/| /")
echo -e "$q"
else
echo -e "${line}"
fi
@@ -264,7 +268,18 @@ if [ "$doctor" = true ]; then
#npm doctor
doc=$(npm doctor)
echo -e "$doc\n"
while IFS= read -r line
do
if [[ "${line}" =~ "not ok" ]]; then
echo -e "${red}${line}${reset}"
else
echo -e "${line}"
fi
done <<< "$doc"
#echo -e "$doc\n"
# search not ok => red
npm_v=$(echo "$doc" | grep 'npm -v')
node_v=$(echo "$doc" | grep 'node -v')
@@ -286,7 +301,7 @@ if [ "$doctor" = true ]; then
npm -g install npm
#
nvm use $new_node
echo -e "\n${bold}Reinstall packages from v$old_node...${reset}"
echo -e "\n${bold}Reinstall packages from $old_node...${reset}"
nvm reinstall-packages $old_node
fi
fi

View File

@@ -63,8 +63,19 @@ elif [ "$v" = "8.0" ]; then
php_path=$(brew --prefix)/opt/php/bin
fi
pecl_list=$($php_path/pecl list)
echo -e "$pecl_list\n"
# Note that all public channels can be synced using "update-channels"
echo -e "${underline}Updating all channels...${reset}"
$php_path/pecl update-channels
#pecl channel-update pecl.php.net
#pecl channel-update pear.php.net
# List Installed Packages In The Default Channel
#pecl_list=$($php_path/pecl list)
# List installed packages from all channels
pecl_list=$($php_path/pecl list -a)
echo -e "\n$pecl_list\n"
# Installation imagick:
# https://github.com/Imagick/imagick
@@ -74,6 +85,7 @@ echo -e "$pecl_list\n"
#make
#make install
pecl_upgrade=$($php_path/pecl list-upgrades)
@@ -168,6 +180,3 @@ fi
echo ""
echo ""
# WARNING: channel "pear.php.net" has updated its protocols,
# use "pecl channel-update pear.php.net" to update