57 Commits
v0.9 ... v2.2

Author SHA1 Message Date
a32a0d6ded 5 scripts
+update colors strings
+update parameter ‘—nodistract’
2021-01-09 15:05:29 +01:00
9d8b924a30 node.sh install.sh
minor bugfixs
2021-01-09 14:13:24 +01:00
a5c0c2b011 antibody.sh
+antibody version
2021-01-09 14:12:29 +01:00
1061909d5b pip.sh
Rebuild from scratch
2021-01-09 13:04:07 +01:00
02648b8f83 node.sh
+use npm outdated —long instead npm outdated
2021-01-09 13:03:03 +01:00
e97ae7ec2c homebrew.sh
+minor dialog corrections
2021-01-09 13:00:28 +01:00
064ae0ecf0 homebrew.sh
Bugfix:
-nb de cask
-brew info —cask et brew upgrade —cask (pour les casks comme docker qui existe aussi en formula
2021-01-07 17:36:36 +01:00
cb0a07339d node.sh
Features:
+rebuild from scratch
+info on updated modules
2021-01-06 11:30:19 +01:00
560bb5e13b homebrew.sh
Release version 2.0
2021-01-05 16:57:13 +01:00
64264174b4 homebrew.sh
Feature:
+info casks latest
2021-01-05 11:49:28 +01:00
6b4dfb2abb homebrew.sh
Feature:
+test if Apache conf file has been modified by Homebrew
2021-01-04 18:57:50 +01:00
1d2a6b5e3b homebrew.sh
Features:
+display number of updates
+message about required (jq) or recommended (terminal-notifier) softwares

Cleaning code.
2021-01-04 18:51:57 +01:00
f337e0c62b homebrew.sh
build from scratch:
+add descriptions for packages/casks
2021-01-04 08:52:05 +01:00
3e88dc59df homebrew.sh
rebuild from scratch
2021-01-03 10:04:05 +01:00
e6fb194868 homebrew.sh
+update comments
2021-01-03 09:59:24 +01:00
5268f23fcd node.sh
+rename npm.sh to node.sh
+custom npm list colors
2021-01-01 07:30:04 +01:00
2adb0f1064 pip.sh
Replace \033[1m by ${bold}.
Idem for others styles
2020-12-30 08:26:20 +01:00
9f6cb2e72e New installer
Features:
+when update, disabled plugins stay disabled
+if new install, choice to disable some plugins
2020-12-30 08:21:46 +01:00
c390f22b0f pip.sh
use pip3
2020-12-27 16:58:22 +01:00
8e15aa05a0 homebrew.sh
-bugfix
2020-12-27 16:57:56 +01:00
e5e2aa5d60 02-12-2020
-homebrew.sh: brew info --cask remplace brew cask info
-pip.sh: suppression de features 2020-resolver
2020-12-02 08:03:03 +01:00
ae8a356f1a homebrew.sh
-brew upgrade —formula
-brew upgrade —cask
-brew list --formulae --pinned
2020-11-06 17:17:26 +01:00
f77903f01d option —latest
homebrew.sh & kymsu2.sh:
-ajout d’une option —latest pour afficher les casks ‘latest’
2020-10-30 11:42:01 +01:00
d368c37788 pecl.sh
-bugfix
2020-10-16 06:22:44 +02:00
e4db3040d2 homebrew.sh
-bugfix
2020-10-16 06:22:25 +02:00
2947d9e7c6 pip.sh
-bugfix
-compatibilité Python 3.9
2020-10-16 06:21:27 +02:00
81c8ad34aa antibody.sh
1 seule notification même si plusieurs màj
2020-10-02 15:06:38 +02:00
731142630b 27-09-2020
-homebrew.sh
-pip.sh
-README.md
2020-09-27 18:51:29 +02:00
380967c8d4 homebrew.sh
-cleaning code
2020-09-20 07:55:10 +02:00
4b06dd1079 homebrew.sh
Corrige les erreurs:
 -Warning: Calling brew cask outdated is deprecated! Use brew outdated --cask instead.
 -Warning: Calling brew cask reinstall is deprecated! Use brew reinstall instead.
 -Warning: Calling brew cask upgrade is deprecated! Use brew upgrade --cask instead.
2020-09-15 08:11:53 +02:00
6895aa8cc5 success.png 2020-09-15 08:04:20 +02:00
6e8361312c Bugfix
-pecl refonctionne
-ajout d’espace pour antibody
2020-09-02 18:25:56 +02:00
a434e2814a pip.sh
-remplacement de la variable $version par $pip_version

Nouveau:
-ajout de la commande ‘pip check’
-notice sur les nouvelles options ‘2020-resolver’ et ‘fast-deps’ (pas de changement dans le script mais ajout des options dans ‘pip config edit’)
2020-08-05 09:17:23 +02:00
0077eaca53 Antibody.sh
Nouveau:
-affiche le dossiers où s’installent les modulent
2020-08-05 09:12:16 +02:00
81afb2846e Nouveau module Antibody
Antibody est un gestionnaire de plugin pour zsh:
https://getantibody.github.io

La commande ‘antibody update’  recherche les m-à-j ET les installe.
2020-08-05 09:10:58 +02:00
285b991b09 Plugin Antibody
Antibody est un gestionnaire de module pour zsh
2020-07-24 08:00:38 +02:00
3651ee64be channel "pecl.php.net"
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
2020-06-05 08:13:58 +02:00
3eeff4b705 npm.sh
--no-colors options:
nvm list —no-colors
2020-04-18 07:20:15 +02:00
4620ab071d homebrew.sh
bugfix: ne pas tester la modif des php.ini si il n’y a pas eu de mises-à-jouir
2020-03-17 14:24:03 +01:00
78f4158361 npm.sh
Feature: update nvm from github.com
2020-01-27 18:20:10 +01:00
e5ae3745f7 README.md
-add bash 5 requirement for associative array
2020-01-26 12:24:40 +01:00
1648fbb13e homebrew.sh
-update package (yes/no/ALL)
2020-01-26 09:42:57 +01:00
80e905ec4e Cleaning code 2020-01-25 06:40:56 +01:00
3f61fa4a57 Cleaning code 2020-01-25 06:40:30 +01:00
648bd9d211 homebrew.sh
-bugfix si aucune màj de paquet n’est dispo
2019-12-20 08:43:32 +01:00
be093d2455 Minor bugfix
-temps de modification de php.ini ramené à 5mn
2019-12-10 12:38:51 +01:00
cf760c8b3a Minors bugfixs
-running hellcheck
-optimize md file
2019-12-09 19:53:21 +01:00
1f8e7c7c4d Update README.md 2019-12-08 08:04:54 +01:00
8497b0d0d5 pecl.sh
-notification si php.ini a été modifié
-option pour éditer le php.ini
2019-12-07 21:13:28 +01:00
d076210d4f homebrew.sh
-affichage des paquets ‘pinned’
-l’installation de jq (processeur json) est préconnisée
2019-12-07 19:54:17 +01:00
ce5fa6e908 homebrew.sh
-update pinned detection and information
-required jq for more information
-cleaning code
2019-12-04 09:25:24 +01:00
5dab2b9d33 homebrew.sh 2019-12-03 11:43:00 +01:00
e8a6b02a95 Homebrew - Pinned package support 2019-12-02 08:21:18 +01:00
f354d0b699 homebrew.sh
Notification si php.ini a été modifié
2019-11-07 21:41:35 +01:00
4399d440ec homebrew.sh
Ajout d’une notification si httpd.conf a été modifié
2019-11-07 14:04:49 +01:00
f678d88c78 Bugfix
-correction de l’encodage si le script est lancé depuis LauchAgent
2019-10-28 13:28:30 +01:00
d0898cb1e4 Bugfix - amélioration
-le fichier Installed.md est maintenant crée avec le bon encodage utf-8 (iconv)
-les applis du mas sont triées par ordre alphabétique (sort -k2)
2019-10-28 10:35:16 +01:00
19 changed files with 1509 additions and 466 deletions

0
.gitattributes vendored Normal file
View File

0
.gitignore vendored Normal file
View File

View File

@@ -2,14 +2,19 @@
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:
- **atom** (plug-ins)
- **antibody** (zsh plug-ins)
- **homebrew** (brew and cask)
- **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)
- **pip** (Python Package index) (pip or pip3)
- **PECL** (PHP modules)
@@ -20,7 +25,13 @@ https://github.com/welcoMattic/kymsu
## Requirements
- [Homebrew](https://brew.sh/)
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) for checking dependancies (pip plugin)
- [jq](https://github.com/stedolan/jq) *(brew install jq)* for processing JSON data (homebrew plugin)
Optionnal:
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) *(pip install pipdeptree)* for checking dependancies (pip 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)~~ (homebrew plugin 2.0)

View File

@@ -1,14 +1,70 @@
#!/usr/bin/env bash
italic="\033[3m"
underline="\033[4m"
bold="\033[1m"
reset="\033[0m"
KYMSU_PATH=`pwd`
# Make Kymsu accessible in PATH
echo -e "\nInstalling ${bold}kymsu2${reset} in ${bold}/usr/local/bin${reset} ..."
ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
# Store Kymsu stuff in home directory
mkdir -p ~/.kymsu && echo "${KYMSU_PATH}" > ~/.kymsu/path
cp -R "${KYMSU_PATH}/plugins.d" ~/.kymsu
mkdir -p $HOME/.kymsu && echo "${KYMSU_PATH}" > $HOME/.kymsu/path
echo "altKYMSU has been installed. Run kymsu2 command!"
echo "It's a fork from https://github.com/welcoMattic/kymsu"
echo "All credits to welcoMattic"
pluginpath=$HOME/.kymsu/plugins.d/
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

135
plugins.d/antibody.sh Executable file
View File

@@ -0,0 +1,135 @@
#!/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)
[[ $@ =~ "--nodistract" ]] && no_distract=true || 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)
#
###############################################################################################
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() {
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
}
antibody_folder=$(antibody home)
antibody_version=$(antibody -v 2>&1 | awk '{print $3}')
echo -e "${bold}🙏 Antibody ${reset}\n"
echo -e "Current ${underline}Antibody${reset} version: $antibody_version\n"
update=$(antibody update 2>&1)
installed=$(echo "$update" | grep "updating")
updated=$(echo "$update" | grep "updated")
if [ -n "$installed" ]; then
echo -e "${underline}Antibody modules installed:${reset}"
#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 "${bold}$module${reset} ($url)"
done
echo ""
echo "Modules are installed in $antibody_folder folder."
else
echo -e "${underline}No Antibody modules installed.${reset}"
fi
<<COMMENT
antibody update:
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 "${underline}Antibody modules to update:${reset}"
#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 "${bold}$module${reset} ($url)"
echo "Commits: $commit"
echo "Last commit: "$url"/commits/"$last_commit
# https://github.com/zsh-users/zsh-completions/commits/
modules+="$module "
done
notif="$modules has been updated"
notification "$notif"
else
echo -e "${underline}No Antibody modules to update.${reset}"
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 ""

