Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
4b06dd1079
|
|||
|
6895aa8cc5
|
|||
|
6e8361312c
|
|||
|
a434e2814a
|
|||
|
0077eaca53
|
|||
|
81afb2846e
|
|||
|
285b991b09
|
|||
|
3651ee64be
|
|||
|
3eeff4b705
|
|||
|
4620ab071d
|
|||
| 78f4158361 | |||
| e5ae3745f7 | |||
| 1648fbb13e | |||
| 80e905ec4e | |||
| 3f61fa4a57 | |||
| 648bd9d211 | |||
| be093d2455 |
0
.gitattributes
vendored
Normal file
0
.gitattributes
vendored
Normal file
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
@@ -30,6 +30,7 @@ Optionnal:
|
||||
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) *(pip install pipdeptree)* for checking dependancies (pip plugin)
|
||||
- [jq](https://github.com/stedolan/jq) *(brew install jq)* for processing JSON data (homebrew plugin)
|
||||
- [terminal-notifier](https://github.com/julienXX/terminal-notifier) *(brew install terminal-notifier)* for sending macOS notification (all plugins)
|
||||
- [Bash 5](https://www.gnu.org/software/bash/) *(brew install bash)* for associative array (homebrew plugin)
|
||||
|
||||
|
||||
|
||||
|
||||
123
plugins.d/antibody.sh
Executable file
123
plugins.d/antibody.sh
Executable file
@@ -0,0 +1,123 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Antibody plugin for KYMSU
|
||||
# https://github.com/welcoMattic/kymsu
|
||||
# https://github.com/getantibody/antibody
|
||||
|
||||
###############################################################################################
|
||||
#
|
||||
# Settings:
|
||||
|
||||
# Display info on updated pakages
|
||||
display_info=true
|
||||
|
||||
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
||||
# Also add package for prevent to update whitout pin it.
|
||||
declare -a do_not_update=('')
|
||||
|
||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
||||
no_distract=false
|
||||
#
|
||||
###############################################################################################
|
||||
#
|
||||
# Recommended software (brew install):
|
||||
# -jq (Lightweight and flexible command-line JSON processor)
|
||||
# -terminal-notifier (Send macOS User Notifications from the command-line)
|
||||
#
|
||||
###############################################################################################
|
||||
|
||||
notification() {
|
||||
sound="Basso"
|
||||
title="Antibody"
|
||||
#subtitle="Attention !!!"
|
||||
message="$1"
|
||||
image_err="error.png"
|
||||
image_ok="success.png"
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifiera)" ]; then
|
||||
terminal-notifier -title "$title" -message "$message" -sound "$sound" -contentImage "$image_ok"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]] && [ -n "$(which alerter)" ]; then
|
||||
alerter -title "$title" -subtitle "" -message "$message" -sound "$sound" -contentImage "$image_ok" -timeout 3
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [[ $1 == "--nodistract" ]]; then
|
||||
no_distract=true
|
||||
fi
|
||||
|
||||
echo -e "\033[1m🙏 Antibody \033[0m"
|
||||
echo ""
|
||||
|
||||
antibody_folder=$(antibody home)
|
||||
|
||||
update=$(antibody update 2>&1)
|
||||
|
||||
installed=$(echo "$update" | grep "updating")
|
||||
updated=$(echo "$update" | grep "updated")
|
||||
|
||||
if [ -n "$installed" ]; then
|
||||
echo -e "\033[4mAntibody modules installed:\033[0m"
|
||||
#echo "$installed"
|
||||
|
||||
IFS=$'\n'
|
||||
#for i in $(echo "$update" | grep "updating")
|
||||
for i in $(echo "$installed")
|
||||
do
|
||||
url=$(echo "$i" | awk '{print $3}')
|
||||
module=$(echo "$i" | awk -F "/" '{print $NF}')
|
||||
echo -e "\033[1m$module\033[0m ($url)"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Modules are installed in $antibody_folder folder."
|
||||
else
|
||||
echo -e "\033[4mNo Antibody modules installed.\033[0m"
|
||||
fi
|
||||
|
||||
<<COMMENT
|
||||
antibody: updating: https://github.com/zsh-users/zsh-history-substring-search
|
||||
antibody: updating: https://github.com/zsh-users/zsh-completions
|
||||
antibody: updating: https://github.com/zsh-users/zsh-autosuggestions
|
||||
antibody: updating: https://github.com/mafredri/zsh-async
|
||||
antibody: updating: https://github.com/zdharma/fast-syntax-highlighting
|
||||
antibody: updating: https://github.com/sindresorhus/pure
|
||||
antibody: updating: https://github.com/marzocchi/zsh-notify
|
||||
COMMENT
|
||||
|
||||
echo ""
|
||||
|
||||
if [ -n "$updated" ]; then
|
||||
echo -e "\033[4mAntibody modules to update:\033[0m"
|
||||
#echo "$updated"
|
||||
|
||||
IFS=$'\n'
|
||||
for j in $(echo "$updated")
|
||||
do
|
||||
url=$(echo "$j" | awk '{print $3}')
|
||||
module=$(echo "$j" | awk -F "/" '{print $NF}' | awk '{print $1}')
|
||||
commit=$(echo "$j" | awk -F "$url" '{print $NF}')
|
||||
last_commit=$(echo "$commit" | awk '{print $NF}')
|
||||
echo -e "\033[1m$module\033[0m ($url)"
|
||||
echo "Commits: $commit"
|
||||
echo "Last commit: "$url"/commits/"$last_commit
|
||||
# https://github.com/zsh-users/zsh-completions/commits/
|
||||
|
||||
notif="$module has been updated"
|
||||
notification "$notif"
|
||||
done
|
||||
else
|
||||
echo -e "\033[4mNo Antibody modules to update.\033[0m"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
<<COMMENT
|
||||
antibody: updated: https://github.com/mafredri/zsh-async 95c2b15 -> 490167c
|
||||
antibody: updated: https://github.com/marzocchi/zsh-notify 4eea098 -> 8a4abe7
|
||||
antibody: updated: https://github.com/sindresorhus/pure 0a92b02 -> 3a5355b
|
||||
antibody: updated: https://github.com/zdharma/fast-syntax-highlighting 303eeee -> 865566c
|
||||
antibody: updated: https://github.com/zsh-users/zsh-completions ed0c7a7 -> 16b8947
|
||||
COMMENT
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
@@ -18,7 +18,7 @@ display_info=true
|
||||
|
||||
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
||||
# Also add package for prevent to update whitout pin it.
|
||||
declare -a do_not_update=('')
|
||||
declare -a do_not_update=("xnconvert" "yate")
|
||||
|
||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
||||
no_distract=false
|
||||
@@ -49,98 +49,131 @@ if [[ $1 == "--nodistract" ]]; then
|
||||
fi
|
||||
|
||||
echo -e "\033[1m🍺 Homebrew \033[0m"
|
||||
echo ""
|
||||
|
||||
brew update
|
||||
|
||||
echo "Search for packages update..."
|
||||
echo ""
|
||||
|
||||
# Pinned packages
|
||||
declare -A array_info # bash 5
|
||||
declare -A array_info_cask
|
||||
|
||||
brew_pinned=$(brew list --pinned | xargs)
|
||||
#brew_pinned=`echo $brew_pinned | sed 's/ *$//g'`
|
||||
#brew_pinned=`echo $brew_pinned | xargs`
|
||||
if [ -x "$(command -v jq)" ]; then
|
||||
|
||||
if [ -n "$brew_pinned" ]; then
|
||||
### Recherche des mises-à-jour ###
|
||||
|
||||
brew_outdated2=$(brew outdated --greedy --json=v2)
|
||||
upd_json=$(echo "$brew_outdated2")
|
||||
|
||||
upd_package=$(echo "$upd_json" | jq '{formulae} | .[]')
|
||||
|
||||
nbp=$(echo "$brew_pinned" | wc -w | xargs)
|
||||
upd_cask=$(echo "$upd_json" | jq '{casks} | .[]')
|
||||
|
||||
|
||||
### Liste des mises-à-jour (paquets et casks) ###
|
||||
|
||||
for row in $(jq -c '{formulae} | .[] | .[]' <<< "$upd_json");
|
||||
do
|
||||
name=$(echo "$row" | jq -j '.name')
|
||||
pinned=$(echo "$row" | jq -j '.pinned')
|
||||
|
||||
upd_pkg+="$name "
|
||||
if [ "$pinned" = true ]; then
|
||||
upd_pkg_pinned+="$name "
|
||||
fi
|
||||
done
|
||||
upd_pkg=$(echo "$upd_pkg" | sed 's/.$//')
|
||||
upd_pkg_pinned=$(echo "$upd_pkg_pinned" | sed 's/.$//')
|
||||
|
||||
pkg_pinned=$(brew list --pinned | xargs)
|
||||
|
||||
<<COMMENT
|
||||
for row2 in $(jq -c '{casks} | .[] | .[]' <<< "$upd_json");
|
||||
do
|
||||
name=$(echo "$row2" | jq -j '.name')
|
||||
upd_casks+="$name "
|
||||
done
|
||||
upd_casks=$(echo "$upd_casks" | sed 's/.$//')
|
||||
echo "$upd_casks"
|
||||
COMMENT
|
||||
|
||||
### Recherche des infos sur les paquets ###
|
||||
|
||||
if [ -n "$upd_pkg" ]; then
|
||||
# Only 1 request 'brew info' for all updated packages
|
||||
info=$(brew info --json=v1 $upd_pkg)
|
||||
|
||||
i=0
|
||||
for row in $(echo "${info}" | jq -r '.[] | @base64');
|
||||
do
|
||||
_jq() {
|
||||
echo ${row} | base64 --decode | jq -r ${1}
|
||||
}
|
||||
|
||||
name=$(_jq '.name')
|
||||
homepage=$(_jq '.homepage')
|
||||
# encoding to base64 to prevent errors with some characters (')
|
||||
desc=$(_jq '.desc' | base64 --break=0) # BSD: break=0 GNU: wrap=0
|
||||
pinned=$(_jq '.pinned')
|
||||
installed_v=$(_jq '.installed[].version')
|
||||
stable=$(_jq '.versions.stable')
|
||||
|
||||
eval "declare -a array_info$i=($name $homepage $desc $pinned $installed_v $stable)"
|
||||
((i++))
|
||||
done
|
||||
nb_upd_pkg=$i
|
||||
i=0
|
||||
fi
|
||||
|
||||
else
|
||||
brew_outdated=$(brew outdated)
|
||||
upd_pkg=$(echo "$brew_outdated" | awk '{print $1}')
|
||||
|
||||
if [ -n "$upd_pkg" ]; then
|
||||
info=$(brew info $upd_pkg)
|
||||
for i in $upd_pkg
|
||||
do
|
||||
a=$(grep -A 3 "$i: stable" <<< "$info")
|
||||
array_info["$i"]="$a"
|
||||
done
|
||||
nb_upd_pkg=${#array_info[@]}
|
||||
fi
|
||||
fi
|
||||
|
||||
#echo "$upd_pkg"
|
||||
#echo "$upd_pkg_pinned"
|
||||
|
||||
|
||||
### Display pinned packages ##
|
||||
|
||||
if [ -n "$pkg_pinned" ]; then
|
||||
|
||||
nbp=$(echo "$pkg_pinned" | wc -w | xargs)
|
||||
|
||||
echo -e "\033[4mList of\033[0m \033[1;41m $nbp \033[0m \033[4mpinned packages:\033[0m"
|
||||
echo -e "\033[1;31m$brew_pinned\033[0m"
|
||||
echo -e "\033[1;31m$pkg_pinned\033[0m"
|
||||
echo "To update a pinned package, you need to un-pin it manually (brew unpin <formula>)"
|
||||
echo ""
|
||||
|
||||
fi
|
||||
|
||||
# A pinned package is in 'brew outdated'
|
||||
|
||||
declare -A array_info
|
||||
### Display infos for all updated packages ##
|
||||
|
||||
if [ -x "$(command -v jq)" ]; then
|
||||
brew_outdated=$(brew outdated --json)
|
||||
upd_json=$(echo "$brew_outdated" )
|
||||
|
||||
for row in $(jq -c '.[]' <<< "$upd_json");
|
||||
do
|
||||
name=$(echo "$row" | jq -j '.name, "\n"');
|
||||
upd3+="$name "
|
||||
done
|
||||
upd3=$(echo "$upd3" | sed 's/.$//')
|
||||
|
||||
# Only 1 request 'brew info' for all updated packages
|
||||
info=$(brew info --json=v1 $upd3)
|
||||
|
||||
i=0
|
||||
for row in $(echo "${info}" | jq -r '.[] | @base64');
|
||||
do
|
||||
_jq() {
|
||||
echo ${row} | base64 --decode | jq -r ${1}
|
||||
}
|
||||
|
||||
name=$(_jq '.name')
|
||||
homepage=$(_jq '.homepage')
|
||||
# encoding to base64 to prevent errors with some characters (')
|
||||
desc=$(_jq '.desc' | base64 --break=0) # BSD: break=0 GNU: wrap=0
|
||||
pinned=$(_jq '.pinned')
|
||||
installed_v=$(_jq '.installed[].version')
|
||||
stable=$(_jq '.versions.stable')
|
||||
#linked=$(_jq '.linked_keg')
|
||||
|
||||
eval "declare -a array_info$i=($name $homepage $desc $pinned $installed_v $stable)"
|
||||
|
||||
((i++))
|
||||
done
|
||||
nb=$i
|
||||
i=0
|
||||
|
||||
else
|
||||
brew_outdated=$(brew outdated)
|
||||
upd3=$(echo "$brew_outdated" | awk '{print $1}')
|
||||
|
||||
info=$(brew info $upd3)
|
||||
for i in $upd3
|
||||
do
|
||||
a=$(grep -A 3 "$i: stable" <<< "$info")
|
||||
array_info["$i"]="$a"
|
||||
done
|
||||
nb=${#array_info[@]}
|
||||
fi
|
||||
|
||||
# Get infos for all updated packages
|
||||
|
||||
if [ -n "$upd3" ]; then
|
||||
if [ -n "$upd_pkg" ]; then
|
||||
|
||||
# Display info on outdated packages
|
||||
|
||||
if [ "$display_info" = true ]; then
|
||||
echo -e "\033[4mInfo on\033[0m \033[1;41m $nb \033[0m \033[4mupdated packages:\033[0m"
|
||||
echo -e "\033[4mInfo on\033[0m \033[1;41m $nb_upd_pkg \033[0m \033[4mupdated packages:\033[0m"
|
||||
|
||||
if [ -x "$(command -v jq)" ]; then
|
||||
# ok avec jq installé
|
||||
|
||||
i=0
|
||||
for row in $(jq -c '.[]' <<< "$upd_json");
|
||||
for row in $(jq -c '.[]' <<< "$upd_package");
|
||||
do
|
||||
|
||||
name=$(echo "$row" | jq -j '.name, "\n"');
|
||||
pinned=$(echo "$row" | jq -j '.pinned, "\n"');
|
||||
pinned_v=$(echo "$row" | jq -j '.pinned_version, "\n"');
|
||||
@@ -152,9 +185,12 @@ if [ -n "$upd3" ]; then
|
||||
#name=$(echo ${!n})
|
||||
h="array_info$i[1]"
|
||||
homepage=$(echo ${!h})
|
||||
|
||||
d="array_info$i[2]"
|
||||
desc=$(echo ${!d} | base64 --decode)
|
||||
|
||||
#echo "$name - $homepage - $desc"
|
||||
|
||||
#info_pkg=$(brew info --json=v1 "$name")
|
||||
#homepage=$(echo "$info_pkg" | jq -r .[].homepage)
|
||||
#desc=$(echo "$info_pkg" | jq -r .[].desc)
|
||||
@@ -162,22 +198,23 @@ if [ -n "$upd3" ]; then
|
||||
#stable=$(echo "$info_pkg" | jq -r .[].versions.stable)
|
||||
#pined=$(echo "$info_pkg" | jq -r .[].pinned)
|
||||
|
||||
upd+="$name "
|
||||
|
||||
if [ "$pinned" = "true" ]; then echo -e "\033[1;31m$name: installed: $installed_v stable: $current_v [pinned at $pinned_v]\033[0m";
|
||||
else echo -e "\033[1;37m$name: installed: $installed_v stable: $current_v\033[0m";
|
||||
if [ "$pinned" = "true" ]; then
|
||||
l1+="\033[1;31m$name: installed: $installed_v stable: $current_v [pinned at $pinned_v]\033[0m\n";
|
||||
else
|
||||
l1+="\033[1;37m$name: installed: $installed_v stable: $current_v\033[0m\n";
|
||||
fi
|
||||
if [ "$desc" != "null" ]; then echo "$desc"; fi;
|
||||
echo -e "\033[4m$homepage\033[0m"
|
||||
echo ""
|
||||
|
||||
if [ "$desc" != "null" ]; then l1+="$desc\n"; fi;
|
||||
l1+="\033[4m$homepage\033[0m\n"
|
||||
l1+="\n"
|
||||
|
||||
((i++))
|
||||
done
|
||||
upd3=$upd
|
||||
|
||||
echo -e "$l1"
|
||||
else
|
||||
# ok sans jq
|
||||
|
||||
for pkg in $upd3
|
||||
for pkg in $upd_pkg
|
||||
do
|
||||
info_pkg="${array_info[$pkg]}"
|
||||
ligne1=$(echo "$info_pkg" | head -n 1)
|
||||
@@ -195,28 +232,34 @@ if [ -n "$upd3" ]; then
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Usefull for notify recent modification of apache/mysql/php conf files.
|
||||
|
||||
|
||||
### Usefull for notify recent modification of apache/mysql/php conf files. ###
|
||||
touch /tmp/checkpoint
|
||||
|
||||
# Remove pinned packages from outdated packages list
|
||||
|
||||
### Remove pinned packages from outdated packages list ###
|
||||
|
||||
not_pinned=""
|
||||
for i in $upd3
|
||||
for i in $upd_pkg
|
||||
do
|
||||
if [[ $brew_pinned != *"$i"* ]]; then
|
||||
not_pinned+="$i "
|
||||
if [[ ! " ${upd_pkg_pinned[@]} " =~ " ${i} " ]]; then
|
||||
# whatever you want to do when array doesn't contain value
|
||||
not_pinned+="$i "
|
||||
fi
|
||||
|
||||
done
|
||||
not_pinned=$(echo "$not_pinned" | sed 's/.$//')
|
||||
|
||||
# Update outdated packages
|
||||
|
||||
### Update outdated packages ###
|
||||
|
||||
if [ "$no_distract" = false ]; then
|
||||
|
||||
if [ -n "$not_pinned" ]; then
|
||||
|
||||
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$not_pinned"\033[0m ? (y/n)")
|
||||
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$not_pinned"\033[0m ? (y/n/a)")
|
||||
# yes/no/all
|
||||
read -p "$a" choice
|
||||
#case "$choice" in
|
||||
# y|Y ) echo "$brew_outdated" | awk '{print $1}' | xargs -p -n 1 brew upgrade ;;
|
||||
@@ -224,87 +267,227 @@ if [ -n "$upd3" ]; then
|
||||
# * ) echo "invalid";;
|
||||
#esac
|
||||
|
||||
if [ "$choice" == "y" ]; then
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||
|
||||
for i in $not_pinned
|
||||
do
|
||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||
if [ "${FOUND}" = "" ]; then
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew upgrade
|
||||
#echo "Running update package $i "
|
||||
#fi
|
||||
echo ""
|
||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||
echo "$i" | awk '{print $1}' | xargs -n 1 brew upgrade
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Ok, let's continue"
|
||||
fi
|
||||
else
|
||||
echo "No package to update"
|
||||
fi
|
||||
|
||||
else # no distract = true
|
||||
|
||||
if [ -n "$not_pinned" ]; then
|
||||
echo "$not_pinned" | awk '{print $1}' | xargs -n 1 brew upgrade
|
||||
#echo "Running update package $not_pinned"
|
||||
else
|
||||
echo "No package to update"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
|
||||
else
|
||||
echo -e "\033[4mNo package to update.\033[0m"
|
||||
fi
|
||||
|
||||
# Casks
|
||||
echo ""
|
||||
|
||||
echo "🍺 Casks upgrade."
|
||||
#################
|
||||
##### CASKS #####
|
||||
#################
|
||||
|
||||
cask_outdated=$(brew cask outdated --greedy --verbose)
|
||||
echo -e "\033[1m🍺 Casks upgrade \033[0m"
|
||||
echo ""
|
||||
|
||||
outdated=$(echo "$cask_outdated" | grep -v '(latest)')
|
||||
if [ -n "$outdated" ]; then
|
||||
echo "Search for Casks update..."
|
||||
echo ""
|
||||
|
||||
# don't stop multiples updates if one block (bad checksum, not compatible with OS version (Onyx))
|
||||
sea=$(echo "$outdated" | awk '{print $1}')
|
||||
|
||||
for i in $sea
|
||||
do
|
||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||
i=0
|
||||
for row in $(jq -c '.[]' <<< "$upd_cask");
|
||||
do
|
||||
name=$(echo "$row" | jq -j '.name')
|
||||
installed_versions=$(echo "$row" | jq -j '.installed_versions')
|
||||
current_version=$(echo "$row" | jq -j '.current_version')
|
||||
|
||||
if [ "${FOUND}" == "" ]; then
|
||||
echo "$i" | xargs brew cask reinstall
|
||||
fi
|
||||
done
|
||||
if [ "$current_version" != "latest" ]; then
|
||||
upd_casks+="$name "
|
||||
|
||||
eval "declare -a array_info_cask$i=($name $installed_versions $current_version)"
|
||||
((i++))
|
||||
|
||||
elif [ "$current_version" == "latest" ]; then
|
||||
upd_casks_latest+="$name "
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
upd_casks=$(echo "$upd_casks" | sed 's/.$//')
|
||||
upd_casks_latest=$(echo "$upd_casks_latest" | sed 's/.$//')
|
||||
|
||||
nb_upd_casks=$(echo "$upd_casks" | wc -w | xargs)
|
||||
nb_upd_casks_latest=$(echo "$upd_casks_latest" | wc -w | xargs)
|
||||
|
||||
|
||||
if [ -z "$upd_casks" ] && [ -z "$upd_casks_latest" ]; then
|
||||
|
||||
echo -e "\033[4mNo availables Cask updates.\033[0m"
|
||||
|
||||
else
|
||||
echo -e "\033[4mNo availables Cask updates.\033[0m"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
latest=$(echo "$cask_outdated" | grep '(latest)')
|
||||
if [ -n "$upd_casks" ]; then
|
||||
|
||||
if [ -n "$latest" ] && [ "$no_distract" = false ]; then
|
||||
echo -e "\033[4mCasks (latest):\033[0m"
|
||||
echo "$latest" | cut -d " " -f1,2
|
||||
echo -e "\033[1;41m $nb_upd_casks \033[0m \033[4mAvailables Casks updates:\033[0m"
|
||||
#echo "upd_casks: $upd_casks"
|
||||
|
||||
# Display info on outdated packages
|
||||
|
||||
if [ "$display_info" = true ]; then
|
||||
|
||||
info_cask=$(brew cask info $upd_casks)
|
||||
|
||||
for i in $upd_casks
|
||||
do
|
||||
b=$(grep -A 1 "$i:" <<< "$info_cask")
|
||||
bb=$(echo "$b" | tail -n 1)
|
||||
#echo "b: $b - bb: $bb"
|
||||
array_info_cask["$i"]="$bb"
|
||||
done
|
||||
|
||||
l1=""
|
||||
for row in $(jq -c '.[]' <<< "$upd_cask");
|
||||
do
|
||||
installed_versions=$(echo "$row" | jq -j '.installed_versions')
|
||||
if [ "$installed_versions" != "latest" ]; then
|
||||
name=$(echo "$row" | jq -j '.name')
|
||||
current_version=$(echo "$row" | jq -j '.current_version')
|
||||
url=${array_info_cask[$name]}
|
||||
|
||||
if [[ ! " ${do_not_update[@]} " =~ " ${name} " ]]; then
|
||||
#echo "$name est à updater"
|
||||
l1+="\033[1;37m$name: installed: $installed_versions current: $current_version\033[0m\n"
|
||||
else
|
||||
l1+="\033[1;31m$name: installed: $installed_versions current: $current_version [Do not update]\033[0m\n"
|
||||
fi
|
||||
l1+="$url\n\n"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "$l1" | sed ':a;N;$!ba;s/\n//g'
|
||||
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
#brew cask info betterzip
|
||||
|
||||
# boucle for: don't stop multiples updates if one block (bad checksum, not compatible with OS version (Onyx))
|
||||
|
||||
for i in $upd_casks
|
||||
do
|
||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||
|
||||
if [ "${FOUND}" == "" ]; then
|
||||
#echo "$i" | xargs brew cask reinstall
|
||||
#echo "$i" | xargs -p -n 1 brew reinstall
|
||||
#echo "$i" | xargs -p -n 1 brew upgrade --cask
|
||||
|
||||
b=$(echo -e "Do you wanna run \033[1;37mbrew upgrade homebrew/cask/$i\033[0m ? (y/n)")
|
||||
read -p "$b" choice
|
||||
#read -p "\033[1;37mbrew upgrade homebrew/cask/$i\033[0m ? (y/n)" choice
|
||||
if [ "$choice" == "y" ]; then
|
||||
brew upgrade homebrew/cask/$i
|
||||
echo ""
|
||||
fi
|
||||
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
read -p "Do you wanna run Cask (latest) upgrade? (y/n)" choice
|
||||
if [ -n "$upd_casks_latest" ] && [ "$no_distract" = false ]; then
|
||||
|
||||
echo -e "\033[1;41m $nb_upd_casks_latest \033[0m \033[4mCasks (latest) updates:\033[0m"
|
||||
#echo "upd_casks_latest: $upd_casks_latest"
|
||||
|
||||
# Display info on outdated packages
|
||||
|
||||
if [ "$display_info" = true ]; then
|
||||
|
||||
info_cask_latest=$(brew cask info $upd_casks_latest)
|
||||
|
||||
for i in $upd_casks_latest
|
||||
do
|
||||
c=$(grep -A 1 "$i:" <<< "$info_cask_latest")
|
||||
cc=$(echo "$c" | tail -n 1)
|
||||
array_info_cask["$i"]="$cc"
|
||||
done
|
||||
|
||||
l2=""
|
||||
for row in $(jq -c '.[]' <<< "$upd_cask");
|
||||
do
|
||||
installed_versions=$(echo "$row" | jq -j '.installed_versions')
|
||||
if [ "$installed_versions" = "latest" ]; then
|
||||
name=$(echo "$row" | jq -j '.name')
|
||||
current_version=$(echo "$row" | jq -j '.current_version')
|
||||
url=${array_info_cask[$name]}
|
||||
|
||||
if [[ ! " ${do_not_update[@]} " =~ " ${name} " ]]; then
|
||||
#echo "$name est à updater"
|
||||
l2+="\033[1;37m$name: installed: $installed_versions current: $current_version\033[0m\n"
|
||||
else
|
||||
l2+="\033[1;31m$name: installed: $installed_versions current: $current_version [Do not update]\033[0m\n"
|
||||
fi
|
||||
l2+="$url\n\n"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "$l2" | sed ':a;N;$!ba;s/\n//g'
|
||||
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
q=$(echo -e "Do you wanna run \033[1;37mbrew upgrade --cask --greedy <cask>\033[0m ? (y/n)")
|
||||
read -p "$q" choice
|
||||
#read -p "Do you wanna run Casks (latest) upgrade? (y/n)" choice
|
||||
|
||||
if [ "$choice" == "y" ]; then
|
||||
for i in $upd_casks_latest
|
||||
do
|
||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||
|
||||
if [ "${FOUND}" == "" ]; then
|
||||
#echo "$i" | awk '{print $1}' | xargs -p -n 1 brew cask upgrade --greedy
|
||||
echo "$i" | xargs -p -n 1 brew upgrade --cask --greedy
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Ok, let's continue..."
|
||||
fi
|
||||
|
||||
if [ "$choice" == "y" ]; then
|
||||
for i in "$latest"
|
||||
do
|
||||
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew cask upgrade --greedy
|
||||
echo $?
|
||||
done
|
||||
else
|
||||
echo "Ok, let's continue"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Test if Apache conf file has been modified by Homebrew (Apache, PHP or Python updates)
|
||||
|
||||
### Test if Apache conf file has been modified by Homebrew (Apache, PHP or Python updates) ###
|
||||
|
||||
v_apa=$(httpd -V | grep 'SERVER_CONFIG_FILE')
|
||||
conf_apa=$(echo "$v_apa" | awk -F "\"" '{print $2}')
|
||||
@@ -313,6 +496,9 @@ name=$(basename $conf_apa)
|
||||
notif1="$dir has been modified in the last 5 minutes"
|
||||
|
||||
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
||||
|
||||
echo "$test"
|
||||
|
||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$notif1\033[0m"
|
||||
[ ! -z $test ] && notification "$notif1"
|
||||
|
||||
@@ -321,27 +507,36 @@ test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
||||
php_versions=$(ls /usr/local/etc/php/)
|
||||
for php in $php_versions
|
||||
do
|
||||
# file modified since it was last read
|
||||
#if [ -N /usr/local/etc/php/$php/php.ini ]; then echo "modified"; fi
|
||||
if [ -n "$upd_pkg" ]; then
|
||||
|
||||
# file modified since it was last read
|
||||
|
||||
php_modified=$(find /usr/local/etc/php/$php/ -name php.ini -newer /tmp/checkpoint)
|
||||
php_ini=/usr/local/etc/php/$php/php.ini
|
||||
notif2="$php_ini has been modified"
|
||||
php_modified=$(find /usr/local/etc/php/$php/ -name php.ini -newer /tmp/checkpoint)
|
||||
php_ini=/usr/local/etc/php/$php/php.ini
|
||||
notif2="$php_ini has been modified"
|
||||
|
||||
[ ! -z $php_modified ] && echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
||||
[ ! -z $php_modified ] && notification "$notif2"
|
||||
echo "$php_modified"
|
||||
|
||||
[ ! -z $php_modified ] && echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
||||
[ ! -z $php_modified ] && notification "$notif2"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
echo ""
|
||||
|
||||
# Doctor
|
||||
|
||||
### Doctor ###
|
||||
|
||||
echo "🍺 ️The Doc is checking that everything is ok."
|
||||
brew doctor
|
||||
|
||||
brew missing
|
||||
status=$?
|
||||
if [ $status -ne 0 ]; then brew missing --verbose; fi
|
||||
echo ""
|
||||
<<COMMENT2
|
||||
COMMENT2
|
||||
|
||||
# Homebrew 2.0.0+ run a cleanup every 30 days
|
||||
|
||||
@@ -349,6 +544,9 @@ if [[ $1 == "--cleanup" ]]; then
|
||||
echo "🍺 Cleaning brewery"
|
||||
##brew cleanup -s
|
||||
# keep 30 days
|
||||
|
||||
#HOMEBREW_NO_INSTALL_CLEANUP
|
||||
|
||||
brew cleanup --prune=30
|
||||
##brew cask cleanup: deprecated - merged with brew cleanup
|
||||
#brew cask cleanup --outdated
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
local_path=/Users/bruno/Sites/node_modules/
|
||||
chemin=$(pwd)
|
||||
#version: pip ou pip3
|
||||
version=pip3
|
||||
pip_version=pip3
|
||||
#
|
||||
#########################################
|
||||
|
||||
@@ -136,7 +136,7 @@ echo -e "🐍 Get pip \033[3m\033[93mPython 3 packages\033[0m installed list"
|
||||
echo '## 🐍 Python packages' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
|
||||
pip_packages=$($version list | sed '1,2d' | awk '{print $1}')
|
||||
pip_packages=$($pip_version list | sed '1,2d' | awk '{print $1}')
|
||||
{
|
||||
echo "\`\`\`bash"
|
||||
echo "$pip_packages"
|
||||
|
||||
@@ -12,6 +12,7 @@ if [[ $1 == "--nodistract" ]]; then
|
||||
no_distract=true
|
||||
fi
|
||||
|
||||
# https://github.com/mas-cli/mas
|
||||
# On teste si mas est installé
|
||||
if hash mas 2>/dev/null; then
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ if [[ $1 == "--nodistract" ]]; then
|
||||
no_distract=true
|
||||
fi
|
||||
|
||||
# Set ls_color to '' for output nvm list in colors, else '--no-colors'
|
||||
ls_color='--no-colors'
|
||||
|
||||
# Set doctor=true to run 'npm doctor' and 'npm cache verify' each time
|
||||
doctor=true
|
||||
|
||||
@@ -46,31 +49,65 @@ echo -e "\033[4m🌿 node.js\033[0m (current version): $node_v"
|
||||
npm_v=$(npm -v)
|
||||
echo -e "\033[4m🌿 npm\033[0m (current version): $npm_v"
|
||||
|
||||
# versions installées de node.js
|
||||
# version installée de nvm par Homebrew
|
||||
nvm_installed=$(brew info nvm | grep Cellar)
|
||||
# version actuelle de nvm sur GitHub
|
||||
version_nvm=$(git ls-remote --tags --refs --sort="v:refname" git://github.com/nvm-sh/nvm.git | tail -n1 | sed 's/.*\///' | sed 's/v//')
|
||||
|
||||
# github
|
||||
if [ -f "$NVM_DIR/nvm.sh" ]; then
|
||||
source $NVM_DIR/nvm.sh
|
||||
# version courante de nvm
|
||||
nvm_v=$(nvm --version)
|
||||
#echo "$nvm_v,$version_nvm" | tr ',' '\n' | sort -V
|
||||
|
||||
echo -e "\033[4m🌿 nvm install is:\033[0m $NVM_DIR/nvm.sh"
|
||||
echo "nvm $nvm_v is installed from https://github.com/nvm-sh/nvm"
|
||||
|
||||
if [ "$nvm_v" != "$version_nvm" ]; then
|
||||
echo "Current nvm version on GitHub: $version_nvm"
|
||||
echo "Current nvm installed version: $nvm_v"
|
||||
|
||||
read -p "Do you want to update nvm from GitHub repo? (y/n)" choice
|
||||
|
||||
if [ "$choice" == "y" ]; then
|
||||
echo "Updating nvm from GitHub..."
|
||||
#curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v"$version_nvm"/install.sh | bash
|
||||
|
||||
#curl: native on Catalina, wget installed by homebrew
|
||||
#wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
||||
#curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
||||
fi
|
||||
fi
|
||||
|
||||
node_install=$(nvm list)
|
||||
node_install=$(nvm list "$ls_color")
|
||||
echo -e "\033[4m🌿 node.js\033[0m (installed versions): \n$node_install"
|
||||
|
||||
# homebrew
|
||||
elif [ -f "/usr/local/opt/nvm/nvm.sh" ]; then
|
||||
source $(brew --prefix nvm)/nvm.sh
|
||||
# version courante de nvm
|
||||
nvm_v=$(nvm --version)
|
||||
echo -e "\033[4m🌿 nvm install is:\033[0m /usr/local/opt/nvm/nvm.sh"
|
||||
echo "nvm $nvm_v is installed from homebrew"
|
||||
|
||||
node_install=$(nvm list)
|
||||
|
||||
if [ "$nvm_v" != "$version_nvm" ]; then
|
||||
echo "Current nvm version on GitHub: $version_nvm"
|
||||
echo "Current nvm installed version: $nvm_v"
|
||||
|
||||
echo -e "nvm is outdated ! You should run \033[1;3mbrew update && brew upgrade nvm\033[0m"
|
||||
echo -e "or run \033[1;3mKymsu's homebrew.sh script\033[0m."
|
||||
fi
|
||||
|
||||
node_install=$(nvm list "$ls_color")
|
||||
echo -e "\033[4m🌿 node.js\033[0m (installed versions): \n$node_install"
|
||||
|
||||
fi
|
||||
|
||||
echo -e "\033[3mNote:"
|
||||
echo -e "N/A: version \"10.18.0 -> N/A\" is not yet installed."
|
||||
echo -e "You need to run \"nvm install 10.18.0\" to install it before using it.\033[0m"
|
||||
|
||||
echo
|
||||
|
||||
# Local packages
|
||||
@@ -93,7 +130,8 @@ echo ""
|
||||
echo -e "\033[4m🌿 Global installed scripts:\033[0m"
|
||||
npm list -g --depth=0
|
||||
|
||||
g_outdated=$(npm outdated -g)
|
||||
#g_outdated=$(npm outdated -g)
|
||||
g_outdated=$(npm outdated -g --parseable=true)
|
||||
|
||||
# => npm ERR! Cannot read property 'length' of undefined -> https://stackoverflow.com/questions/55172700/npm-outdated-g-error-cannot-read-property-length-of-undefined
|
||||
# /Users/bruno/.nvm/versions/node/v10.16.2/lib/node_modules/npm/lib/outdated.js
|
||||
@@ -102,12 +140,17 @@ g_outdated=$(npm outdated -g)
|
||||
# update -> wanted ; install -> latest
|
||||
if [ -n "$g_outdated" ]; then
|
||||
if [ "$no_distract" = false ]; then
|
||||
echo "$g_outdated"
|
||||
#echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -p -n 1 npm install -g
|
||||
echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -p -n 1 npm update -g
|
||||
#echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -p -n 1 npm update -g --verbose
|
||||
# npm verb outdated not updating @angular/cli because it's currently at the maximum version that matches its specified semver range
|
||||
|
||||
echo "$g_outdated" | cut -d : -f 4 | xargs -p -n 1 npm -g install
|
||||
|
||||
else
|
||||
#echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -n 1 npm install -g
|
||||
echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -n 1 npm update -g
|
||||
#echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -n 1 npm update -g
|
||||
|
||||
echo "$g_outdated" | cut -d : -f 4 | xargs -n 1 npm -g install
|
||||
fi
|
||||
else
|
||||
echo -e "\033[4mNo global packages updates.\033[0m"
|
||||
|
||||
@@ -53,11 +53,19 @@ if [ -n "$pecl_upgrade" ]; then
|
||||
if [ -n "$available" ]; then
|
||||
while read ligne
|
||||
do
|
||||
#echo "$ligne"
|
||||
echo "$ligne"
|
||||
|
||||
# Channel pear.php.net
|
||||
a=$(echo "$ligne" | grep "pear")
|
||||
if [ -n "$a" ]; then
|
||||
pecl channel-update pear.php.net
|
||||
else
|
||||
fi
|
||||
|
||||
# Channel pecl.php.net
|
||||
b=$(echo "$ligne" | grep "pecl")
|
||||
if [ -n "$b" ]; then
|
||||
pecl channel-update pecl.php.net
|
||||
|
||||
#(pecl or doc) update available
|
||||
b=$(echo "$ligne" | awk '{print $2}')
|
||||
pecl info "$b"
|
||||
@@ -68,6 +76,8 @@ if [ -n "$pecl_upgrade" ]; then
|
||||
echo "$b" | xargs -n 1 pecl upgrade
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
done <<< "$available"
|
||||
fi
|
||||
fi
|
||||
@@ -81,7 +91,7 @@ dir=$(dirname "$conf_php")
|
||||
name=$(basename "$conf_php")
|
||||
notif2="$conf_php was modified in the last 5 minutes"
|
||||
|
||||
test=$(find "$dir" -name "$name" -mmin -50000 -maxdepth 1)
|
||||
test=$(find "$dir" -name "$name" -mmin -5 -maxdepth 1)
|
||||
|
||||
if [ -n "$test" ]; then
|
||||
echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
||||
|
||||
@@ -3,12 +3,19 @@
|
||||
# pip plugin for KYMSU
|
||||
# https://github.com/welcoMattic/kymsu
|
||||
|
||||
# upgrade pip:
|
||||
# python -m pip install --upgrade pip
|
||||
|
||||
#export PIP_USE_FEATURE=2020-resolver
|
||||
#export PIP_USE_FEATURE=fast-deps
|
||||
# pip config edit
|
||||
|
||||
#########################################
|
||||
#
|
||||
# Settings:
|
||||
|
||||
#version: pip ou pip3
|
||||
version=pip3
|
||||
pip_version=pip3
|
||||
#user: "" or "--user"
|
||||
user=""
|
||||
# No distract mode
|
||||
@@ -22,18 +29,21 @@ if [[ $1 == "--nodistract" ]]; then
|
||||
no_distract=true
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v $version)" ]; then
|
||||
echo "Error: $version is not installed." >&2
|
||||
if ! [ -x "$(command -v $pip_version)" ]; then
|
||||
echo "Error: $pip_version is not installed." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\033[1m🐍 $version (Python 3) \033[0m"
|
||||
echo -e "\033[1m🐍 $pip_version (Python 3) \033[0m"
|
||||
|
||||
echo ""
|
||||
$version install --upgrade pip
|
||||
echo -e "\033[31mpip use features 2020-resolver & fast-deps for testings. pip 20.3 (10/2020) pip definitively this features.\033[0m"
|
||||
|
||||
echo ""
|
||||
$pip_version install --upgrade pip
|
||||
echo ""
|
||||
|
||||
pip_outdated=$($version list --outdated --format columns)
|
||||
pip_outdated=$($pip_version list --outdated --format columns)
|
||||
upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}')
|
||||
|
||||
if [ -n "$upd" ]; then
|
||||
@@ -45,10 +55,10 @@ if [ -n "$upd" ]; then
|
||||
|
||||
for i in $upd
|
||||
do
|
||||
info=$($version show "$i")
|
||||
#info=$($version show $i | sed -n 4q)
|
||||
#info=$($version show $i | head -5)
|
||||
#info=$($version show $i | tail -n +5)
|
||||
info=$($pip_version show "$i")
|
||||
#info=$($pip_version show $i | sed -n 4q)
|
||||
#info=$($pip_version show $i | head -5)
|
||||
#info=$($pip_version show $i | tail -n +5)
|
||||
echo "$info" | head -4
|
||||
echo ''
|
||||
#echo "$i"
|
||||
@@ -82,7 +92,7 @@ if [ -n "$upd" ]; then
|
||||
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
||||
read -pr "$c" choice
|
||||
case "$choice" in
|
||||
y|Y|o ) $version install $user pipdeptree ;;
|
||||
y|Y|o ) $pip_version install $user pipdeptree ;;
|
||||
n|N ) echo "Ok, let's continue";;
|
||||
* ) echo "invalid";;
|
||||
esac
|
||||
@@ -94,10 +104,10 @@ if [ -n "$upd" ]; then
|
||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
|
||||
|
||||
b=$(echo -e "Do you wanna run \033[1m$version install $user --upgrade $i\033[0m ? (y/n)")
|
||||
b=$(echo -e "Do you wanna run \033[1m$pip_version install $user --upgrade $i\033[0m ? (y/n)")
|
||||
read -p "$b" choice
|
||||
case "$choice" in
|
||||
y|Y|o ) echo "$i" | xargs $version install $user --upgrade ;;
|
||||
y|Y|o ) echo "$i" | xargs $pip_version install $user --upgrade ;;
|
||||
n|N ) echo "Ok, let's continue";;
|
||||
* ) echo "invalid";;
|
||||
esac
|
||||
@@ -105,7 +115,8 @@ if [ -n "$upd" ]; then
|
||||
|
||||
elif [ "${FOUND}" = "" ]; then
|
||||
|
||||
echo "$i" | xargs $version install $user --upgrade
|
||||
echo "$i" | xargs $pip_version install $user --upgrade
|
||||
#echo "$i" | xargs $pip_version install $user --use-feature=2020-resolver --upgrade
|
||||
|
||||
fi
|
||||
done
|
||||
@@ -114,5 +125,10 @@ else
|
||||
echo -e "\033[4mNo availables updates.\033[0m"
|
||||
fi
|
||||
|
||||
|
||||
echo -e "🐍 Running \033[1mpip check\033[0m for checking that everything is ok."
|
||||
|
||||
$pip_version check
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
BIN
plugins.d/success.png
Normal file
BIN
plugins.d/success.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Reference in New Issue
Block a user