Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
3e88dc59df
|
|||
|
e6fb194868
|
|||
|
5268f23fcd
|
|||
|
2adb0f1064
|
|||
|
9f6cb2e72e
|
|||
|
c390f22b0f
|
|||
|
8e15aa05a0
|
|||
|
e5e2aa5d60
|
|||
|
ae8a356f1a
|
|||
|
f77903f01d
|
|||
|
d368c37788
|
|||
|
e4db3040d2
|
|||
|
2947d9e7c6
|
|||
|
81c8ad34aa
|
|||
|
731142630b
|
|||
|
380967c8d4
|
@@ -11,9 +11,10 @@ homebrew and pecl plugins notifie you if apache/php configuration files have bee
|
|||||||
## Plug-ins:
|
## Plug-ins:
|
||||||
|
|
||||||
- **atom** (plug-ins)
|
- **atom** (plug-ins)
|
||||||
|
- **antibody** (zsh plug-ins)
|
||||||
- **homebrew** (brew and cask)
|
- **homebrew** (brew and cask)
|
||||||
- **installed** (create a list of all your brew, pip, npm... stuffs and a Brewfile).
|
- **installed** (create a list of all your brew, pip, npm... stuffs and a Brewfile).
|
||||||
- **npm** (javascript package) (local or global packages)
|
- **npm** (javascript package) (local or global packages) (can update nvm script)
|
||||||
- **mas** (Mac Appstore)
|
- **mas** (Mac Appstore)
|
||||||
- **pip** (Python Package index) (pip or pip3)
|
- **pip** (Python Package index) (pip or pip3)
|
||||||
- **PECL** (PHP modules)
|
- **PECL** (PHP modules)
|
||||||
|
|||||||
66
install.sh
66
install.sh
@@ -1,14 +1,70 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
italic="\033[3m"
|
||||||
|
underline="\033[4m"
|
||||||
|
bold="\033[1m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
KYMSU_PATH=`pwd`
|
KYMSU_PATH=`pwd`
|
||||||
|
|
||||||
# Make Kymsu accessible in PATH
|
# Make Kymsu accessible in PATH
|
||||||
|
echo -e "Installing ${bold}kymsu2${reset} in ${bold}/usr/local/bin${reset} ..."
|
||||||
ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
|
ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
|
||||||
|
|
||||||
# Store Kymsu stuff in home directory
|
# Store Kymsu stuff in home directory
|
||||||
mkdir -p ~/.kymsu && echo "${KYMSU_PATH}" > ~/.kymsu/path
|
mkdir -p $HOME/.kymsu && echo "${KYMSU_PATH}" > $HOME/.kymsu/path
|
||||||
cp -R "${KYMSU_PATH}/plugins.d" ~/.kymsu
|
|
||||||
|
|
||||||
echo "altKYMSU has been installed. Run kymsu2 command!"
|
pluginpath=$HOME/.kymsu/plugins.d/
|
||||||
echo "It's a fork from https://github.com/welcoMattic/kymsu"
|
|
||||||
echo "All credits to welcoMattic"
|
if [ ! -d $pluginpath ]; then new_install=true; fi
|
||||||
|
|
||||||
|
# Backup disabled plugins
|
||||||
|
disabled=$(ls $pluginpath | grep ^_ | sed 's/^_//')
|
||||||
|
|
||||||
|
# Delete plugins folder
|
||||||
|
rm -rf $pluginpath
|
||||||
|
|
||||||
|
# Install new plugins
|
||||||
|
echo -e "Copying plugins in ${bold}$pluginpath${reset} ..."
|
||||||
|
cp -R "${KYMSU_PATH}/plugins.d" $HOME/.kymsu
|
||||||
|
|
||||||
|
if [ -n "$disabled" ]; then
|
||||||
|
|
||||||
|
echo -e "Disabling previous disabled plugins ..."
|
||||||
|
# Disable previous disabled plugins
|
||||||
|
for i in $(ls $pluginpath)
|
||||||
|
do
|
||||||
|
[[ $disabled =~ $i ]] && mv "$pluginpath$i" "$pluginpath"_"$i"
|
||||||
|
done
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n${bold}altKYMSU${reset} has been installed. Run ${bold}kymsu2${reset} command!"
|
||||||
|
echo -e "It's a fork from ${italic}https://github.com/welcoMattic/kymsu${reset}"
|
||||||
|
echo -e "All credits to ${underline}welcoMattic${reset}\n"
|
||||||
|
|
||||||
|
# If NEW install, we choose to desactivate some plugins
|
||||||
|
if [ "$new_install" = true ]; then
|
||||||
|
read -p "Do you want to activate / deactivate some plugins ? [y/n]" deactivate
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [[ "$deactivate" == "y" || "$deactivate" == "Y" ]]; then
|
||||||
|
|
||||||
|
for i in $(ls $pluginpath)
|
||||||
|
do
|
||||||
|
|
||||||
|
if [[ ${i: -3} == ".sh" ]] && [[ ! ${i:0:2} == "00" ]] && [[ ! ${i:0:1} == "_" ]]; then
|
||||||
|
|
||||||
|
a=$(echo -e "Do you want to deactivate ${bold}$i${reset} plugins ? [y/n]")
|
||||||
|
read -p "$a" rep
|
||||||
|
|
||||||
|
if [[ "$rep" == "y" || "$rep" == "Y" ]]; then
|
||||||
|
mv "$pluginpath$i" "$pluginpath"_"$i" && echo -e "${bold}$i${reset} deactivated !"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -103,9 +103,13 @@ if [ -n "$updated" ]; then
|
|||||||
echo "Last commit: "$url"/commits/"$last_commit
|
echo "Last commit: "$url"/commits/"$last_commit
|
||||||
# https://github.com/zsh-users/zsh-completions/commits/
|
# https://github.com/zsh-users/zsh-completions/commits/
|
||||||
|
|
||||||
notif="$module has been updated"
|
#notif="$module has been updated"
|
||||||
notification "$notif"
|
#notification "$notif"
|
||||||
|
modules+="$module "
|
||||||
done
|
done
|
||||||
|
notif="$modules has been updated"
|
||||||
|
notification "$notif"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo Antibody modules to update.\033[0m"
|
echo -e "\033[4mNo Antibody modules to update.\033[0m"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
69
plugins.d/conda.sh
Executable file
69
plugins.d/conda.sh
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# conda plugin for KYMSU
|
||||||
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
|
# If you'd prefer that conda's base environment not be activated on startup, set the auto_activate_base parameter to false:
|
||||||
|
# conda config --set auto_activate_base false
|
||||||
|
|
||||||
|
# In order to initialize after the installation process is done,
|
||||||
|
# first run source <path to conda>/bin/activate and then run conda init.
|
||||||
|
|
||||||
|
|
||||||
|
# Update conda
|
||||||
|
|
||||||
|
echo -e "\033[1m🦎 conda \033[0m"
|
||||||
|
|
||||||
|
path_to_conda=$(conda config --show | grep 'root_prefix' | awk '{print $2}')
|
||||||
|
|
||||||
|
cd $path_to_conda
|
||||||
|
#conda update conda
|
||||||
|
# conda update -n base -c defaults conda
|
||||||
|
#upd=$(conda update --all)
|
||||||
|
#echo $upd
|
||||||
|
|
||||||
|
#avail_update=$(echo $upd | grep '$ conda update -n base -c defaults conda')
|
||||||
|
#avail_update=$(conda update --all | grep '$ conda update -n base -c defaults conda')
|
||||||
|
#avail_update=$(conda update --all)
|
||||||
|
conda update --all
|
||||||
|
|
||||||
|
|
||||||
|
avail_update="$(conda update --all 2>&1 > /dev/null)"
|
||||||
|
|
||||||
|
|
||||||
|
# Proceed ([y]/n)? n
|
||||||
|
|
||||||
|
echo "---"
|
||||||
|
|
||||||
|
if echo "$avail_update" | grep -q "$ conda update -n base -c defaults conda"
|
||||||
|
then
|
||||||
|
echo "need update"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If you want to update to a newer version of Anaconda, type:
|
||||||
|
#
|
||||||
|
# $ conda update --prefix /Users/bruno/miniconda3 anaconda
|
||||||
|
|
||||||
|
|
||||||
|
# Initialisation
|
||||||
|
|
||||||
|
# source $HOME/miniconda3/bin/activate
|
||||||
|
# source $path_to_conda/bin/activate
|
||||||
|
# conda init
|
||||||
|
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
#conda config --help
|
||||||
|
#conda config --set auto_update_conda False
|
||||||
|
|
||||||
|
|
||||||
|
# Packages installés dans l'environnement conda
|
||||||
|
|
||||||
|
echo -e "\033[4mInstalled packages in conda environment:\033[0m"
|
||||||
|
echo ""
|
||||||
|
conda list
|
||||||
42
plugins.d/gem.sh
Executable file
42
plugins.d/gem.sh
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# gem plugin for KYMSU (install local package)
|
||||||
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
# https://guides.rubygems.org/what-is-a-gem/
|
||||||
|
|
||||||
|
# No distract mode
|
||||||
|
no_distract=false
|
||||||
|
|
||||||
|
if [[ $1 == "--nodistract" ]]; then
|
||||||
|
no_distract=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\033[1m 💍 Gem (Ruby) \033[0m"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
gem_outdated=$(gem outdated --local)
|
||||||
|
upd=$(echo "$gem_outdated" | awk '{print $1}')
|
||||||
|
|
||||||
|
if [ -n "$upd" ]; then
|
||||||
|
nb=$(echo "$upd" | wc -w | xargs)
|
||||||
|
|
||||||
|
echo -e "\\033[1;41m $nb \033[0m \033[4mavailables updates:\033[0m"
|
||||||
|
echo "$gem_outdated"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
for i in $upd
|
||||||
|
do
|
||||||
|
|
||||||
|
if [ "$no_distract" = false ]; then
|
||||||
|
echo "$i" | xargs -n 1 gem info
|
||||||
|
echo "$i" | xargs -p -n 1 gem update
|
||||||
|
echo -e "\n"
|
||||||
|
else
|
||||||
|
echo "$i" | xargs -n 1 gem update
|
||||||
|
echo -e "\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo -e "\033[4mNo gem updates.\033[0m"
|
||||||
|
fi
|
||||||
@@ -3,12 +3,6 @@
|
|||||||
# Homebrew plugin for KYMSU
|
# Homebrew plugin for KYMSU
|
||||||
# https://github.com/welcoMattic/kymsu
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
# Error: Cask 'onyx' definition is invalid: invalid 'depends_on macos' value: :snow_leopard
|
|
||||||
# Supprimer manuellement onyx de /Applications
|
|
||||||
# rm -rvf "$(brew --prefix)/Caskroom/onyx"
|
|
||||||
# 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:
|
# Settings:
|
||||||
@@ -18,10 +12,15 @@ display_info=true
|
|||||||
|
|
||||||
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
# 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.
|
# Also add package for prevent to update whitout pin it.
|
||||||
declare -a do_not_update=("xnconvert" "yate")
|
# declare -a do_not_update=("xnconvert" "yate")
|
||||||
|
declare -a cask_to_not_update=("xld" "webpquicklook")
|
||||||
|
|
||||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
||||||
no_distract=false
|
no_distract=false
|
||||||
|
|
||||||
|
# Some Casks have auto_updates true or version :latest. Homebrew Cask cannot track versions of those apps.
|
||||||
|
# 'latest=true' force Homebrew to update those apps.
|
||||||
|
latest=true
|
||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
#
|
#
|
||||||
@@ -30,6 +29,19 @@ no_distract=false
|
|||||||
# -terminal-notifier (Send macOS User Notifications from the command-line)
|
# -terminal-notifier (Send macOS User Notifications from the command-line)
|
||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
|
: <<'END_COMMENT'
|
||||||
|
blabla
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
|
|
||||||
|
italic="\033[3m"
|
||||||
|
underline="\033[4m"
|
||||||
|
ita_under="\033[3;4m"
|
||||||
|
bgd="\033[1;4;31m"
|
||||||
|
red="\033[1;31m"
|
||||||
|
bold="\033[1m"
|
||||||
|
box="\033[1;41m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
notification() {
|
notification() {
|
||||||
sound="Basso"
|
sound="Basso"
|
||||||
@@ -43,513 +55,261 @@ notification() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ $1 == "--nodistract" ]]; then no_distract=true; fi
|
||||||
|
if [[ $1 == "--latest" ]]; then latest=true; fi
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
|
||||||
no_distract=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\033[1m🍺 Homebrew \033[0m"
|
echo -e "${bold}🍺 Homebrew ${reset}"
|
||||||
|
|
||||||
|
echo -e "\n🍺 ${underline}Updating brew...${reset}"
|
||||||
|
#brew update
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
brew_outdated=$(brew outdated --greedy --json=v2)
|
||||||
|
|
||||||
brew update
|
#echo "\nSearch for brew update...\n"
|
||||||
|
upd_json=$(echo "$brew_outdated")
|
||||||
|
#echo "$upd_json"
|
||||||
|
|
||||||
echo "Search for packages update..."
|
################
|
||||||
echo ""
|
### Packages ###
|
||||||
|
################
|
||||||
|
|
||||||
declare -A array_info # bash 5
|
# Packages update:
|
||||||
declare -A array_info_cask
|
echo -e "\n🍺 ${underline}Search for packages update...${reset}\n"
|
||||||
|
upd_package=$(echo "$brew_outdated" | jq '{formulae} | .[]')
|
||||||
|
#echo "$upd_package"
|
||||||
|
|
||||||
if [ -x "$(command -v jq)" ]; then
|
for row in $(jq -c '.[]' <<< "$upd_package");
|
||||||
|
do
|
||||||
### 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')
|
name=$(echo "$row" | jq -j '.name')
|
||||||
|
installed_versions=$(echo "$row" | jq -j '.installed_versions' | jq -r '.[]')
|
||||||
|
current_version=$(echo "$row" | jq -j '.current_version')
|
||||||
pinned=$(echo "$row" | jq -j '.pinned')
|
pinned=$(echo "$row" | jq -j '.pinned')
|
||||||
|
pinned_version=$(echo "$row" | jq -j '.pinned_version')
|
||||||
|
|
||||||
upd_pkg+="$name "
|
echo "$name - $installed_versions - $current_version - $pinned - $pinned_version"
|
||||||
|
|
||||||
|
upd_pkgs+="$name "
|
||||||
if [ "$pinned" = true ]; then
|
if [ "$pinned" = true ]; then
|
||||||
upd_pkg_pinned+="$name "
|
upd_pkg_pinned+="$name "
|
||||||
fi
|
elif [ "$pinned" = false ]; then
|
||||||
done
|
upd_pkg_notpinned+="$name "
|
||||||
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
|
fi
|
||||||
|
|
||||||
else
|
done
|
||||||
brew_outdated=$(brew outdated)
|
upd_pkgs=$(echo "$upd_pkgs" | sed 's/.$//')
|
||||||
upd_pkg=$(echo "$brew_outdated" | awk '{print $1}')
|
upd_pkg_pinned=$(echo "$upd_pkg_pinned" | sed 's/.$//')
|
||||||
|
upd_pkg_notpinned=$(echo "$upd_pkg_notpinned" | sed 's/.$//')
|
||||||
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 ##
|
|
||||||
|
|
||||||
|
# Pinned packages
|
||||||
|
pkg_pinned=$(brew list --formulae --pinned | xargs)
|
||||||
if [ -n "$pkg_pinned" ]; then
|
if [ -n "$pkg_pinned" ]; then
|
||||||
|
|
||||||
nbp=$(echo "$pkg_pinned" | wc -w | xargs)
|
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 "\n${underline}List of${reset} ${box} $nbp ${reset} ${underline}pinned packages:${reset}"
|
||||||
echo -e "\033[1;31m$pkg_pinned\033[0m"
|
echo -e "${red}$pkg_pinned${reset}"
|
||||||
echo "To update a pinned package, you need to un-pin it manually (brew unpin <formula>)"
|
echo "To update a pinned package, you need to un-pin it manually (brew unpin <formula>)"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### Usefull for notify recent modification of apache/mysql/php conf files. ###
|
||||||
|
touch /tmp/checkpoint
|
||||||
|
|
||||||
### Display infos for all updated 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" ]; then
|
if [ -n "$upd_pkg_notpinned" ]; 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
|
if [ "$no_distract" = false ]; then
|
||||||
|
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$upd_pkg_notpinned"\033[0m ? (y/n/a) ")
|
||||||
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
|
# yes/no/all
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
#case "$choice" in
|
|
||||||
# y|Y ) echo "$brew_outdated" | awk '{print $1}' | xargs -p -n 1 brew upgrade ;;
|
|
||||||
# n|N ) echo "Ok, let's continue";;
|
|
||||||
# * ) echo "invalid";;
|
|
||||||
#esac
|
|
||||||
|
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
for i in $upd_pkg_notpinned;
|
||||||
for i in $not_pinned
|
|
||||||
do
|
do
|
||||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
|
||||||
if [ "${FOUND}" = "" ]; then
|
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew upgrade
|
echo "$i"
|
||||||
echo ""
|
|
||||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
echo "$i" | awk '{print $1}' | xargs -n 1 brew upgrade
|
echo "$i"
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Ok, let's continue"
|
echo -e "OK, let's continue..."
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
#echo "No distract"
|
||||||
|
echo -e "Running ${bold}brew upgrade $upd_pkg_notpinned${reset}..."
|
||||||
|
echo "$upd_pkg_notpinned" | xargs -n 1 brew upgrade
|
||||||
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
|
else
|
||||||
echo -e "\033[4mNo package to update.\033[0m"
|
echo -e "\n${italic}No update package available...${reset}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
#############
|
||||||
|
### Casks ###
|
||||||
|
#############
|
||||||
|
|
||||||
#################
|
#Casks update
|
||||||
##### CASKS #####
|
echo -e "\n🍺 ${underline}Search for casks update...${reset}\n"
|
||||||
#################
|
upd_cask=$(echo "$brew_outdated" | jq '{casks} | .[]')
|
||||||
|
#echo "$upd_cask"
|
||||||
|
|
||||||
echo -e "\033[1m🍺 Casks upgrade \033[0m"
|
#i=0
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "Search for Casks update..."
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
i=0
|
|
||||||
for row in $(jq -c '.[]' <<< "$upd_cask");
|
for row in $(jq -c '.[]' <<< "$upd_cask");
|
||||||
do
|
do
|
||||||
name=$(echo "$row" | jq -j '.name')
|
name=$(echo "$row" | jq -j '.name')
|
||||||
installed_versions=$(echo "$row" | jq -j '.installed_versions')
|
installed_versions=$(echo "$row" | jq -j '.installed_versions')
|
||||||
current_version=$(echo "$row" | jq -j '.current_version')
|
current_version=$(echo "$row" | jq -j '.current_version')
|
||||||
|
|
||||||
|
#upd_casks+="$name "
|
||||||
|
echo "$name - $installed_versions - $current_version"
|
||||||
|
|
||||||
if [ "$current_version" != "latest" ]; then
|
if [ "$current_version" != "latest" ]; then
|
||||||
upd_casks+="$name "
|
upd_casks+="$name "
|
||||||
|
|
||||||
eval "declare -a array_info_cask$i=($name $installed_versions $current_version)"
|
|
||||||
((i++))
|
|
||||||
|
|
||||||
elif [ "$current_version" == "latest" ]; then
|
elif [ "$current_version" == "latest" ]; then
|
||||||
upd_casks_latest+="$name "
|
upd_casks_latest+="$name "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
upd_casks=$(echo "$upd_casks" | sed 's/.$//')
|
upd_casks=$(echo "$upd_casks" | sed 's/.$//')
|
||||||
upd_casks_latest=$(echo "$upd_casks_latest" | sed 's/.$//')
|
upd_casks_latest=$(echo "$upd_casks_latest" | sed 's/.$//')
|
||||||
|
|
||||||
nb_upd_casks=$(echo "$upd_casks" | wc -w | xargs)
|
# Do not update casks
|
||||||
nb_upd_casks_latest=$(echo "$upd_casks_latest" | wc -w | xargs)
|
if (( ${#cask_to_not_update[@]} )); then
|
||||||
|
|
||||||
|
# cask_to_not_update contient 1 cask ET/OU 1 latest
|
||||||
|
|
||||||
if [ -z "$upd_casks" ] && [ -z "$upd_casks_latest" ]; then
|
nbp=${#cask_to_not_update[*]}
|
||||||
|
|
||||||
echo -e "\033[4mNo availables Cask updates.\033[0m"
|
echo -e "\n${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
||||||
|
echo -e "${red}${cask_to_not_update[*]}${reset}"
|
||||||
|
echo -e "To remove package from this list, you need to edit the do_not_update array."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
casks_not_pinned=""
|
||||||
|
for i in $upd_casks
|
||||||
|
do
|
||||||
|
#echo "$i"
|
||||||
|
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
|
#echo "$i"
|
||||||
|
casks_not_pinned+="$i "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
casks_not_pinned=$(echo "$casks_not_pinned" | sed 's/.$//')
|
||||||
|
|
||||||
|
casks_latest_not_pinned=""
|
||||||
|
for i in $upd_casks_latest
|
||||||
|
do
|
||||||
|
#echo "$i"
|
||||||
|
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
|
#echo "$i"
|
||||||
|
casks_latest_not_pinned+="$i "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
casks_latest_not_pinned=$(echo "$casks_latest_not_pinned" | sed 's/.$//')
|
||||||
|
|
||||||
else
|
else
|
||||||
|
casks_not_pinned=$upd_casks
|
||||||
if [ -n "$upd_casks" ]; then
|
casks_latest_not_pinned=$upd_casks_latest
|
||||||
|
|
||||||
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 ""
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
# Updating casks
|
||||||
|
echo -e "\n🍺 ${underline}Updating casks...${reset}\n"
|
||||||
|
[ -n "$casks_not_pinned" ] && echo -e "${red}Do not update: ${cask_to_not_update[@]} . It won't be updated!'${reset}\n"
|
||||||
|
|
||||||
|
if [ -n "$casks_not_pinned" ]; then
|
||||||
|
|
||||||
### Test if Apache conf file has been modified by Homebrew (Apache, PHP or Python updates) ###
|
if [ "$no_distract" = false ]; then
|
||||||
|
a=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_not_pinned${reset} ? (y/n/a) ")
|
||||||
v_apa=$(httpd -V | grep 'SERVER_CONFIG_FILE')
|
# yes/no/all
|
||||||
conf_apa=$(echo "$v_apa" | awk -F "\"" '{print $2}')
|
read -p "$a" choice
|
||||||
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)
|
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
for i in $casks_not_pinned;
|
||||||
|
do
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
|
echo "$i" | xargs -p -n 1 brew upgrade --dry-run
|
||||||
|
echo ""
|
||||||
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
echo "$i" | xargs -n 1 brew upgrade --dry-run
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo -e "OK, let's continue..."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
#echo "No distract"
|
||||||
|
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --dry-run
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
else
|
||||||
echo ""
|
echo -e "\n${italic}No update cask available...${reset}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Updating casks latest
|
||||||
|
if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then
|
||||||
|
echo -e "\n🍺 ${underline}Updating casks with 'latest' as version...${reset}\n"
|
||||||
|
echo -e "Some Casks have ${italic}auto_updates true${reset} or ${italic}version :latest${reset}. Homebrew Cask cannot track versions of those apps."
|
||||||
|
echo -e "Here you can force Homebrew to upgrade those apps.\n"
|
||||||
|
|
||||||
|
if [ "$no_distract" = false ]; then
|
||||||
|
q=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_latest_not_pinned${reset} ? (y/n/a) ")
|
||||||
|
read -p "$q" choice
|
||||||
|
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
|
||||||
|
for i in $casks_latest_not_pinned
|
||||||
|
do
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
|
echo "$i" | xargs -p -n 1 brew upgrade --dry-run
|
||||||
|
echo ""
|
||||||
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
echo "$i" | xargs -n 1 brew upgrade --dry-run
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "OK, let's continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
#echo "No distract"
|
||||||
|
echo -e "Running ${bold}brew upgrade $casks_latest_not_pinned${reset}..."
|
||||||
|
echo "$casks_latest_not_pinned" | xargs -n 1 brew upgrade --dry-run
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
##############
|
||||||
### Doctor ###
|
### Doctor ###
|
||||||
|
##############
|
||||||
|
|
||||||
echo "🍺 ️The Doc is checking that everything is ok."
|
echo -e "\n🍺 ${underline}The Doc is checking that everything is ok...${reset}\n"
|
||||||
brew doctor
|
|
||||||
|
#brew doctor
|
||||||
|
|
||||||
brew missing
|
brew missing
|
||||||
status=$?
|
status=$?
|
||||||
if [ $status -ne 0 ]; then brew missing --verbose; fi
|
if [ $status -ne 0 ]; then brew missing --verbose; fi
|
||||||
echo ""
|
echo ""
|
||||||
<<COMMENT2
|
|
||||||
COMMENT2
|
|
||||||
|
|
||||||
# Homebrew 2.0.0+ run a cleanup every 30 days
|
# Homebrew 2.0.0+ run a cleanup every 30 days
|
||||||
|
|
||||||
if [[ $1 == "--cleanup" ]]; then
|
if [[ $1 == "--cleanup" ]]; then
|
||||||
echo "🍺 Cleaning brewery"
|
echo -e "🍺 Cleaning brewery..."
|
||||||
##brew cleanup -s
|
|
||||||
# keep 30 days
|
|
||||||
|
|
||||||
#HOMEBREW_NO_INSTALL_CLEANUP
|
#HOMEBREW_NO_INSTALL_CLEANUP
|
||||||
|
|
||||||
brew cleanup --prune=30
|
brew cleanup --prune=30
|
||||||
##brew cask cleanup: deprecated - merged with brew cleanup
|
|
||||||
#brew cask cleanup --outdated
|
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,17 @@
|
|||||||
|
|
||||||
# npm local install
|
# npm local install
|
||||||
local_path=/Users/bruno/Sites/node_modules/
|
local_path=/Users/bruno/Sites/node_modules/
|
||||||
chemin=$(pwd)
|
# folder contains Brewfile and Installer.md
|
||||||
|
#chemin=$(pwd)
|
||||||
|
chemin=$HOME/Documents/kymsu
|
||||||
#version: pip ou pip3
|
#version: pip ou pip3
|
||||||
pip_version=pip3
|
pip_version=pip3
|
||||||
#
|
#
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
#if [ ! -d chemin ]; then mkdir $chemin; fi
|
||||||
|
mkdir -p $chemin
|
||||||
|
|
||||||
now=$(date +"%d-%m-%Y_%T")
|
now=$(date +"%d-%m-%Y_%T")
|
||||||
mac=$(hostname -s)
|
mac=$(hostname -s)
|
||||||
file=$mac"@"$now
|
file=$mac"@"$now
|
||||||
@@ -23,19 +28,19 @@ echo -e "\033[1m🛠 Installed \033[0m"
|
|||||||
|
|
||||||
echo ''
|
echo ''
|
||||||
|
|
||||||
Installed=$(find . -name 'Installed*.md' -maxdepth 1)
|
Installed=$(find $chemin -name 'Installed*.md' -maxdepth 1)
|
||||||
if [ -n "$Installed" ]; then
|
if [ -n "$Installed" ]; then
|
||||||
echo -e "A file \033[93mInstalled*.md\033[0m already exist! We remove it."
|
echo -e "A file \033[93mInstalled*.md\033[0m already exist! We remove it."
|
||||||
a=$(echo "$Installed" | xargs rm)
|
a=$(echo "$Installed" | xargs rm)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -f Brewfile ]; then
|
if [ -f $chemin/Brewfile ]; then
|
||||||
echo -e "The \033[93mBrewfile\033[0m already exist! We rename it."
|
echo -e "The \033[93mBrewfile\033[0m already exist! We rename it."
|
||||||
find . -name 'Brewfile_*' -maxdepth 1 -print0 | xargs rm
|
find $chemin -name 'Brewfile_*' -maxdepth 1 -print0 | xargs rm
|
||||||
d=$(date -r Brewfile "+%d-%m-%Y_%H:%M:%S")
|
d=$(date -r $chemin/Brewfile "+%d-%m-%Y_%H:%M:%S")
|
||||||
|
|
||||||
mv Brewfile "Brewfile_$mac@$d"
|
mv "$chemin/Brewfile" "$chemin/Brewfile_$mac@$d"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -50,11 +55,11 @@ echo ''
|
|||||||
|
|
||||||
echo '## 🍺 Homebrew'
|
echo '## 🍺 Homebrew'
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list"
|
echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list"
|
||||||
|
|
||||||
echo '### Tap:' >> Installed.md
|
echo '### Tap:' >> $chemin/Installed.md
|
||||||
tap=$(brew tap)
|
tap=$(brew tap)
|
||||||
{
|
{
|
||||||
echo "\`\`\`bash"
|
echo "\`\`\`bash"
|
||||||
@@ -62,49 +67,49 @@ echo "$tap"
|
|||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list"
|
echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list"
|
||||||
|
|
||||||
echo '### Packages:' >> Installed.md
|
echo '### Packages:' >> $chemin/Installed.md
|
||||||
brew=$(brew list)
|
brew=$(brew list --formula)
|
||||||
{
|
{
|
||||||
echo "\`\`\`bash"
|
echo "\`\`\`bash"
|
||||||
echo "$brew"
|
echo "$brew"
|
||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
echo -e "🍺 Get Homebrew \033[3m\033[93mCask\033[0m installed list"
|
echo -e "🍺 Get Homebrew \033[3m\033[93mCask\033[0m installed list"
|
||||||
|
|
||||||
echo '### Casks:' >> Installed.md
|
echo '### Casks:' >> $chemin/Installed.md
|
||||||
cask=$(brew cask list)
|
cask=$(brew list --cask)
|
||||||
{
|
{
|
||||||
echo "\`\`\`bash"
|
echo "\`\`\`bash"
|
||||||
echo "$cask"
|
echo "$cask"
|
||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
# liste des apps de l'Appstore installées (nom & numéro)
|
# 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 -e "🍏 Get mas \033[3m\033[93mApp Store applications\033[0m list"
|
||||||
|
|
||||||
echo '## 🍏 mas (Mac App Store)' >> Installed.md
|
echo '## 🍏 mas (Mac App Store)' >> $chemin/Installed.md
|
||||||
echo '' >> Installed.md
|
echo '' >> $chemin/Installed.md
|
||||||
|
|
||||||
appfrommas=$(mas list | sort -k2)
|
appfrommas=$(mas list | sort -k2)
|
||||||
#echo "$appfrommas"
|
#echo "$appfrommas"
|
||||||
#declare -a appstore
|
#declare -a appstore
|
||||||
echo "\`\`\`bash" >> Installed.md
|
echo "\`\`\`bash" >> $chemin/Installed.md
|
||||||
# todo: trier la liste par nom
|
# todo: trier la liste par nom
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
number=$(echo "$line" | awk '{print $1}')
|
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')
|
name=$(echo "$line" | awk -F "(" '{print $1}' | awk '{first = $1; $1=""; print $0}' | sed 's/^ //g')
|
||||||
echo "$name ($number)" >> Installed.md
|
echo "$name ($number)" >> $chemin/Installed.md
|
||||||
#echo " " >> Installed.md
|
#echo " " >> Installed.md
|
||||||
#appstore["$name"]="${number}"
|
#appstore["$name"]="${number}"
|
||||||
done <<< "$appfrommas"
|
done <<< "$appfrommas"
|
||||||
@@ -112,14 +117,14 @@ done <<< "$appfrommas"
|
|||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
# Extensions PHP PECL
|
# Extensions PHP PECL
|
||||||
|
|
||||||
echo -e "🐘 Get PECL \033[3m\033[93mPHP extensions\033[0m list"
|
echo -e "🐘 Get PECL \033[3m\033[93mPHP extensions\033[0m list"
|
||||||
|
|
||||||
echo '## 🐘 PECL extensions' >> Installed.md
|
echo '## 🐘 PECL extensions' >> $chemin/Installed.md
|
||||||
echo '' >> Installed.md
|
echo '' >> $chemin/Installed.md
|
||||||
|
|
||||||
ext_pecl=$(pecl list | sed '1,3d' | awk '{print $1}')
|
ext_pecl=$(pecl list | sed '1,3d' | awk '{print $1}')
|
||||||
{
|
{
|
||||||
@@ -128,13 +133,13 @@ echo "$ext_pecl"
|
|||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
# Python packages (pip)
|
# Python packages (pip)
|
||||||
|
|
||||||
echo -e "🐍 Get pip \033[3m\033[93mPython 3 packages\033[0m installed list"
|
echo -e "🐍 Get pip \033[3m\033[93mPython 3 packages\033[0m installed list"
|
||||||
echo '## 🐍 Python packages' >> Installed.md
|
echo '## 🐍 Python packages' >> $chemin/Installed.md
|
||||||
echo '' >> Installed.md
|
echo '' >> $chemin/Installed.md
|
||||||
|
|
||||||
pip_packages=$($pip_version list | sed '1,2d' | awk '{print $1}')
|
pip_packages=$($pip_version list | sed '1,2d' | awk '{print $1}')
|
||||||
{
|
{
|
||||||
@@ -143,7 +148,7 @@ echo "$pip_packages"
|
|||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
# atom
|
# atom
|
||||||
|
|
||||||
@@ -163,7 +168,7 @@ done <<< "$atom"
|
|||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
# Node.js packages (npm)
|
# Node.js packages (npm)
|
||||||
|
|
||||||
@@ -179,7 +184,7 @@ echo '### Global:'
|
|||||||
echo "\`\`\`bash"
|
echo "\`\`\`bash"
|
||||||
echo "$pkg_global_npm"
|
echo "$pkg_global_npm"
|
||||||
echo "\`\`\`"
|
echo "\`\`\`"
|
||||||
} >> Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
if [ -d "$local_path" ]; then
|
if [ -d "$local_path" ]; then
|
||||||
cd "$local_path" || exit
|
cd "$local_path" || exit
|
||||||
@@ -202,7 +207,26 @@ if [ -d "$local_path" ]; then
|
|||||||
cd "$chemin" || exit
|
cd "$chemin" || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "" >> Installed.md
|
echo "" >> $chemin/Installed.md
|
||||||
|
|
||||||
|
# gem
|
||||||
|
|
||||||
|
echo -e "💍 Get \033[3m\033[93mgem\033[0m installed list"
|
||||||
|
gems=$(gem list --no-versions)
|
||||||
|
{
|
||||||
|
echo '## 💍 Gem packages'
|
||||||
|
echo ''
|
||||||
|
echo "\`\`\`bash"
|
||||||
|
|
||||||
|
while read -r line; do
|
||||||
|
a=$(echo "$line")
|
||||||
|
echo "$a"
|
||||||
|
done <<< "$gems"
|
||||||
|
|
||||||
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> $chemin/Installed.md
|
||||||
|
|
||||||
echo ''
|
echo ''
|
||||||
|
|
||||||
@@ -215,10 +239,12 @@ 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 -e "To restore everything listed in that file, run \033[3m\033[93m'$ brew bundle'\033[0m in folder that contains the Brewfile."
|
||||||
echo ''
|
echo ''
|
||||||
|
|
||||||
|
mv Brewfile "$chemin/Brewfile"
|
||||||
|
|
||||||
#iconv -f macroman -t utf-8 Installed.md > Installed-utf8.md
|
#iconv -f macroman -t utf-8 Installed.md > Installed-utf8.md
|
||||||
#mv Installed-utf8.md "$filename".md
|
#mv Installed-utf8.md "$filename".md
|
||||||
#rm Installed.md
|
#rm Installed.md
|
||||||
|
|
||||||
mv Installed.md "$filename".md
|
mv $chemin/Installed.md "$chemin/$filename".md
|
||||||
|
|
||||||
open "$filename".md
|
open "$chemin/$filename".md
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ if [[ $1 == "--nodistract" ]]; then
|
|||||||
no_distract=true
|
no_distract=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set ls_color to '' for output nvm list in colors, else '--no-colors'
|
# Set ls_color to '' for output nvm list in default colors, else '--no-colors'
|
||||||
ls_color='--no-colors'
|
# ls_color='--no-colors'
|
||||||
|
# ls_color='BrGcm' for custom colors
|
||||||
|
# export NVM_COLORS='BrGcm' in .zshrc for persistant custom colors
|
||||||
|
|
||||||
# Set doctor=true to run 'npm doctor' and 'npm cache verify' each time
|
# Set doctor=true to run 'npm doctor' and 'npm cache verify' each time
|
||||||
doctor=true
|
doctor=true
|
||||||
@@ -38,7 +38,25 @@ echo ""
|
|||||||
echo -e "\033[1m❗️ plugin en test (beta) \033[0m"
|
echo -e "\033[1m❗️ plugin en test (beta) \033[0m"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
pecl_upgrade=$(pecl list-upgrades)
|
# /usr/local/Cellar/php/7.4.11/bin/pecl
|
||||||
|
# /usr/local/Cellar/php@7.3/7.3.23/bin/pecl
|
||||||
|
# /usr/local/Cellar/php@7.2/7.2.33/bin/pecl
|
||||||
|
|
||||||
|
#pecl_upgrade=$(pecl list-upgrades)
|
||||||
|
|
||||||
|
version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}')
|
||||||
|
v=${version:0:3}
|
||||||
|
|
||||||
|
if [ "$v" = "7.3" ]; then
|
||||||
|
php_path=$(brew --prefix)/opt/php@7.3/bin
|
||||||
|
elif [ "$v" = "7.2" ]; then
|
||||||
|
php_path=$(brew --prefix)/opt/php@7.2/bin
|
||||||
|
elif [ "$v" = "7.4" ]; then
|
||||||
|
php_path=$(brew --prefix)/opt/php/bin
|
||||||
|
fi
|
||||||
|
|
||||||
|
pecl_upgrade=$($php_path/pecl list-upgrades)
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$pecl_upgrade" ]; then
|
if [ -n "$pecl_upgrade" ]; then
|
||||||
|
|
||||||
@@ -58,22 +76,27 @@ if [ -n "$pecl_upgrade" ]; then
|
|||||||
# Channel pear.php.net
|
# Channel pear.php.net
|
||||||
a=$(echo "$ligne" | grep "pear")
|
a=$(echo "$ligne" | grep "pear")
|
||||||
if [ -n "$a" ]; then
|
if [ -n "$a" ]; then
|
||||||
pecl channel-update pear.php.net
|
#pecl channel-update pear.php.net
|
||||||
|
$php_path/pecl channel-update pear.php.net
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Channel pecl.php.net
|
# Channel pecl.php.net
|
||||||
b=$(echo "$ligne" | grep "pecl")
|
b=$(echo "$ligne" | grep "pecl")
|
||||||
if [ -n "$b" ]; then
|
if [ -n "$b" ]; then
|
||||||
pecl channel-update pecl.php.net
|
#pecl channel-update pecl.php.net
|
||||||
|
$php_path/pecl channel-update pecl.php.net
|
||||||
|
|
||||||
#(pecl or doc) update available
|
#(pecl or doc) update available
|
||||||
b=$(echo "$ligne" | awk '{print $2}')
|
b=$(echo "$ligne" | awk '{print $2}')
|
||||||
pecl info "$b"
|
#pecl info "$b"
|
||||||
|
$php_path/pecl info "$b"
|
||||||
echo ""
|
echo ""
|
||||||
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
|
||||||
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
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
72
plugins.d/perl.sh
Executable file
72
plugins.d/perl.sh
Executable file
@@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Display info on updated pakages
|
||||||
|
display_info=true
|
||||||
|
|
||||||
|
# Also add module for prevent to update it.
|
||||||
|
declare -a do_not_update=('')
|
||||||
|
|
||||||
|
|
||||||
|
perl_app=$(which perl)
|
||||||
|
perl_v=$(perl -v | sed -n '2p')
|
||||||
|
|
||||||
|
echo -e "\033[4mPerl:\033[0m $perl_app"
|
||||||
|
echo -e "\033[4mVersion:\033[0m $perl_v"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
module="App::cpanoutdate"
|
||||||
|
if ! perl -M$module -e 1 2>/dev/null; then
|
||||||
|
echo -e "\033[4mRequierement:\033[0m module $module is not installed"
|
||||||
|
|
||||||
|
a=$(echo -e "Do you wanna run \033[1mcpan -i "$module"\033[0m ? (y/n)")
|
||||||
|
read -p "$a" choice
|
||||||
|
if [ "$choice" == "y" ]; then
|
||||||
|
#cpan -i $module
|
||||||
|
install_ok=true
|
||||||
|
else
|
||||||
|
echo "Bye"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$module installed"
|
||||||
|
install_ok=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$install_ok" == "true" ]; then
|
||||||
|
echo "$module installed"
|
||||||
|
|
||||||
|
# install with cpan
|
||||||
|
# % cpan-outdated | xargs cpan -i
|
||||||
|
|
||||||
|
# install with cpanm
|
||||||
|
# % cpan-outdated | cpanm
|
||||||
|
# % cpan-outdated -p | cpanm
|
||||||
|
|
||||||
|
outdated=$(cpan-outdated -p)
|
||||||
|
nb=$(echo $outdated | wc -w)
|
||||||
|
|
||||||
|
a=$(echo -e "Do you wanna update\033[1m "$nb" outdated\033[0m modules ? (y/n)")
|
||||||
|
read -p "$a" choice
|
||||||
|
|
||||||
|
if [ "$choice" == "y" ]; then
|
||||||
|
|
||||||
|
for i in $outdated
|
||||||
|
do
|
||||||
|
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||||
|
if [ "${FOUND}" = "" ]; then
|
||||||
|
echo ""
|
||||||
|
if [ "$display_info" = true ]; then
|
||||||
|
cpan -D "$i"
|
||||||
|
fi
|
||||||
|
echo -e "\033[1m"
|
||||||
|
echo "$i" | awk '{print $1}' | xargs -p -n 1 cpan -i
|
||||||
|
echo -e "\033[0m"
|
||||||
|
#echo ""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Bye"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
80
plugins.d/perlbrew.sh
Executable file
80
plugins.d/perlbrew.sh
Executable file
@@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#Display useful information about the perlbrew installation.
|
||||||
|
#If a module is given the version and location of the module is displayed.
|
||||||
|
perlbrew info
|
||||||
|
|
||||||
|
<<COMMENT
|
||||||
|
|
||||||
|
Current perl:
|
||||||
|
Name: perl-5.30.1
|
||||||
|
Path: /Users/bruno/perl5/perlbrew/perls/perl-5.30.1/bin/perl
|
||||||
|
Config: -de -Dprefix=/Users/bruno/perl5/perlbrew/perls/perl-5.30.1 -Aeval:scriptdir=/Users/bruno/perl5/perlbrew/perls/perl-5.30.1/bin
|
||||||
|
Compiled at: Dec 16 2019 08:44:12
|
||||||
|
|
||||||
|
perlbrew:
|
||||||
|
version: 0.87
|
||||||
|
ENV:
|
||||||
|
PERLBREW_ROOT: /Users/bruno/perl5/perlbrew
|
||||||
|
PERLBREW_HOME: /Users/bruno/perl5/perlbrew
|
||||||
|
PERLBREW_PATH: /Users/bruno/perl5/perlbrew/bin:/Users/bruno/perl5/perlbrew/perls/perl-5.30.1/bin
|
||||||
|
PERLBREW_MANPATH: /Users/bruno/perl5/perlbrew/perls/perl-5.30.1/man
|
||||||
|
|
||||||
|
COMMENT
|
||||||
|
|
||||||
|
# List the recently available versions of perl on CPAN.
|
||||||
|
perlbrew available
|
||||||
|
|
||||||
|
|
||||||
|
# Removes all previously downloaded Perl tarballs and build directories.
|
||||||
|
perlbrew clean
|
||||||
|
|
||||||
|
# Show the version of perlbrew.
|
||||||
|
perlbrew version
|
||||||
|
|
||||||
|
<<COMMENT
|
||||||
|
|
||||||
|
# Build and install the given versions of perl.
|
||||||
|
perlbrew install [options] stable
|
||||||
|
perlbrew install [options] blead
|
||||||
|
perlbrew install [options] <version>
|
||||||
|
# https://github.com/perl11/cperl
|
||||||
|
perlbrew install [options] cperl-<version>
|
||||||
|
|
||||||
|
Options for "install" command:
|
||||||
|
|
||||||
|
-f --force Force installation
|
||||||
|
-j $n Parallel building and testing. ex. C<perlbrew install -j 5 perl-5.14.2>
|
||||||
|
-n --notest Skip testing
|
||||||
|
|
||||||
|
--switch Automatically switch to this Perl once successfully
|
||||||
|
installed, as if with `perlbrew switch <version>`
|
||||||
|
|
||||||
|
--as Install the given version of perl by a name.
|
||||||
|
ex. C<perlbrew install perl-5.6.2 --as legacy-perl>
|
||||||
|
|
||||||
|
--noman Skip installation of manpages
|
||||||
|
|
||||||
|
--thread Build perl with usethreads enabled
|
||||||
|
--multi Build perl with usemultiplicity enabled
|
||||||
|
--64int Build perl with use64bitint enabled
|
||||||
|
--64all Build perl with use64bitall enabled
|
||||||
|
--ld Build perl with uselongdouble enabled
|
||||||
|
--debug Build perl with DEBUGGING enabled
|
||||||
|
--clang Build perl using the clang compiler
|
||||||
|
--no-patchperl
|
||||||
|
Skip calling patchperl
|
||||||
|
|
||||||
|
-D,-U,-A Switches passed to perl Configure script.
|
||||||
|
ex. C<perlbrew install perl-5.10.1 -D usemymalloc -U versiononly>
|
||||||
|
|
||||||
|
--destdir $path
|
||||||
|
Install perl as per 'make install DESTDIR=$path'
|
||||||
|
|
||||||
|
--sitecustomize $filename
|
||||||
|
Specify a file to be installed as sitecustomize.pl
|
||||||
|
|
||||||
|
# Uninstalls the given perl installation.
|
||||||
|
perlbrew uninstall <name>
|
||||||
|
|
||||||
|
COMMENT
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
# upgrade pip:
|
# upgrade pip:
|
||||||
# python -m pip install --upgrade pip
|
# python -m pip install --upgrade pip
|
||||||
|
|
||||||
#export PIP_USE_FEATURE=2020-resolver
|
# Configurer pip3:
|
||||||
#export PIP_USE_FEATURE=fast-deps
|
|
||||||
# pip config edit
|
# pip config edit
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
@@ -15,16 +14,28 @@
|
|||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
#version: pip ou pip3
|
#version: pip ou pip3
|
||||||
|
# pip: python3.8 - pip3: python3.9
|
||||||
pip_version=pip3
|
pip_version=pip3
|
||||||
#user: "" or "--user"
|
#user: "" or "--user"
|
||||||
user=""
|
user=""
|
||||||
# No distract mode
|
# No distract mode
|
||||||
no_distract=false
|
no_distract=false
|
||||||
#add module to do_not_update array
|
#add module to do_not_update array
|
||||||
declare -a do_not_update=()
|
#declare -a do_not_update=()
|
||||||
|
#declare -a do_not_update=("parso" "asgiref")
|
||||||
|
declare -a do_not_update=("asgiref")
|
||||||
#
|
#
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
italic="\033[3m"
|
||||||
|
underline="\033[4m"
|
||||||
|
bold="\033[1m"
|
||||||
|
redbox="\033[1;41m"
|
||||||
|
redbold="\033[1;31m"
|
||||||
|
red="\033[31m"
|
||||||
|
yellow="\033[33m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
if [[ $1 == "--nodistract" ]]; then
|
||||||
no_distract=true
|
no_distract=true
|
||||||
fi
|
fi
|
||||||
@@ -34,21 +45,36 @@ if ! [ -x "$(command -v $pip_version)" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\033[1m🐍 $pip_version (Python 3) \033[0m"
|
echo -e "${bold}🐍 $pip_version (Python 3) ${reset}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\033[31mpip use features 2020-resolver & fast-deps for testings. pip 20.3 (10/2020) pip definitively this features.\033[0m"
|
|
||||||
|
|
||||||
|
echo -e "Current ${underline}Python3${reset} version: $(python3 -V | awk '{print $2}')"
|
||||||
|
echo -e "Current ${underline}pip3${reset} version: $(pip3 -V)"
|
||||||
|
|
||||||
|
#$pip_version install --upgrade pip
|
||||||
|
$pip_version install --upgrade pip > /dev/null
|
||||||
echo ""
|
echo ""
|
||||||
$pip_version install --upgrade pip
|
|
||||||
echo ""
|
if (( ${#do_not_update[@]} )); then
|
||||||
|
|
||||||
|
nbp=${#do_not_update[*]}
|
||||||
|
|
||||||
|
echo -e "${underline}List of${reset} ${redbox} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
||||||
|
echo -e "${redbold}${do_not_update[*]}${reset}"
|
||||||
|
echo "To remove package from this list, you need to edit the do_not_update array."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
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}')
|
||||||
|
|
||||||
if [ -n "$upd" ]; then
|
if [ -n "$upd" ]; then
|
||||||
|
|
||||||
echo -e "\033[4mAvailables updates:\033[0m"
|
nb=$(echo "$upd" | wc -w | xargs)
|
||||||
|
|
||||||
|
echo -e "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
|
||||||
#echo $pip3_outdated_freeze | tr [:space:] '\n'
|
#echo $pip3_outdated_freeze | tr [:space:] '\n'
|
||||||
echo "$pip_outdated"
|
echo "$pip_outdated"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -56,16 +82,12 @@ if [ -n "$upd" ]; then
|
|||||||
for i in $upd
|
for i in $upd
|
||||||
do
|
do
|
||||||
info=$($pip_version show "$i")
|
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 "$info" | head -4
|
||||||
echo ''
|
echo ""
|
||||||
#echo "$i"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -x "$(command -v pipdeptree)" ]; then
|
if [ -x "$(command -v pipdeptree)" ]; then
|
||||||
echo -e "\033[4mCheck dependancies:\033[0m"
|
echo -e "${underline}Check dependancies:${reset}"
|
||||||
echo "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version."
|
echo "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version."
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
@@ -74,19 +96,28 @@ if [ -n "$upd" ]; then
|
|||||||
if [ -x "$(command -v pipdeptree)" ]; then
|
if [ -x "$(command -v pipdeptree)" ]; then
|
||||||
dependencies=$(echo "$i" | xargs pipdeptree -r -p | grep "$upd")
|
dependencies=$(echo "$i" | xargs pipdeptree -r -p | grep "$upd")
|
||||||
|
|
||||||
|
#asgiref==3.2.10
|
||||||
|
# - Django==3.1.2 [requires: asgiref~=3.2.10]
|
||||||
|
|
||||||
|
#parso==0.7.1
|
||||||
|
# - jedi==0.17.2 [requires: parso>=0.7.0,<0.8.0]
|
||||||
|
|
||||||
z=0
|
z=0
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ $line = *"<"* ]]; then
|
if [[ $line = *"<"* ]]; then
|
||||||
echo -e "\033[31m$line\033[0m"
|
echo -e "${red}$line${reset}"
|
||||||
|
elif [[ $line = *"~="* ]]; then
|
||||||
|
echo -e "${yellow}$line${reset}"
|
||||||
else
|
else
|
||||||
if [ "$z" -eq 0 ]; then
|
if [ "$z" -eq 0 ]; then
|
||||||
echo -e "\033[3m$line\033[0m"
|
echo -e "${italic}$line${reset}"
|
||||||
else
|
else
|
||||||
echo "$line"
|
echo "$line"
|
||||||
fi
|
fi
|
||||||
z=$((z+1))
|
z=$((z+1))
|
||||||
fi
|
fi
|
||||||
done <<< "$dependencies"
|
done <<< "$dependencies"
|
||||||
|
echo ""
|
||||||
|
|
||||||
else
|
else
|
||||||
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
||||||
@@ -104,7 +135,7 @@ if [ -n "$upd" ]; then
|
|||||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||||
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
|
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
|
||||||
|
|
||||||
b=$(echo -e "Do you wanna run \033[1m$pip_version install $user --upgrade $i\033[0m ? (y/n)")
|
b=$(echo -e "Do you wanna run ${bold}$pip_version install $user --upgrade $i${reset} ? (y/n)")
|
||||||
read -p "$b" choice
|
read -p "$b" choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y|o ) echo "$i" | xargs $pip_version install $user --upgrade ;;
|
y|Y|o ) echo "$i" | xargs $pip_version install $user --upgrade ;;
|
||||||
@@ -116,17 +147,16 @@ if [ -n "$upd" ]; then
|
|||||||
elif [ "${FOUND}" = "" ]; then
|
elif [ "${FOUND}" = "" ]; then
|
||||||
|
|
||||||
echo "$i" | xargs $pip_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
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo availables updates.\033[0m"
|
echo -e "${underline}No availables updates.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
echo -e "🐍 Running \033[1mpip check\033[0m for checking that everything is ok."
|
echo -e "🐍 Running ${bold}pip check${reset} for checking that everything is ok."
|
||||||
|
|
||||||
$pip_version check
|
$pip_version check
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user