69
plugins.d/conda.sh Executable file
View 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

BIN
plugins.d/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

49
plugins.d/gem.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/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
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
italic="\033[3m"
underline="\033[4m"
ita_under="\033[3;4m"
bold="\033[1m"
bold_under="\033[1;4m"
redbox="\033[1;41m"
redbold="\033[1;31m"
red="\033[31m"
yellow="\033[33m"
reset="\033[0m"
echo -e "${bold} 💍 Gem (Ruby) ${reset}"
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 "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
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 "${underline}No gem updates.${reset}"
fi

View File

@@ -3,176 +3,465 @@
# Homebrew plugin for 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:
# Display info on updated pakages
# Display info on updated pakages / casks
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.
# declare -a do_not_update=("xnconvert" "yate")
declare -a cask_to_not_update=()
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
no_distract=false
[[ $@ =~ "--nodistract" ]] && no_distract=true || 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=false
#
#########################################
###############################################################################################
#
# Require software (brew install):
# -jq (Lightweight and flexible command-line JSON processor)
#
# Recommended software (brew install):
# -terminal-notifier (Send macOS User Notifications from the command-line)
#
###############################################################################################
if [[ $1 == "--nodistract" ]]; then
no_distract=true
fi
: <<'END_COMMENT'
blabla
END_COMMENT
echo -e "\033[1m🍺 Homebrew \033[0m"
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"
command -v terminal-notifier >/dev/null 2>&1 || { echo -e "You shoud intall ${bold}terminal-notifier${reset} for notification ${italic}(brew install terminal-notifier)${reset}.\n"; }
command -v jq >/dev/null 2>&1 || { echo -e "${bold}kymsu2${reset} require ${bold}jq${reset} but it's not installed.\nRun ${italic}(brew install jq)${reset}\nAborting..." >&2; exit 1; }
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
}
get_info_cask() {
info="$1"
app="$2"
l1=""
token=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.token)')
name=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.name)' | jq -r '.[0]')
homepage=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.homepage)')
url=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.url)')
desc=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.desc)')
version=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.version)')
#auto_updates=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.auto_updates)')
#caveats=$(echo "$info" | jq -r '.[] | select(.token == "'${app}'") | (.caveats)')
installed_versions=$(echo "$upd_cask" | jq -r '.[] | select(.name == "'${app}'") | (.installed_versions)')
current_version=$(echo "$upd_cask" | jq -r '.[] | select(.name == "'${app}'") | (.current_version)')
[[ "$desc" = "null" ]] && desc="${italic}No description${reset}"
if [[ ! " ${casks_not_pinned} " =~ " ${token} " ]] && [[ ! " ${casks_latest_not_pinned} " =~ " ${token} " ]]; then
l1+="${red}$name ($token): installed: $installed_versions current: $current_version [Do not update]${reset}\n"
else
l1+="${bold}$name ($token): installed: $installed_versions current: $current_version${reset}\n"
fi
l1+="$desc\n"
l1+="$homepage"
echo -e "$l1\n"
}
get_info_pkg() {
info="$1"
pkg="$2"
l1=""
name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.name)')
full_name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.full_name)')
desc=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.desc)')
homepage=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.homepage)')
#urls=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.urls)' | jq -r '.stable | .url')
keg_only=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.keg_only)')
caveats=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.caveats)')
stable=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.versions)' | jq -r '.stable')
installed=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.installed)' | jq -r '.[].version')
pinned=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned)')
if [ "$pinned" = "true" ]; then
pinned_v=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned_version)')
l1+="${red}$name: installed: $installed stable: $stable [pinned at $pinned_v]"
[ "$keg_only" = true ] && l1+=" [keg-only]"
l1+="${reset}\n"
else
l1+="${bold}$name: installed: $installed stable: $stable"
[ "$keg_only" = true ] && l1+=" [keg-only]"
l1+="${reset}\n"
fi
if [ "$desc" != "null" ]; then l1+="$desc\n"; fi;
l1+="$homepage"
echo -e "$l1\n"
}
echo -e "${bold}🍺 Homebrew ${reset}"
echo -e "\n🍺 ${underline}Updating brew...${reset}\n"
brew update
echo ""
brew_outdated=$(brew outdated --greedy --json=v2)
brew_outdated=$(brew outdated)
upd3=$(echo "$brew_outdated" | awk '{print $1}')
#echo "\nSearch for brew update...\n"
upd_json=$(echo "$brew_outdated")
#nb=$(echo $upd3 | wc -w)
################
### Packages ###
################
if [ -n "$upd3" ]; then
# Packages update:
echo -e "\n🍺 ${underline}Search for packages update...${reset}\n"
upd_package=$(echo "$brew_outdated" | jq '{formulae} | .[]')
if [ "$display_info" = true ]; then
echo -e "\033[4mInfo on updated packages:\033[0m"
for pkg in $upd3
do
for row in $(jq -c '.[]' <<< "$upd_package");
do
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_version=$(echo "$row" | jq -j '.pinned_version')
# 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"
else
info=$(brew info $pkg | head -n 4)
ligne1=$(echo "$info" | head -n 1)
echo -e "\033[1m$ligne1\033[0m"
echo "$info" | sed -n -e '2,3p'
fi
echo ""
done
upd_pkgs+="$name "
if [ "$pinned" = true ]; then
upd_pkg_pinned+="$name "
elif [ "$pinned" = false ]; then
upd_pkg_notpinned+="$name "
fi
done
upd_pkgs=$(echo "$upd_pkgs" | sed 's/.$//')
upd_pkg_pinned=$(echo "$upd_pkg_pinned" | sed 's/.$//')
upd_pkg_notpinned=$(echo "$upd_pkg_notpinned" | sed 's/.$//')
# Find infos about updated packages
nb_pkg_upd=$(echo "$upd_pkgs" | wc -w | xargs)
if [ "$nb_pkg_upd" -gt 0 ]; then
a="available package update"
array=($a)
if [ "$display_info" = true ]; then
[ "$nb_pkg_upd" -gt 1 ] && echo -e "${box} $nb_pkg_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_pkg_upd ${reset} ${array[@]}:\n"
upd_pkgs_info=$(brew info --json=v2 $upd_pkgs | jq '{formulae} | .[]')
for row in $upd_pkgs;
do
get_info_pkg "$upd_pkgs_info" "$row"
done
else
[ "$nb_pkg_upd" -gt 1 ] && echo -e "${box} $nb_pkg_upd ${reset} ${array[@]/%/s}: ${bold}$upd_pkgs${reset}" || echo -e "${box} $nb_pkg_upd ${reset} ${array[@]}: ${bold}$upd_pkgs${reset}"
fi
fi
# Pinned packages
pkg_pinned=$(brew list --pinned | xargs)
if [ -n "$pkg_pinned" ]; then
nbp=$(echo "$pkg_pinned" | wc -w | xargs)
echo -e "\n${underline}List of${reset} ${box} $nbp ${reset} ${underline}pinned packages:${reset}"
echo -e "${red}$pkg_pinned${reset}"
echo "To update a pinned package, you need to un-pin it manually (brew unpin <formula>)"
echo ""
fi
### Usefull for notify recent modification of apache/mysql/php conf files. ###
touch /tmp/checkpoint
# Updating packages
echo -e "\n🍺 ${underline}Updating packages...${reset}\n"
[ -n "$upd_pkg_notpinned" ] && echo -e "${red}Pinned: $upd_pkg_pinned . It won't be updated!'${reset}\n"
if [ -n "$upd_pkg_notpinned" ]; then
if [ "$no_distract" = false ]; then
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$upd3"\033[0m? (y/n)")
a=$(echo -e "Do you wanna run ${bold}brew upgrade "$upd_pkg_notpinned"${reset} ? (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 ;;
# n|N ) echo "Ok, let's continue";;
# * ) echo "invalid";;
#esac
if [ "$choice" == "y" ]; then
for i in $upd3
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
for i in $upd_pkg_notpinned;
do
FOUND=`echo ${do_not_update[*]} | grep "$i"`
if [ "${FOUND}" = "" ]; then
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew upgrade
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
echo "$i" | xargs -p -n 1 brew upgrade
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
echo "$i" | xargs -n 1 brew upgrade
fi
done
else
echo "Ok, let's continue"
echo -e "OK, let's continue..."
fi
else
echo "$brew_outdated" | awk '{print $1}' | xargs -n 1 brew upgrade
#echo "No distract"
echo -e "Running ${bold}brew upgrade $upd_pkg_notpinned${reset}..."
echo "$upd_pkg_notpinned" | xargs -n 1 brew upgrade
fi
echo ""
fi
echo "🍺 Casks upgrade."
cask_outdated=$(brew cask outdated --greedy --verbose)
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
do
FOUND=`echo ${do_not_update[*]} | grep "$i"`
if [ "${FOUND}" == "" ]; then
echo "$i" | xargs brew cask reinstall
fi
done
else
echo -e "\033[4mNo availables Cask updates.\033[0m"
echo -e "\n${italic}No update package available...${reset}\n"
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
#############
### Casks ###
#############
#Casks update
echo -e "\n🍺 ${underline}Casks...${reset}\n"
upd_cask=$(echo "$brew_outdated" | jq '{casks} | .[]')
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 "
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/.$//')
# Do not update casks
if (( ${#cask_to_not_update[@]} )); then
# cask_to_not_update contient 1 cask ET/OU 1 latest
nbp=${#cask_to_not_update[*]}
echo -e "${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' casks:${reset}"
echo -e "${red}${cask_to_not_update[*]}${reset}"
echo -e "To remove an app from this list, you need to edit the ${italic}do_not_update${reset} array."
echo ""
read -p "Do you wanna run Cask (latest) upgrade? (y/n)" choice
casks_not_pinned=""
for i in $upd_casks
do
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
casks_not_pinned+="$i "
fi
done
casks_not_pinned=$(echo "$casks_not_pinned" | sed 's/.$//')
if [ "$choice" == "y" ]; then
for i in "$latest"
casks_latest_not_pinned=""
for i in $upd_casks_latest
do
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
casks_latest_not_pinned+="$i "
fi
done
casks_latest_not_pinned=$(echo "$casks_latest_not_pinned" | sed 's/.$//')
else
casks_not_pinned=$upd_casks
casks_latest_not_pinned=$upd_casks_latest
fi
#Casks update
echo -e "🍺 ${underline}Search for casks update...${reset}\n"
# Find infos about updated casks
nb_casks_upd=$(echo "$upd_casks" | wc -w | xargs)
if [ "$nb_casks_upd" -gt 0 ]; then
a="available cask update"
array=($a)
if [ "$display_info" = true ]; then
[ "$nb_casks_upd" -gt 1 ] && echo -e "${box} $nb_casks_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_casks_upd ${reset} ${array[@]}:\n"
upd_casks_info=$(brew info --cask --json=v2 $upd_casks | jq '{casks} | .[]')
for row in $upd_casks;
do
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew cask upgrade --greedy
echo $?
get_info_cask "$upd_casks_info" "$row"
done
else
echo "Ok, let's continue"
[ "$nb_casks_upd" -gt 1 ] && echo -e "${box} $nb_casks_upd ${reset} ${array[@]/%/s}: ${bold}$upd_casks${reset}" || echo -e "${box} $nb_casks_upd ${reset} ${array[@]}: ${bold}$upd_casks${reset}"
fi
fi
# Updating casks
echo -e "\n🍺 ${underline}Updating casks...${reset}\n"
[ "${#cask_to_not_update[@]}" -gt 0 ] && echo -e "${red}Do not update: ${cask_to_not_update[@]} . It won't be updated!'${reset}\n"
[ -n "$casks_latest_not_pinned" ] && echo -e "Some Casks have ${italic}auto_updates true${reset} or ${italic}version :latest${reset}. Homebrew Cask cannot track versions of those apps."
[ -n "$casks_latest_not_pinned" ] && echo -e "Edit this script and change the setting ${italic}latest=false${reset} to ${italic}true${reset}\n"
if [ -n "$casks_not_pinned" ]; then
if [ "$no_distract" = false ]; then
a=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_not_pinned${reset} ? (y/n/a) ")
# yes/no/all
read -p "$a" choice
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
echo ""
for i in $casks_not_pinned;
do
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
# --cask required for Cask like 'docker'. It can be a formula or a cask.
echo "$i" | xargs -p -n 1 brew upgrade --cask
echo ""
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
echo "$i" | xargs -n 1 brew upgrade --cask
echo ""
fi
done
else
echo -e "OK, let's continue..."
fi
else
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
fi
else
echo -e "\n${italic}No update cask available...${reset}\n"
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)
# 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"
# Find infos about updated casks
nb_casks_latest_upd=$(echo "$upd_casks_latest" | wc -w | xargs)
if [ "$nb_casks_latest_upd" -gt 0 ]; then
a="available cask update"
array=($a)
if [ "$display_info" = true ]; then
[ "$nb_casks_latest_upd" -gt 1 ] && echo -e "${box} $nb_casks_latest_upd ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_casks_latest_upd ${reset} ${array[@]}:\n"
upd_casks_latest_info=$(brew info --cask --json=v2 $upd_casks_latest | jq '{casks} | .[]')
for row in $upd_casks_latest;
do
get_info_cask "$upd_casks_latest_info" "$row"
done
else
[ "$nb_casks_latest_upd" -gt 1 ] && echo -e "${box} $nb_casks_latest_upd ${reset} ${array[@]/%/s}: ${bold}$upd_casks_latest${reset}" || echo -e "${box} $nb_casks_upd ${reset} ${array[@]}: ${bold}$upd_casks_latest${reset}"
fi
fi
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
echo ""
for i in $casks_latest_not_pinned
do
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
echo "$i" | xargs -p -n 1 brew upgrade --cask
echo ""
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
echo "$i" | xargs -n 1 brew upgrade --cask
echo ""
fi
done
else
echo -e "OK, let's continue..."
fi
else
echo -e "Running ${bold}brew upgrade $casks_latest_not_pinned${reset}..."
echo "$casks_latest_not_pinned" | xargs -n 1 brew upgrade
fi
fi
###############################################################
### 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"
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"
fi
done
echo ""
##############
### Doctor ###
##############
echo -e "\n🍺 ${underline}The Doc is checking that everything is ok...${reset}\n"
brew doctor
brew missing
status=$?
if [ $status -ne 0 ]; then brew missing --verbose; fi
echo ""
# Homebrew 2.0.0+ run a cleanup every 30 days
if [[ $1 == "--cleanup" ]]; then
echo "🍺 Cleaning brewery"
##brew cleanup -s
# keep 30 days
echo -e "🍺 Cleaning brewery..."
#HOMEBREW_NO_INSTALL_CLEANUP
brew cleanup --prune=30
##brew cask cleanup: deprecated - merged with brew cleanup
#brew cask cleanup --outdated
echo ""
fi

View File

@@ -8,179 +8,225 @@
# npm local install
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=pip3
pip_version=pip3
#
#########################################
#if [ ! -d chemin ]; then mkdir $chemin; fi
mkdir -p $chemin
now=$(date +"%d-%m-%Y_%T")
mac=$(hostname -s)
file=$mac"@"$now
#echo "$file"
filename="Installed_$file"
echo -e "\033[1m🛠 Installed \033[0m"
echo ''
Installed=$(find . -name 'Installed*.md' -maxdepth 1)
Installed=$(find $chemin -name 'Installed*.md' -maxdepth 1)
if [ -n "$Installed" ]; then
echo -e "A file \033[93mInstalled*.md\033[0m already exist! We remove it."
a=$(echo "$Installed" | xargs rm)
fi
if [ -f Brewfile ]; then
if [ -f $chemin/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 $chemin -name 'Brewfile_*' -maxdepth 1 -print0 | xargs rm
d=$(date -r $chemin/Brewfile "+%d-%m-%Y_%H:%M:%S")
mv Brewfile "Brewfile_$mac@$d"
mv "$chemin/Brewfile" "$chemin/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 ''
} >> $chemin/Installed.md
echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list"
echo '### Tap:' >> Installed.md
echo '### Tap:' >> $chemin/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 ''
} >> $chemin/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 '### Packages:' >> $chemin/Installed.md
brew=$(brew list --formula)
{
echo "\`\`\`bash"
echo "$brew"
echo "\`\`\`"
echo ""
echo ''
} >> $chemin/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 '### Casks:' >> $chemin/Installed.md
cask=$(brew list --cask)
{
echo "\`\`\`bash"
echo "$cask"
echo "\`\`\`"
echo ""
echo ''
} >> $chemin/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 '' >> Installed.md
echo '## 🍏 mas (Mac App Store)' >> $chemin/Installed.md
echo '' >> $chemin/Installed.md
appfrommas=$(mas list)
appfrommas=$(mas list | sort -k2)
#echo "$appfrommas"
#declare -a appstore
echo "\`\`\`bash" >> Installed.md
echo "\`\`\`bash" >> $chemin/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')
echo "$name ($number)" >> Installed.md
#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)" >> $chemin/Installed.md
#echo " " >> Installed.md
#appstore["$name"]="${number}"
done <<< "$appfrommas"
echo "\`\`\`" >> Installed.md
echo "" >> Installed.md
{
echo "\`\`\`"
echo ""
echo ''
} >> $chemin/Installed.md
# Extensions PHP PECL
echo -e "🐘 Get PECL \033[3m\033[93mPHP extensions\033[0m list"
echo '## PECL extensions' >> Installed.md
echo '' >> Installed.md
echo '## 🐘 PECL extensions' >> $chemin/Installed.md
echo '' >> $chemin/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 ''
} >> $chemin/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 '' >> Installed.md
echo '## 🐍 Python packages' >> $chemin/Installed.md
echo '' >> $chemin/Installed.md
pip_packages=$($pip_version list | sed '1,2d' | awk '{print $1}')
{
echo "\`\`\`bash"
echo "$pip_packages"
echo "\`\`\`"
echo ""
echo ''
} >> $chemin/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 ''
} >> $chemin/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 "\`\`\`"
} >> $chemin/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
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 ''
@@ -193,6 +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 ''
mv Installed.md "$filename".md
mv Brewfile "$chemin/Brewfile"
open "$filename".md
#iconv -f macroman -t utf-8 Installed.md > Installed-utf8.md
#mv Installed-utf8.md "$filename".md
#rm Installed.md
mv $chemin/Installed.md "$chemin/$filename".md
open "$chemin/$filename".md

