Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
4b06dd1079
|
|||
|
6895aa8cc5
|
|||
|
6e8361312c
|
|||
|
a434e2814a
|
|||
|
0077eaca53
|
|||
|
81afb2846e
|
|||
|
285b991b09
|
|||
|
3651ee64be
|
|||
|
3eeff4b705
|
|||
|
4620ab071d
|
|||
| 78f4158361 | |||
| e5ae3745f7 | |||
| 1648fbb13e | |||
| 80e905ec4e | |||
| 3f61fa4a57 | |||
| 648bd9d211 | |||
| be093d2455 | |||
| cf760c8b3a | |||
| 1f8e7c7c4d | |||
| 8497b0d0d5 | |||
| d076210d4f | |||
| ce5fa6e908 | |||
| 5dab2b9d33 | |||
| e8a6b02a95 | |||
| f354d0b699 | |||
| 4399d440ec | |||
| f678d88c78 | |||
| d0898cb1e4 |
0
.gitattributes
vendored
Normal file
0
.gitattributes
vendored
Normal file
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
12
README.md
12
README.md
@@ -2,6 +2,10 @@
|
||||
altKYMSU is a fork from **KYMSU** (Keep Your macOs Stuff Updated)
|
||||
https://github.com/welcoMattic/kymsu
|
||||
|
||||
Each plugin notifie you about available update and upgrade apps and packages.
|
||||
|
||||
homebrew and pecl plugins notifie you if apache/php configuration files have been modified.
|
||||
|
||||
|
||||
|
||||
## Plug-ins:
|
||||
@@ -20,7 +24,13 @@ https://github.com/welcoMattic/kymsu
|
||||
## Requirements
|
||||
|
||||
- [Homebrew](https://brew.sh/)
|
||||
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) for checking dependancies (pip plugin)
|
||||
|
||||
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 ""
|
||||
BIN
plugins.d/error.png
Normal file
BIN
plugins.d/error.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -9,70 +9,257 @@
|
||||
# ou
|
||||
# /usr/bin/find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | /usr/bin/xargs -0 /usr/bin/perl -i -0pe 's/depends_on macos: \[.*?\]//gsm;s/depends_on macos: .*//g'
|
||||
|
||||
#########################################
|
||||
###############################################################################################
|
||||
#
|
||||
# Settings:
|
||||
|
||||
# Display info on updated pakages
|
||||
display_info=true
|
||||
|
||||
#add module to do_not_update array
|
||||
declare -a do_not_update=('virtualbox,virtualbox-extension-pack')
|
||||
# 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=("xnconvert" "yate")
|
||||
|
||||
# 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="Homebrew"
|
||||
#subtitle="Attention !!!"
|
||||
message="$1"
|
||||
image="error.png"
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifier)" ]; then
|
||||
terminal-notifier -title "$title" -message "$message" -sound "$sound" -contentImage "$image"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [[ $1 == "--nodistract" ]]; then
|
||||
no_distract=true
|
||||
fi
|
||||
|
||||
echo -e "\033[1m🍺 Homebrew \033[0m"
|
||||
echo ""
|
||||
|
||||
brew update
|
||||
|
||||
echo "Search for packages update..."
|
||||
echo ""
|
||||
|
||||
brew_outdated=$(brew outdated)
|
||||
upd3=$(echo "$brew_outdated" | awk '{print $1}')
|
||||
declare -A array_info # bash 5
|
||||
declare -A array_info_cask
|
||||
|
||||
#nb=$(echo $upd3 | wc -w)
|
||||
|
||||
if [ -n "$upd3" ]; then
|
||||
|
||||
if [ "$display_info" = true ]; then
|
||||
echo -e "\033[4mInfo on updated packages:\033[0m"
|
||||
for pkg in $upd3
|
||||
do
|
||||
|
||||
# if jq (https://stedolan.github.io/jq/) is installed
|
||||
if [ -x "$(command -v jq)" ]; then
|
||||
info_pkg=$(brew info --json=v1 "$pkg")
|
||||
current=$(echo "$info_pkg" | jq -r .[].installed[].version | tail -n 1 | awk '{print $1}')
|
||||
stable=$(echo "$info_pkg" | jq -r .[].versions.stable)
|
||||
homepage=$(echo "$info_pkg" | jq -r .[].homepage)
|
||||
desc=$(echo "$info_pkg" | jq -r .[].desc)
|
||||
|
||||
echo -e "\033[1m$pkg:\033[0m current: $current last: $stable"
|
||||
echo "$desc"
|
||||
echo "$homepage"
|
||||
### Recherche des mises-à-jour ###
|
||||
|
||||
brew_outdated2=$(brew outdated --greedy --json=v2)
|
||||
upd_json=$(echo "$brew_outdated2")
|
||||
|
||||
upd_package=$(echo "$upd_json" | jq '{formulae} | .[]')
|
||||
|
||||
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
|
||||
info=$(brew info $pkg | head -n 4)
|
||||
ligne1=$(echo "$info" | head -n 1)
|
||||
brew_outdated=$(brew outdated)
|
||||
upd_pkg=$(echo "$brew_outdated" | awk '{print $1}')
|
||||
|
||||
echo -e "\033[1m$ligne1\033[0m"
|
||||
echo "$info" | sed -n -e '2,3p'
|
||||
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$pkg_pinned\033[0m"
|
||||
echo "To update a pinned package, you need to un-pin it manually (brew unpin <formula>)"
|
||||
echo ""
|
||||
|
||||
fi
|
||||
|
||||
|
||||
### Display infos for all updated packages ##
|
||||
|
||||
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_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_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"');
|
||||
iv=$(echo "$row" | jq -j '.installed_versions, "\n"');
|
||||
installed_v=$(echo "$iv" | jq -j '.[]');
|
||||
current_v=$(echo "$row" | jq -j '.current_version, "\n"');
|
||||
|
||||
#n="array_info$i[0]"
|
||||
#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)
|
||||
#current=$(echo "$info_pkg" | jq -r .[].installed[].version | tail -n 1 | awk '{print $1}')
|
||||
#stable=$(echo "$info_pkg" | jq -r .[].versions.stable)
|
||||
#pined=$(echo "$info_pkg" | jq -r .[].pinned)
|
||||
|
||||
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 l1+="$desc\n"; fi;
|
||||
l1+="\033[4m$homepage\033[0m\n"
|
||||
l1+="\n"
|
||||
|
||||
((i++))
|
||||
done
|
||||
|
||||
echo -e "$l1"
|
||||
else
|
||||
# ok sans jq
|
||||
|
||||
for pkg in $upd_pkg
|
||||
do
|
||||
info_pkg="${array_info[$pkg]}"
|
||||
ligne1=$(echo "$info_pkg" | head -n 1)
|
||||
desc=$(echo "$info_pkg"| sed '1d')
|
||||
|
||||
if [[ $ligne1 =~ "pinned" ]]; then # same as if [[ $ligne1 == *"pinned"* ]]; then
|
||||
echo -e "\033[1;31m$ligne1\033[0m"
|
||||
else
|
||||
echo -e "\033[1m$ligne1\033[0m"
|
||||
fi
|
||||
|
||||
echo "$desc"
|
||||
echo ""
|
||||
done
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
### Usefull for notify recent modification of apache/mysql/php conf files. ###
|
||||
touch /tmp/checkpoint
|
||||
|
||||
|
||||
### Remove pinned packages from outdated packages list ###
|
||||
|
||||
not_pinned=""
|
||||
for i in $upd_pkg
|
||||
do
|
||||
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 ###
|
||||
|
||||
if [ "$no_distract" = false ]; then
|
||||
|
||||
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$upd3"\033[0m? (y/n)")
|
||||
if [ -n "$not_pinned" ]; then
|
||||
|
||||
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 ;;
|
||||
@@ -80,89 +267,276 @@ if [ -n "$upd3" ]; then
|
||||
# * ) echo "invalid";;
|
||||
#esac
|
||||
|
||||
if [ "$choice" == "y" ]; then
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||
|
||||
for i in $upd3
|
||||
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 ""
|
||||
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
|
||||
fi
|
||||
|
||||
else # no distract = true
|
||||
|
||||
if [ -n "$not_pinned" ]; then
|
||||
echo "$not_pinned" | awk '{print $1}' | xargs -n 1 brew upgrade
|
||||
echo ""
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
|
||||
else
|
||||
echo -e "\033[4mNo package to update.\033[0m"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
#################
|
||||
##### CASKS #####
|
||||
#################
|
||||
|
||||
echo -e "\033[1m🍺 Casks upgrade \033[0m"
|
||||
echo ""
|
||||
|
||||
echo "Search for Casks update..."
|
||||
echo ""
|
||||
|
||||
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 [ "$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 "$brew_outdated" | awk '{print $1}' | xargs -n 1 brew upgrade
|
||||
if [ -n "$upd_casks" ]; then
|
||||
|
||||
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 ""
|
||||
fi
|
||||
|
||||
echo "🍺 Casks upgrade."
|
||||
#brew cask info betterzip
|
||||
|
||||
cask_outdated=$(brew cask outdated --greedy --verbose)
|
||||
# boucle for: don't stop multiples updates if one block (bad checksum, not compatible with OS version (Onyx))
|
||||
|
||||
outdated=$(echo "$cask_outdated" | grep -v '(latest)')
|
||||
if [ -n "$outdated" ]; then
|
||||
|
||||
# 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
|
||||
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 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 ""
|
||||
|
||||
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
|
||||
|
||||
else
|
||||
echo -e "\033[4mNo availables Cask updates.\033[0m"
|
||||
echo -e "$l2" | sed ':a;N;$!ba;s/\n//g'
|
||||
|
||||
fi
|
||||
|
||||
echo ""
|
||||
latest=$(echo "$cask_outdated" | grep '(latest)')
|
||||
|
||||
if [ -n "$latest" ] && [ "$no_distract" = false ]; then
|
||||
echo -e "\033[4mCasks (latest):\033[0m"
|
||||
echo "$latest" | cut -d " " -f1,2
|
||||
echo ""
|
||||
|
||||
read -p "Do you wanna run Cask (latest) upgrade? (y/n)" choice
|
||||
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 "$latest"
|
||||
for i in $upd_casks_latest
|
||||
do
|
||||
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew cask upgrade --greedy
|
||||
echo $?
|
||||
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"
|
||||
echo "Ok, let's continue..."
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
echo "🍺 ️The Doc is checking that everything is ok."
|
||||
brew doctor
|
||||
brew missing
|
||||
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}')
|
||||
dir=$(dirname $conf_apa)
|
||||
name=$(basename $conf_apa)
|
||||
notif1="$dir has been modified in the last 5 minutes"
|
||||
|
||||
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$name was modified in the last 5 minutes\033[0m"
|
||||
|
||||
echo "$test"
|
||||
|
||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$notif1\033[0m"
|
||||
[ ! -z $test ] && notification "$notif1"
|
||||
|
||||
# Test if PHP.ini file has been modified by Homebrew (PECL)
|
||||
|
||||
php_versions=$(ls /usr/local/etc/php/)
|
||||
for php in $php_versions
|
||||
do
|
||||
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"
|
||||
|
||||
echo "$php_modified"
|
||||
|
||||
[ ! -z $php_modified ] && echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
||||
[ ! -z $php_modified ] && notification "$notif2"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
echo ""
|
||||
|
||||
|
||||
### 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
|
||||
|
||||
@@ -170,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,14 +10,13 @@
|
||||
local_path=/Users/bruno/Sites/node_modules/
|
||||
chemin=$(pwd)
|
||||
#version: pip ou pip3
|
||||
version=pip3
|
||||
pip_version=pip3
|
||||
#
|
||||
#########################################
|
||||
|
||||
now=$(date +"%d-%m-%Y_%T")
|
||||
mac=$(hostname -s)
|
||||
file=$mac"@"$now
|
||||
#echo "$file"
|
||||
filename="Installed_$file"
|
||||
|
||||
echo -e "\033[1m🛠 Installed \033[0m"
|
||||
@@ -33,151 +32,174 @@ fi
|
||||
|
||||
if [ -f Brewfile ]; then
|
||||
echo -e "The \033[93mBrewfile\033[0m already exist! We rename it."
|
||||
bf=$(find . -name 'Brewfile_*' -maxdepth 1 | xargs rm)
|
||||
d=$(date -r Brewfile "+%m-%d-%Y_%H:%M:%S")
|
||||
find . -name 'Brewfile_*' -maxdepth 1 -print0 | xargs rm
|
||||
d=$(date -r Brewfile "+%d-%m-%Y_%H:%M:%S")
|
||||
|
||||
mv Brewfile "Brewfile_$mac@$d"
|
||||
fi
|
||||
|
||||
echo '# Apps, package, scripts installed:' > Installed.md
|
||||
echo "<u>"$mac"@"$now"</u>" >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
{
|
||||
echo '# Apps, package, scripts installed:'
|
||||
echo "*$mac@$now*"
|
||||
echo ''
|
||||
|
||||
echo '[TOC]' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
echo '[TOC]'
|
||||
echo ''
|
||||
|
||||
# Homebrew
|
||||
|
||||
echo '## Homebrew' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
echo '## 🍺 Homebrew'
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list"
|
||||
|
||||
echo '### Tap:' >> Installed.md
|
||||
tap=$(brew tap)
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
echo "$tap" >> Installed.md
|
||||
echo "\`\`\`" >> Installed.md
|
||||
echo "" >> Installed.md
|
||||
{
|
||||
echo "\`\`\`bash"
|
||||
echo "$tap"
|
||||
echo "\`\`\`"
|
||||
echo ""
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list"
|
||||
|
||||
echo '### Packages:' >> Installed.md
|
||||
brew=$(brew list)
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
echo "$brew" >> Installed.md
|
||||
echo "\`\`\`" >> Installed.md
|
||||
echo "" >> Installed.md
|
||||
{
|
||||
echo "\`\`\`bash"
|
||||
echo "$brew"
|
||||
echo "\`\`\`"
|
||||
echo ""
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
echo -e "🍺 Get Homebrew \033[3m\033[93mCask\033[0m installed list"
|
||||
|
||||
echo '### Casks:' >> Installed.md
|
||||
cask=$(brew cask list)
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
echo "$cask" >> Installed.md
|
||||
echo "\`\`\`" >> Installed.md
|
||||
echo "" >> Installed.md
|
||||
|
||||
{
|
||||
echo "\`\`\`bash"
|
||||
echo "$cask"
|
||||
echo "\`\`\`"
|
||||
echo ""
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
# liste des apps de l'Appstore installées (nom & numéro)
|
||||
|
||||
echo -e "🍏 Get mas \033[3m\033[93mApp Store applications\033[0m list"
|
||||
|
||||
echo '## mas (Mac App Store)' >> Installed.md
|
||||
echo '## 🍏 mas (Mac App Store)' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
|
||||
appfrommas=$(mas list)
|
||||
appfrommas=$(mas list | sort -k2)
|
||||
#echo "$appfrommas"
|
||||
#declare -a appstore
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
# todo: trier la liste par nom
|
||||
while read -r line; do
|
||||
number=$(echo "$line" | awk '{print $1}')
|
||||
name=$(echo "$line" | awk -F "(" '{print $1}' | awk {'first = $1; $1=""; print $0'} | sed 's/^ //g')
|
||||
#name=$(echo "$line" | awk -F "(" '{print $1}' | awk {'first = $1; $1=""; print $0'} | sed 's/^ //g')
|
||||
name=$(echo "$line" | awk -F "(" '{print $1}' | awk '{first = $1; $1=""; print $0}' | sed 's/^ //g')
|
||||
echo "$name ($number)" >> Installed.md
|
||||
#echo " " >> Installed.md
|
||||
#appstore["$name"]="${number}"
|
||||
done <<< "$appfrommas"
|
||||
echo "\`\`\`" >> Installed.md
|
||||
echo "" >> Installed.md
|
||||
|
||||
{
|
||||
echo "\`\`\`"
|
||||
echo ""
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
# Extensions PHP PECL
|
||||
|
||||
echo -e "🐘 Get PECL \033[3m\033[93mPHP extensions\033[0m list"
|
||||
|
||||
echo '## PECL extensions' >> Installed.md
|
||||
echo '## 🐘 PECL extensions' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
|
||||
ext_pecl=$(pecl list | sed '1,3d' | awk '{print $1}')
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
echo "$ext_pecl" >> Installed.md
|
||||
echo "\`\`\`" >> Installed.md
|
||||
echo "" >> Installed.md
|
||||
|
||||
{
|
||||
echo "\`\`\`bash"
|
||||
echo "$ext_pecl"
|
||||
echo "\`\`\`"
|
||||
echo ""
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
# Python packages (pip)
|
||||
|
||||
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}')
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
echo "$pip_packages" >> Installed.md
|
||||
echo "\`\`\`" >> Installed.md
|
||||
echo '## 🐍 Python packages' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
|
||||
pip_packages=$($pip_version list | sed '1,2d' | awk '{print $1}')
|
||||
{
|
||||
echo "\`\`\`bash"
|
||||
echo "$pip_packages"
|
||||
echo "\`\`\`"
|
||||
echo ""
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
# atom
|
||||
|
||||
echo -e "⚛️ Get \033[3m\033[93mAtom editor packages\033[0m installed list"
|
||||
echo '## Atom packages' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
|
||||
atom=$(apm list | grep 'Community Packages' -A 100 | sed '1,1d')
|
||||
{
|
||||
echo '## ⚛️ Atom packages'
|
||||
echo ''
|
||||
echo "\`\`\`bash"
|
||||
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
while read -r line; do
|
||||
a=$(echo "$line" | awk -F "@" '{print $1}')
|
||||
atom_pkg=${a:4}
|
||||
echo "$atom_pkg" >> "$chemin/Installed.md"
|
||||
a=$(echo "$line" | awk -F "@" '{print $1}' | awk '{print $2}' )
|
||||
#atom_pkg=${a:4}
|
||||
echo "$a"
|
||||
done <<< "$atom"
|
||||
echo "\`\`\`" >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
|
||||
echo "\`\`\`"
|
||||
echo ""
|
||||
echo ''
|
||||
} >> Installed.md
|
||||
|
||||
# Node.js packages (npm)
|
||||
|
||||
echo '## Node.js packages' >> Installed.md
|
||||
echo '' >> Installed.md
|
||||
|
||||
echo -e "🌿 Get npm \033[3m\033[93m node global packages\033[0m installed scripts"
|
||||
echo '### Global:' >> Installed.md
|
||||
pkg_global_npm=$(npm list -g --depth=0 --silent | sed '1d' | awk '{print $2}' | awk -F "@" '{print $1}')
|
||||
|
||||
pkg_global_npm=$(npm list -g --depth=0 --silent | sed '1,2d' | awk '{print $2}' | awk -F "@" '{print $1}')
|
||||
echo "\`\`\`bash" >> Installed.md
|
||||
echo "$pkg_global_npm" >> Installed.md
|
||||
echo "\`\`\`" >> Installed.md
|
||||
{
|
||||
echo '## 🌿 Node.js packages'
|
||||
echo ''
|
||||
|
||||
echo '### Global:'
|
||||
|
||||
echo "\`\`\`bash"
|
||||
echo "$pkg_global_npm"
|
||||
echo "\`\`\`"
|
||||
} >> Installed.md
|
||||
|
||||
#echo "$local_path"
|
||||
if [ -d "$local_path" ]; then
|
||||
cd $local_path
|
||||
cd "$local_path" || exit
|
||||
|
||||
echo -e "🌿 Get npm \033[3m\033[93m node local packages\033[0m installed scripts"
|
||||
echo '### Local:' >> "$chemin/Installed.md"
|
||||
|
||||
pkg_local=$(npm ls | sed '1,1d' | grep -v 'deduped')
|
||||
pkg_local=$(npm ls | sed '1d' | grep -v 'deduped')
|
||||
|
||||
echo "\`\`\`bash" >> "$chemin/Installed.md"
|
||||
{
|
||||
echo "\`\`\`bash"
|
||||
while read -r line; do
|
||||
a=$(echo "$line" | awk -F "@" '{print $1}')
|
||||
pkg_local_npm=${a:4}
|
||||
echo "$pkg_local_npm" >> "$chemin/Installed.md"
|
||||
pkg_local_npm=$(echo "$line" | sed 's/[│ └──├┬]//g' | awk -F "@" '{print $1}')
|
||||
echo "$pkg_local_npm"
|
||||
done <<< "$pkg_local"
|
||||
echo "\`\`\`" >> "$chemin/Installed.md"
|
||||
echo "\`\`\`"
|
||||
} >> "$chemin/Installed.md"
|
||||
|
||||
cd $chemin
|
||||
|
||||
cd "$chemin" || exit
|
||||
fi
|
||||
|
||||
echo "" >> Installed.md
|
||||
@@ -193,6 +215,10 @@ echo ''
|
||||
echo -e "To restore everything listed in that file, run \033[3m\033[93m'$ brew bundle'\033[0m in folder that contains the Brewfile."
|
||||
echo ''
|
||||
|
||||
#iconv -f macroman -t utf-8 Installed.md > Installed-utf8.md
|
||||
#mv Installed-utf8.md "$filename".md
|
||||
#rm Installed.md
|
||||
|
||||
mv Installed.md "$filename".md
|
||||
|
||||
open "$filename".md
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,8 +20,7 @@ if hash mas 2>/dev/null; then
|
||||
echo ""
|
||||
echo "$massy"
|
||||
|
||||
#if [ -n "$massy" ]; then
|
||||
if [ ! -z "$(mas outdated)" ]; then
|
||||
if [ -n "$(mas outdated)" ]; then
|
||||
echo -e "\033[4mAvailables updates:\033[0m"
|
||||
echo "$massy" | cut -d " " -f2-5
|
||||
echo ""
|
||||
@@ -28,7 +28,7 @@ if hash mas 2>/dev/null; then
|
||||
if [ "$no_distract" = false ]; then
|
||||
|
||||
a=$(echo -e "Do you wanna run \033[1mmas upgrade\033[0m ? (y/n)")
|
||||
read -p "$a" choice
|
||||
read -pr "$a" choice
|
||||
case "$choice" in
|
||||
y|Y|o ) mas upgrade;;
|
||||
n|N ) echo "Ok, let's continue";;
|
||||
|
||||
@@ -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,19 +49,41 @@ 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"
|
||||
|
||||
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"
|
||||
|
||||
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 "$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
|
||||
@@ -66,16 +91,28 @@ elif [ -f "/usr/local/opt/nvm/nvm.sh" ]; then
|
||||
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
|
||||
if [ -d "$local_path" ]; then
|
||||
cd $local_path
|
||||
cd "$local_path" || return
|
||||
echo -e "\033[4m🌿 Local installed scripts:\033[0m"
|
||||
npm ls
|
||||
outdated=$(npm outdated)
|
||||
@@ -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"
|
||||
|
||||
@@ -14,6 +14,19 @@ no_distract=false
|
||||
#
|
||||
#########################################
|
||||
|
||||
notification() {
|
||||
sound="Basso"
|
||||
title="Homebrew"
|
||||
#subtitle="Attention !!!"
|
||||
message="$1"
|
||||
image="error.png"
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifier)" ]; then
|
||||
terminal-notifier -title "$title" -message "$message" -sound "$sound" -contentImage "$image"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [[ $1 == "--nodistract" ]]; then
|
||||
no_distract=true
|
||||
fi
|
||||
@@ -40,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"
|
||||
@@ -55,18 +76,34 @@ if [ -n "$pecl_upgrade" ]; then
|
||||
echo "$b" | xargs -n 1 pecl upgrade
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
done <<< "$available"
|
||||
fi
|
||||
fi
|
||||
|
||||
# si modif des extensions, les .ini dans conf.d/ ne sont pas modifiés, juste le php.ini
|
||||
|
||||
# php.ini a été modifié il y a moins de 5mn
|
||||
v_php=$(php --info | grep -E 'usr.*ini')
|
||||
conf_php=$(echo "$v_php" | grep 'Loaded Configuration File' | awk '{print $NF}')
|
||||
dir=$(dirname $conf_php)
|
||||
name=$(basename $conf_php)
|
||||
dir=$(dirname "$conf_php")
|
||||
name=$(basename "$conf_php")
|
||||
notif2="$conf_php was modified in the last 5 minutes"
|
||||
|
||||
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$name was modified in the last 5 minutes\033[0m"
|
||||
test=$(find "$dir" -name "$name" -mmin -5 -maxdepth 1)
|
||||
|
||||
if [ -n "$test" ]; then
|
||||
echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
||||
notification "$notif2"
|
||||
echo ""
|
||||
|
||||
a=$(echo -e "Do you want to edit \033[1m$conf_php\033[0m file ? (y/n)")
|
||||
read -p "$a" choice
|
||||
if [ "$choice" == "y" ]; then
|
||||
$EDITOR "$conf_php"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
@@ -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"
|
||||
@@ -80,9 +90,9 @@ if [ -n "$upd" ]; then
|
||||
|
||||
else
|
||||
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
||||
read -p "$c" choice
|
||||
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