View File

@@ -3,14 +3,24 @@
# Mac Appstore plugin for KYMSU
# https://github.com/welcoMattic/kymsu
echo -e "\033[1m🍏 Mac App Store updates come fast as lightning \033[0m"
# No distract mode (no user interaction)
no_distract=false
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
if [[ $1 == "--nodistract" ]]; then
no_distract=true
fi
italic="\033[3m"
underline="\033[4m"
ita_under="\033[3;4m"
bold="\033[1m"
bold_under="\033[1;4m"
redbox="\033[1;41m"
redbold="\033[1;31m"
red="\033[31m"
yellow="\033[33m"
reset="\033[0m"
echo -e "${bold}🍏 Mac App Store updates come fast as lightning ${reset}"
echo -e "https://github.com/mas-cli/mas"
# On teste si mas est installé
if hash mas 2>/dev/null; then
@@ -19,16 +29,15 @@ if hash mas 2>/dev/null; then
echo ""
echo "$massy"
#if [ -n "$massy" ]; then
if [ ! -z "$(mas outdated)" ]; then
echo -e "\033[4mAvailables updates:\033[0m"
if [ -n "$(mas outdated)" ]; then
echo -e "${underline}Availables updates:${reset}"
echo "$massy" | cut -d " " -f2-5
echo ""
if [ "$no_distract" = false ]; then
a=$(echo -e "Do you wanna run \033[1mmas upgrade\033[0m ? (y/n)")
read -p "$a" choice
a=$(echo -e "Do you wanna run \033[1mmas upgrade${reset} ? (y/n)")
read -pr "$a" choice
case "$choice" in
y|Y|o ) mas upgrade;;
n|N ) echo "Ok, let's continue";;
@@ -40,10 +49,10 @@ if hash mas 2>/dev/null; then
fi
else
echo -e "\033[4mNo availables mas updates.\033[0m"
echo -e "${italic}No availables mas updates.${reset}"
fi
else
echo "Please install mas: brew install mas"
echo -e "Please install mas: ${italic}brew install mas${reset}"
fi
echo ""

251
plugins.d/node.sh Executable file
View File

@@ -0,0 +1,251 @@
#!/usr/bin/env bash
# npm plugin for KYMSU (install local package)
# https://github.com/welcoMattic/kymsu
#########################################
#
# Settings:
# Display info on updated pakages / casks
display_info=true
# No distract mode (no user interaction)
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
# Set ls_color to '' for output nvm list in default colors, else '--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
doctor=true
# Local install
local_path=$HOME/Sites/node_modules/
#########################################
: <<'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"
bold_ita="\033[1;3m"
box="\033[1;41m"
reset="\033[0m"
upd_nvm() {(
cd "$NVM_DIR"
git fetch --tags origin
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"
}
echo -e "${bold}🌿 npm ${reset}"
echo ""
# version courante de node.js
node_v=$(node -v)
node_ins=$(which node)
echo -e "${underline}🌿 node.js:${reset}"
echo -e " - current version: ${italic}$node_v${reset}"
echo -e " - install path: ${italic}$node_ins${reset}"
# version courante de npm
npm_v=$(npm -v)
npm_ins=$(which npm)
echo -e "\n${underline}🌿 npm:${reset}"
echo -e " - current version: ${italic}$npm_v${reset}"
echo -e " - install path: ${italic}$npm_ins${reset}"
# 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//')
# nvm from github
if [ -f "$NVM_DIR/nvm.sh" ]; then
source $NVM_DIR/nvm.sh
# version courante de nvm
nvm_v=$(nvm --version)
echo -e "\n${underline}🌿 nvm install is:${reset} $NVM_DIR/nvm.sh"
echo " - nvm $nvm_v is installed from https://github.com/nvm-sh/nvm"
if [ "$nvm_v" != "$version_nvm" ]; then
echo "Current nvm version on GitHub: $version_nvm"
echo "Current nvm installed version: $nvm_v"
read -p "Do you want to update nvm from GitHub repo? (y/n)" choice
if [ "$choice" == "y" ]; then
echo "Updating nvm from GitHub..."
#curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v"$version_nvm"/install.sh | bash
upd_nvm
#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 "\n${underline}🌿 node.js${reset} (installed versions): \n$node_install"
# nvm from homebrew
elif [ -f "/usr/local/opt/nvm/nvm.sh" ]; then
source $(brew --prefix nvm)/nvm.sh
# version courante de nvm
nvm_v=$(nvm --version)
echo -e "\n${underline}🌿 nvm install is:${reset} /usr/local/opt/nvm/nvm.sh"
echo "nvm $nvm_v is installed from homebrew"
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.${reset}"
fi
node_install=$(nvm list "$ls_color")
echo -e "\n${underline}🌿 node.js${reset} (installed versions): \n$node_install"
fi
echo -e "${italic}Note:"
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.${reset}"
echo ""
##################
# Local packages #
##################
if [ -d "$local_path" ]; then
cd "$local_path" || return
echo -e "${underline}🌿 Local installed scripts:${reset}"
if [ "$display_info" = true ]; then
ll=$(npm ls --long | grep -v 'git$')
while IFS= read -r line
do
if [[ "${line}" =~ "──" ]] || [[ "${line}" =~ "─┬" ]]; then
echo -e "${bold}${line}${reset}"
else
echo -e "${line}"
fi
done <<< "$ll"
else
npm ls
fi
echo -e "\n${underline}🌿 Search for local packages update...${reset}\n"
outdated=$(npm outdated)
if [ -n "$outdated" ]; then
echo -e "\n${underline}🌿 Updating local packages...${reset}\n"
if [ "$no_distract" = false ]; then
#echo "$outdated"
echo "$outdated" | awk '{print $1}' | xargs -p -n 1 npm update
else
#echo "$outdated"
echo "$outdated" | awk '{print $1}' | xargs -n 1 npm update
fi
else
echo -e "${italic}No local packages updates.${reset}"
fi
fi
echo ""
###################
# Global packages #
###################
echo -e "${underline}🌿 Global installed scripts:${reset}"
if [ "$display_info" = true ]; then
lg=$(npm list -g --depth=0 --long | grep -v 'git$')
while IFS= read -r line
do
if [[ "${line}" =~ "──" ]]; then
echo -e "${bold}${line}${reset}"
else
echo -e "${line}"
fi
done <<< "$lg"
else
npm list -g --depth=0
fi
#Packages update
echo -e "\n${underline}🌿 Search for global packages update...${reset}\n"
glong_outdated=$(npm outdated -g --long | sed '1d')
if [ -n "$glong_outdated" ]; then
echo -e "$glong_outdated\n"
echo -e "\n${underline}🌿 Updating global packages...${reset}\n"
while IFS= read -r line
do
pkg=$(echo "$line" | awk '{print $1}')
vers=$(echo "$line" | awk '{print $4}')
outdated="$pkg@$vers"
# TEST
version=$(echo "$line" | awk '{print $1 "@" $4}')
echo "$version"
# /test
if [ "$no_distract" = false ]; then
echo "$outdated" | xargs -p -n 1 npm -g install
echo ""
else
echo "$outdated" | xargs -n 1 npm -g install
echo ""
fi
done <<< "$glong_outdated"
else
echo -e "${italic}No global packages updates.${reset}"
fi
echo ""
###############
# Maintenance #
###############
if [ "$doctor" = true ]; then
echo -e "${underline}🌿 The Doc is checking that everything is ok.${reset}\n"
npm doctor
echo ""
echo -e "🔍 Verifying npm cache\n"
npm cache verify
echo ""
fi
echo ""

View File

@@ -1,148 +0,0 @@
#!/usr/bin/env bash
# npm plugin for KYMSU (install local package)
# https://github.com/welcoMattic/kymsu
# Fixing npm On Mac OS X for Homebrew Users
# https://gist.github.com/rcugut/c7abd2a425bb65da3c61d8341cd4b02d
# https://gist.github.com/DanHerbert/9520689
# brew install node
# node -v => 9.11.1
# npm -v => 5.6.0
# npm install -g npm
# npm -v => 5.8.0
# https://github.com/npm/npm/issues/17744
#########################################
#
# Settings:
# No distract mode (no user interaction)
no_distract=false
if [[ $1 == "--nodistract" ]]; then
no_distract=true
fi
# Set doctor=true to run 'npm doctor' and 'npm cache verify' each time
doctor=true
# Local install
local_path=$HOME/Sites/node_modules/
#########################################
echo -e "\033[1m🌿 npm \033[0m"
echo ""
# version courante de node.js
node_v=$(node -v)
echo -e "\033[4m🌿 node.js\033[0m (current version): $node_v"
# version courante de npm
npm_v=$(npm -v)
echo -e "\033[4m🌿 npm\033[0m (current version): $npm_v"
# versions installées de node.js
nvm_installed=$(brew info nvm | grep Cellar)
if [ -f "$NVM_DIR/nvm.sh" ]; then
source $NVM_DIR/nvm.sh
# version courante de nvm
nvm_v=$(nvm --version)
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)
echo -e "\033[4m🌿 node.js\033[0m (installed versions): \n$node_install"
elif [ -f "/usr/local/opt/nvm/nvm.sh" ]; then
source $(brew --prefix nvm)/nvm.sh
# version courante de nvm
nvm_v=$(nvm --version)
echo -e "\033[4m🌿 nvm install is:\033[0m /usr/local/opt/nvm/nvm.sh"
echo "nvm $nvm_v is installed from homebrew"
node_install=$(nvm list)
echo -e "\033[4m🌿 node.js\033[0m (installed versions): \n$node_install"
fi
echo
# Local packages
if [ -d "$local_path" ]; then
cd $local_path
echo -e "\033[4m🌿 Local installed scripts:\033[0m"
npm ls
outdated=$(npm outdated)
if [ -n "$outdated" ]; then
echo "$outdated"
echo "$outdated" | awk '{print $1}' | xargs npm update
else
echo -e "\033[4mNo local packages updates.\033[0m"
fi
fi
echo ""
# Global packages
echo -e "\033[4m🌿 Global installed scripts:\033[0m"
npm list -g --depth=0
g_outdated=$(npm outdated -g)
# => 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
# /usr/local/lib/node_modules/npm/lib/outdated.js
# 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
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
fi
else
echo -e "\033[4mNo global packages updates.\033[0m"
fi
echo ""
# Maintenance
if [ "$doctor" = true ]; then
echo "🌿 The Doc is checking that everything is ok."
npm doctor
echo ""
echo "🔍 Verifying npm cache"
npm cache verify
echo ""
fi
#if [[ $1 == "--npm_cleanup" ]]; then
if [[ $1 == "--cleanup" ]]; then
echo "npm cache clean"
# As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid.
# If you want to make sure everything is consistent, use 'npm cache verify' instead.
# On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
# If you're sure you want to delete the entire cache, rerun this command with --force.
if printf '%s\n%s\n' "$(npm --version)" 5.0.0 | sort --version-sort --check=silent; then
echo "🌿 Cleaning npm cache"
npm cache clean
fi
echo ""
fi
echo ""

View File

@@ -10,26 +10,62 @@
# Settings:
# No distract mode (no user interaction)
no_distract=false
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
#
#########################################
if [[ $1 == "--nodistract" ]]; then
no_distract=true
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() {
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
}
echo -e "${bold}🐘 pecl ${reset}"
echo ""
echo -e "${bold}❗️ plugin en test (beta) ${reset}"
echo ""
# /usr/local/Cellar/php/7.4.11/bin/pecl
# /usr/local/Cellar/php@7.3/7.3.23/bin/pecl
# /usr/local/Cellar/php@7.2/7.2.33/bin/pecl
#pecl_upgrade=$(pecl list-upgrades)
version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}')
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
echo -e "\033[1m🐘 pecl \033[0m"
pecl_upgrade=$($php_path/pecl list-upgrades)
echo ""
echo -e "\033[1m❗ plugin en test (beta) \033[0m"
echo ""
pecl_upgrade=$(pecl list-upgrades)
if [ -n "$pecl_upgrade" ]; then
echo -e "\033[4mExtensions update:\033[0m"
echo -e "${underline}Extensions update:${reset}"
echo ""
echo "$pecl_upgrade"
@@ -40,33 +76,62 @@ 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
#pecl channel-update pear.php.net
$php_path/pecl channel-update pear.php.net
fi
# Channel pecl.php.net
b=$(echo "$ligne" | grep "pecl")
if [ -n "$b" ]; then
#pecl channel-update pecl.php.net
$php_path/pecl channel-update pecl.php.net
#(pecl or doc) update available
b=$(echo "$ligne" | awk '{print $2}')
pecl info "$b"
#pecl info "$b"
$php_path/pecl info "$b"
echo ""
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
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
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 "${red}❗️ $notif2${reset}"
notification "$notif2"
echo ""
a=$(echo -e "Do you want to edit ${bold}$conf_php${reset} file ? (y/n)")
read -p "$a" choice
if [ "$choice" == "y" ]; then
$EDITOR "$conf_php"
fi
fi
echo ""
echo ""

72
plugins.d/perl.sh Executable file
View 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
View 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

View File

@@ -3,116 +3,169 @@
# pip plugin for KYMSU
# https://github.com/welcoMattic/kymsu
# upgrade pip:
# python -m pip install --upgrade pip
# Configurer pip3:
# pip config edit
#########################################
#
# Settings:
# Display info on updated pakages / casks
#[[ $@ =~ "--info" ]] && display_info=false || display_info=true
display_info=true
# No distract mode (no user interaction)
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
# Display dependancies on updated pakages / casks
#[[ $@ =~ "--depend" ]] && display_depend=false || display_depend=true
display_depend=true
#version: pip ou pip3
version=pip3
# pip: python3.8 - pip3: python3.9
pip_version=pip3
#user: "" or "--user"
user=""
# No distract mode
no_distract=false
#add module to do_not_update array
declare -a do_not_update=()
# Add module to the do_not_update array for prevent to update.
#declare -a do_not_update=()
#declare -a do_not_update=("parso" "asgiref")
declare -a do_not_update=("asgiref")
#
#########################################
if [[ $1 == "--nodistract" ]]; then
no_distract=true
fi
: <<'END_COMMENT'
blabla
END_COMMENT
if ! [ -x "$(command -v $version)" ]; then
echo "Error: $version is not installed." >&2
exit 1
fi
italic="\033[3m"
underline="\033[4m"
ita_under="\033[3;4m"
bold="\033[1m"
bold_under="\033[1;4m"
redbox="\033[1;41m"
redbold="\033[1;31m"
red="\033[31m"
yellow="\033[33m"
reset="\033[0m"
echo -e "\033[1m🐍 $version (Python 3) \033[0m"
command -v pipdeptree >/dev/null 2>&1 || { echo -e "You shoud intall ${bold}pipdeptree${reset} for checking packages dependancies ${italic}($pip_version install pipdeptree)${reset}.\n"; }
command -v $pip_version >/dev/null 2>&1 || { echo -e "${bold}$pip_version${reset} is not installed." && exit 1; }
echo -e "${bold}🐍 $pip_version (Python 3) ${reset}"
echo ""
$version install --upgrade pip
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 > /dev/null
echo ""
pip_outdated=$($version list --outdated --format columns)
# Do not update casks
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 -e "To remove package from this list, you need to edit the ${italic}do_not_update${reset} array."
echo ""
fi
#Packages update
echo -e "🐍 ${underline}Search for packages update...${reset}\n"
pip_outdated=$($pip_version list --outdated --format columns)
upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}')
#upd="asgiref CairoSVG setuptools"
# Find infos about updated packages
if [ -n "$upd" ]; then
echo -e "\033[4mAvailables updates:\033[0m"
#echo $pip3_outdated_freeze | tr [:space:] '\n'
echo "$pip_outdated"
nb=$(echo "$upd" | wc -w | xargs)
echo -e "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
echo -e "\n$pip_outdated"
echo ""
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)
echo "$info" | head -4
echo ''
#echo "$i"
done
do
info=$($pip_version show "$i")
if [ -x "$(command -v pipdeptree)" ]; then
echo -e "\033[4mCheck dependancies:\033[0m"
echo "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version."
fi
echo ""
for i in $upd
do
if [ -x "$(command -v pipdeptree)" ]; then
dependencies=$(echo "$i" | xargs pipdeptree -r -p | grep "$upd")
l=$(echo "$info" | sed -n '1p')
m=$(sed "1s/.*/\\${bold}$l\\${reset}/" <<< "$info")
echo -e "$m" | head -4
echo ""
z=0
while read -r line; do
if [[ $line = *"<"* ]]; then
echo -e "\033[31m$line\033[0m"
else
if [ "$z" -eq 0 ]; then
echo -e "\033[3m$line\033[0m"
else
echo "$line"
fi
z=$((z+1))
fi
done <<< "$dependencies"
z+="$i "
done
# Check dependancies
if [ -x "$(command -v pipdeptree)" ] && [ "$display_depend" == true ]; then
echo -e "🐍 ${underline}Check dependancies:${reset}\n"
echo -e "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version.\n"
z=$(echo "$z" | sed 's/.$//' | sed 's/ /,/g')
dependencies=$(echo "$z" | xargs pipdeptree -r -p )
while IFS= read -r line; do
z=$(echo "${line}" | grep -i ^[a-z])
if [ -n "$z" ] ; then
echo -e "\n${bold}${line}${reset}"
elif [[ "${line}" = *"<"* ]]; then
echo -e "${red}${line}${reset}"
elif [[ "${line}" = *"~="* ]]; then
echo -e "${yellow}${line}${reset}"
else
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
read -p "$c" choice
case "$choice" in
y|Y|o ) $version install $user pipdeptree ;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
echo "${line}"
fi
done <<< "$dependencies"
# If the update is not in the do_not_update array, we install it.
fi
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)")
# Updating packages
echo -e "\n🐍 ${underline}Updating packages...${reset}\n"
[ "${#do_not_update[@]}" -gt 0 ] && echo -e "${redbold}Do not update: ${underline}${do_not_update[@]}${reset}${redbold} . It won't be updated!'${reset}\n"
for i in $upd
do
if [[ ! " ${do_not_update[@]} " =~ " ${i} " ]]; then
if [ "$no_distract" = false ]; then
b=$(echo -e "Do you wanna run ${bold}$pip_version install $user --upgrade $i${reset} ? (y/n)")
read -p "$b" choice
case "$choice" in
y|Y|o ) echo $i | xargs $version install $user --upgrade ;;
n|N ) echo "Ok, let's continue";;
y|Y|o ) echo "$i" | xargs $pip_version install $user --upgrade ;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
echo ""
elif [ "${FOUND}" = "" ]; then
echo $i | xargs $version install $user --upgrade
else
echo "$i" | xargs $pip_version install $user --upgrade
fi
done
fi
done
else
echo -e "\033[4mNo availables updates.\033[0m"
echo -e "${underline}No availables updates.${reset}"
fi
echo ""
echo -e "🐍 ${underline}Running ${reset}${bold_under}pip check${reset}${underline} for checking that everything is ok...${reset}\n"
$pip_version check
echo ""
echo ""

BIN
plugins.d/success.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB