Compare commits
56 Commits
v2.0b
...
2bb6671836
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bb6671836 | |||
| ea87685dde | |||
| ce8d9b799e | |||
| 2124781520 | |||
| dc4764c832 | |||
| 40040c264b | |||
| b76e72a1ef | |||
| c8ced14004 | |||
| 6ee801d946 | |||
| feab0bb267 | |||
| 02ed39943b | |||
| bcd4ca41c6 | |||
| d13e3277b1 | |||
| de82e3f6a3 | |||
| db3ef113ad | |||
| cefbd6d1e9 | |||
| bebcacecc3 | |||
| ace96fcd46 | |||
| b744cd6624 | |||
| 97a1005d12 | |||
| afa77f865c | |||
| a4e9ed9053 | |||
| e8fc598082 | |||
| 61cdb0e44b | |||
| f99b2c3107 | |||
| c2e950d819 | |||
|
21501ed2ce
|
|||
|
36d7f88ffc
|
|||
|
9fc8f9668f
|
|||
|
6d98e2043e
|
|||
|
9177cea743
|
|||
|
3595de3c64
|
|||
|
24f829d102
|
|||
|
f1412739df
|
|||
|
d2f5735073
|
|||
|
555c362e30
|
|||
|
32b861a8f1
|
|||
|
a8ec0b2e37
|
|||
|
4a1ea52926
|
|||
|
f1a1a94886
|
|||
|
7b78bbd1ca
|
|||
|
e6c7db1711
|
|||
|
9a9bf77fb7
|
|||
|
a32a0d6ded
|
|||
|
9d8b924a30
|
|||
|
a5c0c2b011
|
|||
|
1061909d5b
|
|||
|
02648b8f83
|
|||
|
e97ae7ec2c
|
|||
|
064ae0ecf0
|
|||
|
cb0a07339d
|
|||
|
560bb5e13b
|
|||
|
64264174b4
|
|||
|
6b4dfb2abb
|
|||
|
1d2a6b5e3b
|
|||
|
f337e0c62b
|
35
README.md
35
README.md
@@ -10,28 +10,33 @@ homebrew and pecl plugins notifie you if apache/php configuration files have bee
|
|||||||
|
|
||||||
## Plug-ins:
|
## Plug-ins:
|
||||||
|
|
||||||
- **atom** (plug-ins)
|
- **atom** ([plug-ins](https://atom.io/packages/list))
|
||||||
- **antibody** (zsh plug-ins)
|
- **antibody** ([zsh plug-ins](https://getantibody.github.io))
|
||||||
- **homebrew** (brew and cask)
|
- **gem** ([Ruby](https://rubygems.org))
|
||||||
|
- **homebrew** ([brew and cask](https://formulae.brew.sh))
|
||||||
- **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) (can update nvm script)
|
- **nodejs** ([npm package](https://www.npmjs.com)) (local or global packages) (can update [nvm](https://github.com/nvm-sh/nvm) script)
|
||||||
- **mas** (Mac Appstore)
|
- **mas** (Mac Appstore)
|
||||||
- **pip** (Python Package index) (pip or pip3)
|
- **pecl** ([PHP modules](https://pecl.php.net)) (<u>for testing only</u>)
|
||||||
- **PECL** (PHP modules)
|
- **perl** (Perl modules ([cpan](https://metacpan.org)))
|
||||||
- **Wordpress** (wp-cli) <u>(for testing only)</u>
|
- **pip** ([Python Package index](https://pypi.org)) (pip or pip3)
|
||||||
|
- **pipx** ([Python Apps in Isolated Environments](https://pypa.github.io/pipx/))
|
||||||
|
- **rust** ([Rust](https://www.rust-lang.org))
|
||||||
|
- **venv** ([Environnement virtuel Python](https://docs.python.org/3/library/venv.html))
|
||||||
|
- **wp** (WordPress [wp-cli](https://wp-cli.org/fr/)) <u>(for testing only)</u>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- [Homebrew](https://brew.sh/)
|
- [Homebrew](https://brew.sh/)
|
||||||
|
- [jq](https://github.com/stedolan/jq) *(brew install jq)* for processing JSON data (homebrew plugin)
|
||||||
|
|
||||||
Optionnal:
|
Optionnal:
|
||||||
|
|
||||||
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) *(pip install pipdeptree)* for checking dependancies (pip plugin)
|
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) *(pip install pipdeptree)* for checking dependancies (pip plugin)
|
||||||
- [jq](https://github.com/stedolan/jq) *(brew install jq)* for processing JSON data (homebrew plugin)
|
|
||||||
- [terminal-notifier](https://github.com/julienXX/terminal-notifier) *(brew install terminal-notifier)* for sending macOS notification (all plugins)
|
- [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)
|
- ~~[Bash 5](https://www.gnu.org/software/bash/) *(brew install bash)* for associative array (homebrew plugin)~~ (homebrew plugin 2.0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -49,9 +54,13 @@ Plug-ins are placed in `~/.kymsu/`
|
|||||||
|
|
||||||
Only update all the things: `$ kymsu2`
|
Only update all the things: `$ kymsu2`
|
||||||
|
|
||||||
|
Run only 1 script: `$ kymsu2 -s homebrew` (option -s and name of script without extension)
|
||||||
|
|
||||||
With cleanup after updates: `$ kymsu2 --cleanup`
|
With cleanup after updates: `$ kymsu2 --cleanup`
|
||||||
|
|
||||||
No distract mode (no user interaction):`$ kymsu2 --nodistract`
|
No distract mode (no user interaction):`$ kymsu2 --nodistract` `$ kymsu2 -n` (update without confirmation)
|
||||||
|
|
||||||
|
Help: `$ kymsu2 --help` `$ kymsu2 -h`
|
||||||
|
|
||||||
Prefix plugin with a _ to ignore it:
|
Prefix plugin with a _ to ignore it:
|
||||||
|
|
||||||
@@ -69,7 +78,7 @@ Prefix plugin with a _ to ignore it:
|
|||||||
|
|
||||||
There is a <u>settings section</u> on top of each plug-in:
|
There is a <u>settings section</u> on top of each plug-in:
|
||||||
|
|
||||||
- *[homebrew-pip]* don't update a module, package...: add it to the `do_not_update` array on the top.
|
- *[homebrew-pip-nodejs]* don't update a module, package...: add it to the `do_not_update` array on the top.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ nano homebrew.sh
|
$ nano homebrew.sh
|
||||||
@@ -77,9 +86,9 @@ declare -a do_not_update=('virtualbox,virtualbox-extension-pack')
|
|||||||
```
|
```
|
||||||
|
|
||||||
- *[homebrew]* display info on updated pakages: `display_info=true`
|
- *[homebrew]* display info on updated pakages: `display_info=true`
|
||||||
- *[homebrew-npm-pecl-pip]* no distract mode (no user interaction): `no_distract=false`
|
- *[homebrew-nodejs-pecl-pip]* no distract mode (no user interaction): `no_distract=false`
|
||||||
*If running Homebrew plug-in in no_distract mode, Casks with 'latest' version number won't be updated.*
|
*If running Homebrew plug-in in no_distract mode, Casks with 'latest' version number won't be updated.*
|
||||||
- *[npm]* run npm maintenance tools: `doctor=true`
|
- *[nodejs]* run npm maintenance tools: `doctor=true`
|
||||||
- *[pip]* `version=pip or pip3` `user="" or "--user"`
|
- *[pip]* `version=pip or pip3` `user="" or "--user"`
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ 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} ..."
|
echo -e "\nInstalling ${bold}kymsu2${reset} in ${bold}/usr/local/bin${reset} ..."
|
||||||
ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
|
sudo ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
|
||||||
|
|
||||||
# Store Kymsu stuff in home directory
|
# Store Kymsu stuff in home directory
|
||||||
mkdir -p $HOME/.kymsu && echo "${KYMSU_PATH}" > $HOME/.kymsu/path
|
mkdir -p $HOME/.kymsu && echo "${KYMSU_PATH}" > $HOME/.kymsu/path
|
||||||
|
|||||||
104
kymsu2.sh
104
kymsu2.sh
@@ -1,6 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
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"
|
||||||
|
|
||||||
|
function showHelp() {
|
||||||
echo -e "\033[93m\033[1maltKymsu\033[0m"
|
echo -e "\033[93m\033[1maltKymsu\033[0m"
|
||||||
echo ""
|
echo ""
|
||||||
echo "alt Keep Your macOs Stuff Updated"
|
echo "alt Keep Your macOs Stuff Updated"
|
||||||
@@ -10,32 +20,88 @@ if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
|||||||
echo
|
echo
|
||||||
echo "Commandes: "
|
echo "Commandes: "
|
||||||
echo " -h, --help display this help"
|
echo " -h, --help display this help"
|
||||||
echo " --nodistract no distract mode (no user interaction)"
|
echo " -n, --nodistract no distract mode (no user interaction)"
|
||||||
echo " --cleanup removing any older versions of installed formulae and clearing old downloads from the Homebrew download-cache"
|
echo " -c, --cleanup removing any older versions of installed formulae and clearing old downloads from the Homebrew download-cache"
|
||||||
echo " --npm_cleanup cleaning npm cache"
|
#echo " --npm_cleanup cleaning npm cache"
|
||||||
|
echo " -s $script run only the script given in argument"
|
||||||
|
echo " -a, --all run all scripts (by default, all except those start by _)"
|
||||||
echo
|
echo
|
||||||
echo "Tips:"
|
echo "Tips:"
|
||||||
echo " -prefix the plugin with _ to ignore it"
|
echo " -prefix the plugin with _ to ignore it"
|
||||||
echo " -see Settings section on top of each plug-in"
|
echo " -see Settings section on top of each plug-in"
|
||||||
echo
|
echo
|
||||||
exit 0
|
# exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
all_plugins=false
|
||||||
|
no_distract=false
|
||||||
|
brew_cleanup=false
|
||||||
|
SCRIPTS_DIR=$HOME/.kymsu/plugins.d
|
||||||
|
|
||||||
|
while getopts "hncs: a-:" opt
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
|
-) case "${OPTARG}" in
|
||||||
|
help) showHelp; exit;;
|
||||||
|
nodistract) no_distract=true;;
|
||||||
|
cleanup) brew_cleanup=true;;
|
||||||
|
all) all_plugins=true;;
|
||||||
|
*)
|
||||||
|
echo "Unknow option '--${OPTARG}'" >&2
|
||||||
|
exit -1;;
|
||||||
|
esac;;
|
||||||
|
h) showHelp; exit;;
|
||||||
|
n) no_distract=true;;
|
||||||
|
c) brew_cleanup=true;;
|
||||||
|
s) one_script="${OPTARG}";;
|
||||||
|
a) all_plugins=true;;
|
||||||
|
*)
|
||||||
|
echo "Unknow option '-$opt'" >&2
|
||||||
|
exit -1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
#shift "$((OPTIND-1))"
|
||||||
|
|
||||||
|
|
||||||
|
# -n : non vide
|
||||||
|
if [ -n "$one_script" ]; then
|
||||||
|
# Un seul script
|
||||||
|
#list_plugins=$(find $SCRIPTS_DIR -maxdepth 1 -type f -name "*$one_script" -a -perm +111)
|
||||||
|
list_plugins=$(find $SCRIPTS_DIR -maxdepth 1 -type f -name "$one_script" -o -name "_$one_script" -a -perm +111)
|
||||||
|
[ -z "$list_plugins" ] && echo -e "❗️ No named plugin ${italic}$one_script${reset}" && exit -1
|
||||||
|
|
||||||
|
# [[ $@ =~ "--all" ]] && all_plugins=true || all_plugins=false
|
||||||
|
elif [ "$all_plugins" = false ]; then
|
||||||
|
# Tous sauf commençant par _ (les fichiers commençant par '_' ne sont pas pris en compte) "_*.sh"
|
||||||
|
list_plugins=$(find $SCRIPTS_DIR -maxdepth 1 -type f ! -name "_*" -a -name "*.sh" -a -perm +111 | sort)
|
||||||
|
[ -z "$list_plugins" ] && echo -e "❗️ No plugin in ${italic}$SCRIPTS_DIR${reset}" && exit -1
|
||||||
|
else
|
||||||
|
# Tous (-a = ET; -perm +111 = exec)
|
||||||
|
list_plugins=$(find $SCRIPTS_DIR -maxdepth 1 -type f -name "*.sh" -a -perm +111 | sort)
|
||||||
|
[ -z "$list_plugins" ] && echo -e "❗️ No plugin in ${italic}$SCRIPTS_DIR${reset}" && exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Please, grab a ☕️, KYMSU keep your working environment up to date!"
|
|
||||||
|
|
||||||
SCRIPTS_DIR=$HOME/.kymsu/plugins.d
|
|
||||||
#SCRIPTS_DIR=$(cat ~/.kymsu/path)/plugins.d
|
|
||||||
|
|
||||||
cd "$SCRIPTS_DIR"
|
cd "$SCRIPTS_DIR"
|
||||||
|
|
||||||
# On boucle sur tous les fichiers du répertoire
|
<<COMMENT
|
||||||
# (seuls les fichiers commençant par '_' ou '0' sont pris en compte)
|
echo "$list_plugins"
|
||||||
#for script in $(find . -name '[_0]*' -maxdepth 1 | sort); do
|
|
||||||
for script in $(find . ! -name _\*.sh -maxdepth 1 | sort); do
|
echo "all args: $@"
|
||||||
# si le fichier est exécutable et n'est pas un dossier
|
echo ""
|
||||||
if [ -x "$SCRIPTS_DIR/$script" ] && [ -f "$SCRIPTS_DIR/$script" ]; then
|
echo "script: $one_script"
|
||||||
# on l’exécute ; le $@ permet de passer à chaque
|
echo ""
|
||||||
# script les arguments passés à *ce* script
|
COMMENT
|
||||||
$SCRIPTS_DIR/$script $@
|
|
||||||
fi
|
|
||||||
|
echo "Please, grab a ☕️, KYMSU keep your working environment up to date!"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
for script in $list_plugins; do
|
||||||
|
# le $@ permet de passer à chaque script les arguments passés à *ce* script
|
||||||
|
$script $@
|
||||||
|
#echo "$script"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
shift "$((OPTIND-1))"
|
||||||
|
|||||||
@@ -1,6 +1,57 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
#PREF_FILE="$SCRIPT_DIR/kymsu.pref"
|
||||||
|
#TEMP_FILE="$SCRIPT_DIR/kymsu.pref.tmp"
|
||||||
|
PREF_FILE="$HOME/.kymsu/plugins.d/kymsu.pref"
|
||||||
|
TEMP_FILE="$HOME/.kymsu/plugins.d/kymsu.pref.tmp"
|
||||||
|
|
||||||
|
# 5m 5 minutes
|
||||||
|
# 2h 2 hours
|
||||||
|
# 4d 4 days
|
||||||
|
# 3w 3 weeks
|
||||||
|
# 1M 1 month
|
||||||
|
# 1Y 1 year
|
||||||
|
|
||||||
|
update_interval="1w"
|
||||||
|
x=${update_interval: -1}
|
||||||
|
case $x in
|
||||||
|
m) unite=60;;
|
||||||
|
h) unite=3600;;
|
||||||
|
d) unite=$(( 3600*24 ));;
|
||||||
|
w) unite=$(( 3600*24*7 ));;
|
||||||
|
M) unite=$(( 3600*24*30 ));;
|
||||||
|
Y) unite=$(( 3600*24*30*12 ));;
|
||||||
|
*) echo "Bad update_interval pref" >&2
|
||||||
|
#exit -1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
y=$(( ${#update_interval}-1 ))
|
||||||
|
nb=${update_interval:0:$y}
|
||||||
|
w=$(( unite*nb ))
|
||||||
|
|
||||||
|
if [ -f $PREF_FILE ]; then
|
||||||
|
last_update=$(cat $PREF_FILE | grep "last.update" | awk -F"=" '{print $2}' )
|
||||||
|
else
|
||||||
|
last_update=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
current_timestamp=$(date +"%s")
|
||||||
|
temps=$(( current_timestamp-last_update))
|
||||||
|
|
||||||
|
if [ $(( temps-w)) -gt 0 ]; then
|
||||||
echo "🦄 KYMSU self update"
|
echo "🦄 KYMSU self update"
|
||||||
pushd "$(cat ~/.kymsu/path)" > /dev/null
|
pushd "$(cat ~/.kymsu/path)" > /dev/null
|
||||||
git pull
|
#git pull
|
||||||
|
git pull https://Bruno21@github.com/Bruno21/kymsu.git
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
if [ $last_update -eq 0 ]; then
|
||||||
|
echo "last.update=$current_timestamp" > $PREF_FILE
|
||||||
|
else
|
||||||
|
awk -F'=' -v OFS='=' -v newval="$current_timestamp" '/^last.update/{$2=newval;print;next}1' $PREF_FILE > $TEMP_FILE
|
||||||
|
mv $TEMP_FILE $PREF_FILE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ display_info=true
|
|||||||
# 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=('')
|
declare -a do_not_update=('')
|
||||||
|
|
||||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
# No distract mode (no user interaction)
|
||||||
no_distract=false
|
[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
#
|
#
|
||||||
@@ -26,6 +27,15 @@ no_distract=false
|
|||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
|
|
||||||
|
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"
|
||||||
title="Antibody"
|
title="Antibody"
|
||||||
@@ -42,14 +52,12 @@ notification() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
|
||||||
no_distract=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\033[1m🙏 Antibody \033[0m"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
antibody_folder=$(antibody home)
|
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)
|
update=$(antibody update 2>&1)
|
||||||
|
|
||||||
@@ -57,7 +65,7 @@ installed=$(echo "$update" | grep "updating")
|
|||||||
updated=$(echo "$update" | grep "updated")
|
updated=$(echo "$update" | grep "updated")
|
||||||
|
|
||||||
if [ -n "$installed" ]; then
|
if [ -n "$installed" ]; then
|
||||||
echo -e "\033[4mAntibody modules installed:\033[0m"
|
echo -e "${underline}Antibody modules installed:${reset}"
|
||||||
#echo "$installed"
|
#echo "$installed"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
@@ -66,16 +74,18 @@ if [ -n "$installed" ]; then
|
|||||||
do
|
do
|
||||||
url=$(echo "$i" | awk '{print $3}')
|
url=$(echo "$i" | awk '{print $3}')
|
||||||
module=$(echo "$i" | awk -F "/" '{print $NF}')
|
module=$(echo "$i" | awk -F "/" '{print $NF}')
|
||||||
echo -e "\033[1m$module\033[0m ($url)"
|
echo -e "${bold}$module${reset} ($url)"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Modules are installed in $antibody_folder folder."
|
echo "Modules are installed in $antibody_folder folder."
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo Antibody modules installed.\033[0m"
|
echo -e "${underline}No Antibody modules installed.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
<<COMMENT
|
<<COMMENT
|
||||||
|
antibody update:
|
||||||
|
|
||||||
antibody: updating: https://github.com/zsh-users/zsh-history-substring-search
|
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-completions
|
||||||
antibody: updating: https://github.com/zsh-users/zsh-autosuggestions
|
antibody: updating: https://github.com/zsh-users/zsh-autosuggestions
|
||||||
@@ -88,7 +98,7 @@ COMMENT
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ -n "$updated" ]; then
|
if [ -n "$updated" ]; then
|
||||||
echo -e "\033[4mAntibody modules to update:\033[0m"
|
echo -e "${underline}Antibody modules to update:${reset}"
|
||||||
#echo "$updated"
|
#echo "$updated"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
@@ -98,20 +108,18 @@ if [ -n "$updated" ]; then
|
|||||||
module=$(echo "$j" | awk -F "/" '{print $NF}' | awk '{print $1}')
|
module=$(echo "$j" | awk -F "/" '{print $NF}' | awk '{print $1}')
|
||||||
commit=$(echo "$j" | awk -F "$url" '{print $NF}')
|
commit=$(echo "$j" | awk -F "$url" '{print $NF}')
|
||||||
last_commit=$(echo "$commit" | awk '{print $NF}')
|
last_commit=$(echo "$commit" | awk '{print $NF}')
|
||||||
echo -e "\033[1m$module\033[0m ($url)"
|
echo -e "${bold}$module${reset} ($url)"
|
||||||
echo "Commits: $commit"
|
echo "Commits: $commit"
|
||||||
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"
|
|
||||||
#notification "$notif"
|
|
||||||
modules+="$module "
|
modules+="$module "
|
||||||
done
|
done
|
||||||
notif="$modules has been updated"
|
notif="$modules has been updated"
|
||||||
notification "$notif"
|
notification "$notif"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo Antibody modules to update.\033[0m"
|
echo -e "${underline}No Antibody modules to update.${reset}"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
echo -e "\033[1m⚛️ Atom editor will be shiny when you'll be back from your coffee/tea break! \033[0m"
|
echo -e "\033[1m⚛️ Atom editor will be shiny when you'll be back from your coffee/tea break! \033[0m"
|
||||||
|
|
||||||
|
command -v apm >/dev/null 2>&1 || { echo -e "\n${bold}Atom editor${reset} is not installed.\n\nRun ${italic}'brew install atom'${reset} for install." && exit 1; }
|
||||||
|
|
||||||
if hash apm-beta 2>/dev/null; then
|
if hash apm-beta 2>/dev/null; then
|
||||||
apm-beta upgrade -c false
|
apm-beta upgrade -c false
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -5,13 +5,20 @@
|
|||||||
# https://guides.rubygems.org/what-is-a-gem/
|
# https://guides.rubygems.org/what-is-a-gem/
|
||||||
|
|
||||||
# No distract mode
|
# No distract mode
|
||||||
no_distract=false
|
[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
italic="\033[3m"
|
||||||
no_distract=true
|
underline="\033[4m"
|
||||||
fi
|
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 💍 Gem (Ruby) \033[0m"
|
echo -e "${bold} 💍 Gem (Ruby) ${reset}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -21,7 +28,7 @@ upd=$(echo "$gem_outdated" | awk '{print $1}')
|
|||||||
if [ -n "$upd" ]; then
|
if [ -n "$upd" ]; then
|
||||||
nb=$(echo "$upd" | wc -w | xargs)
|
nb=$(echo "$upd" | wc -w | xargs)
|
||||||
|
|
||||||
echo -e "\\033[1;41m $nb \033[0m \033[4mavailables updates:\033[0m"
|
echo -e "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
|
||||||
echo "$gem_outdated"
|
echo "$gem_outdated"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -38,5 +45,5 @@ if [ -n "$upd" ]; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo gem updates.\033[0m"
|
echo -e "${underline}No gem updates.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,33 +7,35 @@
|
|||||||
#
|
#
|
||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
# Display info on updated pakages
|
# Display info on updated pakages / casks
|
||||||
display_info=true
|
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.
|
|
||||||
# declare -a do_not_update=("xnconvert" "yate")
|
# declare -a do_not_update=("xnconvert" "yate")
|
||||||
declare -a cask_to_not_update=("xld" "webpquicklook")
|
declare -a cask_to_not_update=()
|
||||||
|
|
||||||
# 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
|
#[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
# Some Casks have auto_updates true or version :latest. Homebrew Cask cannot track versions of those apps.
|
# 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' force Homebrew to update those apps.
|
||||||
latest=true
|
latest=false
|
||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
#
|
#
|
||||||
# Recommended software (brew install):
|
# Require software (brew install):
|
||||||
# -jq (Lightweight and flexible command-line JSON processor)
|
# -jq (Lightweight and flexible command-line JSON processor)
|
||||||
|
#
|
||||||
|
# Recommended software (brew install):
|
||||||
# -terminal-notifier (Send macOS User Notifications from the command-line)
|
# -terminal-notifier (Send macOS User Notifications from the command-line)
|
||||||
#
|
#
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
|
|
||||||
: <<'END_COMMENT'
|
: <<'END_COMMENT'
|
||||||
blabla
|
blabla
|
||||||
END_COMMENT
|
END_COMMENT
|
||||||
|
|
||||||
|
|
||||||
italic="\033[3m"
|
italic="\033[3m"
|
||||||
underline="\033[4m"
|
underline="\033[4m"
|
||||||
ita_under="\033[3;4m"
|
ita_under="\033[3;4m"
|
||||||
@@ -43,6 +45,9 @@ bold="\033[1m"
|
|||||||
box="\033[1;41m"
|
box="\033[1;41m"
|
||||||
reset="\033[0m"
|
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() {
|
notification() {
|
||||||
sound="Basso"
|
sound="Basso"
|
||||||
title="Homebrew"
|
title="Homebrew"
|
||||||
@@ -55,21 +60,113 @@ notification() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then no_distract=true; fi
|
get_info_cask() {
|
||||||
if [[ $1 == "--latest" ]]; then latest=true; fi
|
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)' | jq -r '.[]')
|
||||||
|
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"
|
||||||
|
pkg2="$2"
|
||||||
|
l1=""
|
||||||
|
|
||||||
|
#echo "pkg: $pkg"
|
||||||
|
if [[ " ${pkg} " =~ "/" ]]; then
|
||||||
|
pkg=$(echo "$pkg" | awk -F"/" '{print $NF}')
|
||||||
|
fi
|
||||||
|
#echo "pkg: $pkg"
|
||||||
|
|
||||||
|
name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.name)')
|
||||||
|
#name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'")')
|
||||||
|
full_name=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.full_name)')
|
||||||
|
desc=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.desc)')
|
||||||
|
homepage=$(echo "$info" | jq -r '.[] | select(.name == "'${pkg}'") | (.homepage)')
|
||||||
|
|
||||||
|
#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)')
|
||||||
|
#echo -e "installed: $installed\n"
|
||||||
|
|
||||||
|
installed_versions=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg2}'") | (.installed_versions)' | jq -r '.[]')
|
||||||
|
|
||||||
|
current_version=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg2}'") | (.current_version)')
|
||||||
|
#echo -e "installed_versions: $installed_versions\n"
|
||||||
|
#echo "stable: $current_version"
|
||||||
|
|
||||||
|
#echo "name: $name"
|
||||||
|
#echo "desc: $desc"
|
||||||
|
|
||||||
|
# Python@3.9 : multiples versions
|
||||||
|
ins=""
|
||||||
|
for i in $installed_versions
|
||||||
|
do
|
||||||
|
ins=$i
|
||||||
|
done
|
||||||
|
installed=$ins
|
||||||
|
|
||||||
|
if [ "$pinned" = "true" ]; then
|
||||||
|
pinned_v=$(echo "$upd_package" | jq -r '.[] | select(.name == "'${pkg}'") | (.pinned_version)')
|
||||||
|
|
||||||
|
l1+="${red}$name: installed: $installed stable: $current_version [pinned at $pinned_v]"
|
||||||
|
[ "$keg_only" = true ] && l1+=" [keg-only]"
|
||||||
|
l1+="${reset}\n"
|
||||||
|
else
|
||||||
|
l1+="${bold}$name: installed: $installed stable: $current_version"
|
||||||
|
[ "$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 "${bold}🍺 Homebrew ${reset}"
|
||||||
|
|
||||||
echo -e "\n🍺 ${underline}Updating brew...${reset}"
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
#brew update
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n🍺 ${underline}Updating brew...${reset}\n"
|
||||||
|
brew update
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
brew_outdated=$(brew outdated --greedy --json=v2)
|
brew_outdated=$(brew outdated --greedy --json=v2)
|
||||||
|
|
||||||
#echo "\nSearch for brew update...\n"
|
#echo "\nSearch for brew update...\n"
|
||||||
upd_json=$(echo "$brew_outdated")
|
upd_json=$(echo "$brew_outdated")
|
||||||
#echo "$upd_json"
|
|
||||||
|
|
||||||
################
|
################
|
||||||
### Packages ###
|
### Packages ###
|
||||||
@@ -78,7 +175,6 @@ upd_json=$(echo "$brew_outdated")
|
|||||||
# Packages update:
|
# Packages update:
|
||||||
echo -e "\n🍺 ${underline}Search for packages update...${reset}\n"
|
echo -e "\n🍺 ${underline}Search for packages update...${reset}\n"
|
||||||
upd_package=$(echo "$brew_outdated" | jq '{formulae} | .[]')
|
upd_package=$(echo "$brew_outdated" | jq '{formulae} | .[]')
|
||||||
#echo "$upd_package"
|
|
||||||
|
|
||||||
for row in $(jq -c '.[]' <<< "$upd_package");
|
for row in $(jq -c '.[]' <<< "$upd_package");
|
||||||
do
|
do
|
||||||
@@ -86,9 +182,7 @@ do
|
|||||||
installed_versions=$(echo "$row" | jq -j '.installed_versions' | jq -r '.[]')
|
installed_versions=$(echo "$row" | jq -j '.installed_versions' | jq -r '.[]')
|
||||||
current_version=$(echo "$row" | jq -j '.current_version')
|
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')
|
#pinned_version=$(echo "$row" | jq -j '.pinned_version')
|
||||||
|
|
||||||
echo "$name - $installed_versions - $current_version - $pinned - $pinned_version"
|
|
||||||
|
|
||||||
upd_pkgs+="$name "
|
upd_pkgs+="$name "
|
||||||
if [ "$pinned" = true ]; then
|
if [ "$pinned" = true ]; then
|
||||||
@@ -96,14 +190,35 @@ do
|
|||||||
elif [ "$pinned" = false ]; then
|
elif [ "$pinned" = false ]; then
|
||||||
upd_pkg_notpinned+="$name "
|
upd_pkg_notpinned+="$name "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#echo "$upd_pkgs"
|
||||||
upd_pkgs=$(echo "$upd_pkgs" | sed 's/.$//')
|
upd_pkgs=$(echo "$upd_pkgs" | sed 's/.$//')
|
||||||
|
#echo "$upd_pkgs"
|
||||||
upd_pkg_pinned=$(echo "$upd_pkg_pinned" | sed 's/.$//')
|
upd_pkg_pinned=$(echo "$upd_pkg_pinned" | sed 's/.$//')
|
||||||
upd_pkg_notpinned=$(echo "$upd_pkg_notpinned" | 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} | .[]')
|
||||||
|
#echo "$upd_pkgs_info"
|
||||||
|
for row in $upd_pkgs;
|
||||||
|
do
|
||||||
|
#echo "$row"
|
||||||
|
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
|
# Pinned packages
|
||||||
pkg_pinned=$(brew list --formulae --pinned | xargs)
|
pkg_pinned=$(brew list --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)
|
||||||
@@ -119,23 +234,29 @@ fi
|
|||||||
touch /tmp/checkpoint
|
touch /tmp/checkpoint
|
||||||
|
|
||||||
# Updating 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_notpinned" ]; then
|
if [ -n "$upd_pkg_notpinned" ]; then
|
||||||
|
|
||||||
|
echo -e "\n🍺 ${underline}Updating packages...${reset}\n"
|
||||||
|
|
||||||
|
[ -n "$pkg_pinned" ] && echo -e "${red}Pinned: $upd_pkg_pinned . It won't be updated!'${reset}\n"
|
||||||
|
|
||||||
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) ")
|
a=$(echo -e "Do you wanna run ${bold}brew upgrade "$upd_pkg_notpinned"${reset} ? (y/n/a) ")
|
||||||
# yes/no/all
|
# yes/no/all
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
|
|
||||||
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 $upd_pkg_notpinned;
|
||||||
do
|
do
|
||||||
|
if [ "$i" == "bash" ]; then
|
||||||
|
echo -e "\nBash update available !"
|
||||||
|
echo -e "You should run ${bold}brew upgrade bash${reset} in another terminal !\n"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
echo "$i"
|
echo "$i" | xargs -p -n 1 brew upgrade
|
||||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
echo "$i"
|
echo "$i" | xargs -n 1 brew upgrade
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@@ -151,32 +272,32 @@ else
|
|||||||
echo -e "\n${italic}No update package available...${reset}\n"
|
echo -e "\n${italic}No update package available...${reset}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
#############
|
#############
|
||||||
### Casks ###
|
### Casks ###
|
||||||
#############
|
#############
|
||||||
|
|
||||||
#Casks update
|
#Casks update
|
||||||
echo -e "\n🍺 ${underline}Search for casks update...${reset}\n"
|
echo -e "\n🍺 ${underline}Casks...${reset}\n"
|
||||||
upd_cask=$(echo "$brew_outdated" | jq '{casks} | .[]')
|
upd_cask=$(echo "$brew_outdated" | jq '{casks} | .[]')
|
||||||
|
# erreur avec PureVPN et plusieurs versions installées.
|
||||||
|
# parse error: Unfinished string at EOF at line 2, column 0
|
||||||
|
# parse error: Invalid numeric literal at line 1, column 7
|
||||||
|
|
||||||
#echo "$upd_cask"
|
#echo "$upd_cask"
|
||||||
|
|
||||||
#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 "
|
||||||
|
|
||||||
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/.$//')
|
||||||
@@ -188,17 +309,15 @@ if (( ${#cask_to_not_update[@]} )); then
|
|||||||
|
|
||||||
nbp=${#cask_to_not_update[*]}
|
nbp=${#cask_to_not_update[*]}
|
||||||
|
|
||||||
echo -e "\n${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
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 "${red}${cask_to_not_update[*]}${reset}"
|
||||||
echo -e "To remove package from this list, you need to edit the do_not_update array."
|
echo -e "To remove an app from this list, you need to edit the ${italic}do_not_update${reset} array."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
casks_not_pinned=""
|
casks_not_pinned=""
|
||||||
for i in $upd_casks
|
for i in $upd_casks
|
||||||
do
|
do
|
||||||
#echo "$i"
|
|
||||||
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
#echo "$i"
|
|
||||||
casks_not_pinned+="$i "
|
casks_not_pinned+="$i "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -207,9 +326,7 @@ if (( ${#cask_to_not_update[@]} )); then
|
|||||||
casks_latest_not_pinned=""
|
casks_latest_not_pinned=""
|
||||||
for i in $upd_casks_latest
|
for i in $upd_casks_latest
|
||||||
do
|
do
|
||||||
#echo "$i"
|
|
||||||
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
if [[ ! " ${cask_to_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
#echo "$i"
|
|
||||||
casks_latest_not_pinned+="$i "
|
casks_latest_not_pinned+="$i "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -220,9 +337,34 @@ else
|
|||||||
casks_latest_not_pinned=$upd_casks_latest
|
casks_latest_not_pinned=$upd_casks_latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Casks update
|
||||||
|
echo -e "🍺 ${underline}Search for casks update...${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"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
get_info_cask "$upd_casks_info" "$row"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
[ "$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
|
||||||
|
|
||||||
|
|
||||||
# Updating casks
|
# Updating casks
|
||||||
echo -e "\n🍺 ${underline}Updating casks...${reset}\n"
|
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"
|
|
||||||
|
[ "${#cask_to_not_update[@]}" -gt 0 ] && echo -e "${red}Do not update: ${cask_to_not_update[@]} . It won't be updated!'${reset}\n"
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$casks_not_pinned" ]; then
|
if [ -n "$casks_not_pinned" ]; then
|
||||||
|
|
||||||
@@ -232,13 +374,15 @@ if [ -n "$casks_not_pinned" ]; then
|
|||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
|
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
echo ""
|
||||||
for i in $casks_not_pinned;
|
for i in $casks_not_pinned;
|
||||||
do
|
do
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
echo "$i" | xargs -p -n 1 brew upgrade --dry-run
|
# --cask required for Cask like 'docker'. It can be a formula or a cask.
|
||||||
|
echo "$i" | xargs -p -n 1 brew upgrade --cask
|
||||||
echo ""
|
echo ""
|
||||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
echo "$i" | xargs -n 1 brew upgrade --dry-run
|
echo "$i" | xargs -n 1 brew upgrade --cask
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -246,8 +390,8 @@ if [ -n "$casks_not_pinned" ]; then
|
|||||||
echo -e "OK, let's continue..."
|
echo -e "OK, let's continue..."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
#echo "No distract"
|
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --cask
|
||||||
echo "$casks_not_pinned" | xargs -n 1 brew upgrade --dry-run
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -258,22 +402,42 @@ fi
|
|||||||
# Updating casks latest
|
# Updating casks latest
|
||||||
if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then
|
if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then
|
||||||
echo -e "\n🍺 ${underline}Updating casks with 'latest' as version...${reset}\n"
|
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 "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"
|
#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
|
if [ "$no_distract" = false ]; then
|
||||||
q=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_latest_not_pinned${reset} ? (y/n/a) ")
|
q=$(echo -e "Do you wanna run ${bold}brew upgrade $casks_latest_not_pinned${reset} ? (y/n/a) ")
|
||||||
read -p "$q" choice
|
read -p "$q" choice
|
||||||
|
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
echo ""
|
||||||
for i in $casks_latest_not_pinned
|
for i in $casks_latest_not_pinned
|
||||||
do
|
do
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
echo "$i" | xargs -p -n 1 brew upgrade --dry-run
|
echo "$i" | xargs -p -n 1 brew upgrade --cask
|
||||||
echo ""
|
echo ""
|
||||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
echo "$i" | xargs -n 1 brew upgrade --dry-run
|
echo "$i" | xargs -n 1 brew upgrade --cask
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -283,19 +447,67 @@ if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
#echo "No distract"
|
|
||||||
echo -e "Running ${bold}brew upgrade $casks_latest_not_pinned${reset}..."
|
echo -e "Running ${bold}brew upgrade $casks_latest_not_pinned${reset}..."
|
||||||
echo "$casks_latest_not_pinned" | xargs -n 1 brew upgrade --dry-run
|
echo "$casks_latest_not_pinned" | xargs -n 1 brew upgrade
|
||||||
fi
|
fi
|
||||||
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 -maxdepth 1 -name "$name" -mmin -5)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
# Fichier php.ini courant
|
||||||
|
# php -i | grep 'Loaded Configuration File' | awk '{print $NF}'
|
||||||
|
|
||||||
|
php_versions=$(ls $(brew --prefix)/etc/php/ 2>/dev/null)
|
||||||
|
for php in $php_versions
|
||||||
|
do
|
||||||
|
if [ -n "$upd_pkg" ]; then
|
||||||
|
|
||||||
|
# file modified since it was last read
|
||||||
|
php_modified=$(find $(brew --prefix)/etc/php/$php/ -name php.ini -newer /tmp/checkpoint)
|
||||||
|
php_ini=$(brew --prefix)/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 ###
|
### Doctor ###
|
||||||
##############
|
##############
|
||||||
|
|
||||||
echo -e "\n🍺 ${underline}The Doc is checking that everything is ok...${reset}\n"
|
echo -e "\n🍺 ${underline}The Doc is checking that everything is ok...${reset}\n"
|
||||||
|
|
||||||
#brew doctor
|
brew doctor
|
||||||
|
|
||||||
|
echo "python-cryptography required by certbot"
|
||||||
|
echo "python-certifi required by certbot and yt-dlp"
|
||||||
|
echo "numpy required ffmpeg and openvin"
|
||||||
|
# suprimer: python-packaging python-argcomplete
|
||||||
|
|
||||||
brew missing
|
brew missing
|
||||||
status=$?
|
status=$?
|
||||||
|
|||||||
@@ -7,19 +7,21 @@
|
|||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
# npm local install
|
# npm local install
|
||||||
local_path=/Users/bruno/Sites/node_modules/
|
local_path=$HOME/Sites/node_modules/
|
||||||
# folder contains Brewfile and Installer.md
|
# folder contains Brewfile and Installer.md
|
||||||
#chemin=$(pwd)
|
#chemin=$(pwd)
|
||||||
chemin=$HOME/Documents/kymsu
|
chemin=$HOME/Documents/kymsu
|
||||||
#version: pip ou pip3
|
#version: pip ou pip3
|
||||||
pip_version=pip3
|
pip_version=pip3
|
||||||
#
|
#
|
||||||
|
# https://github.com/atom/apm/tags
|
||||||
|
apm=false
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
#if [ ! -d chemin ]; then mkdir $chemin; fi
|
#if [ ! -d chemin ]; then mkdir $chemin; fi
|
||||||
mkdir -p $chemin
|
mkdir -p $chemin
|
||||||
|
|
||||||
now=$(date +"%d-%m-%Y_%T")
|
now=$(date +"%d-%m-%Y_%T" | sed 's/://g')
|
||||||
mac=$(hostname -s)
|
mac=$(hostname -s)
|
||||||
file=$mac"@"$now
|
file=$mac"@"$now
|
||||||
filename="Installed_$file"
|
filename="Installed_$file"
|
||||||
@@ -152,6 +154,7 @@ echo ''
|
|||||||
|
|
||||||
# atom
|
# atom
|
||||||
|
|
||||||
|
if [ "$apm" = "true" ]; then
|
||||||
echo -e "⚛️ Get \033[3m\033[93mAtom editor packages\033[0m installed list"
|
echo -e "⚛️ Get \033[3m\033[93mAtom editor packages\033[0m installed list"
|
||||||
atom=$(apm list | grep 'Community Packages' -A 100 | sed '1,1d')
|
atom=$(apm list | grep 'Community Packages' -A 100 | sed '1,1d')
|
||||||
{
|
{
|
||||||
@@ -169,7 +172,7 @@ echo "\`\`\`"
|
|||||||
echo ""
|
echo ""
|
||||||
echo ''
|
echo ''
|
||||||
} >> $chemin/Installed.md
|
} >> $chemin/Installed.md
|
||||||
|
fi
|
||||||
# Node.js packages (npm)
|
# Node.js packages (npm)
|
||||||
|
|
||||||
echo -e "🌿 Get npm \033[3m\033[93m node global packages\033[0m installed scripts"
|
echo -e "🌿 Get npm \033[3m\033[93m node global packages\033[0m installed scripts"
|
||||||
@@ -235,11 +238,16 @@ echo ''
|
|||||||
echo -e "🍺 Create a \033[3m\033[93mBrewfile\033[0m:"
|
echo -e "🍺 Create a \033[3m\033[93mBrewfile\033[0m:"
|
||||||
echo "list all of the installed brew packages, cask applications, and Mac App Store applications currently on the machine..."
|
echo "list all of the installed brew packages, cask applications, and Mac App Store applications currently on the machine..."
|
||||||
brew bundle dump
|
brew bundle dump
|
||||||
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"
|
mv $chemin/Brewfile "$chemin/Brewfile_$file".md
|
||||||
|
y=$(find . -type f -name 'Brewfile*' -mtime +10 -maxdepth 1)
|
||||||
|
if [ -n "$y" ]; then
|
||||||
|
nb=$(echo "$y" | wc -l)
|
||||||
|
echo "$y" | xargs rm
|
||||||
|
[ $? ] && echo -e "\033[93m$nb Brewfile_*\033[0m files removed !"
|
||||||
|
fi
|
||||||
|
|
||||||
#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
|
||||||
|
|||||||
1
plugins.d/kymsu.pref
Normal file
1
plugins.d/kymsu.pref
Normal file
@@ -0,0 +1 @@
|
|||||||
|
last.update=1658067929
|
||||||
122
plugins.d/mas.sh
122
plugins.d/mas.sh
@@ -3,47 +3,125 @@
|
|||||||
# Mac Appstore plugin for KYMSU
|
# Mac Appstore plugin for KYMSU
|
||||||
# https://github.com/welcoMattic/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 mode (no user interaction)
|
||||||
no_distract=false
|
[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
testing=1
|
||||||
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 ""
|
||||||
|
echo -e "mas : https://github.com/mas-cli/mas"
|
||||||
|
|
||||||
|
command -v mas >/dev/null 2>&1 || { echo -e "\n${bold}mas${reset} is not installed.\n\nRun ${italic}'brew install mas'${reset} for install." && exit 1; }
|
||||||
|
|
||||||
|
latest_v=$(curl -s https://api.github.com/repos/mas-cli/mas/releases/latest | jq -j '.tag_name')
|
||||||
|
current_v=$(mas version)
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "Current version: $current_v"
|
||||||
|
echo -e "Latest version: $latest_v"
|
||||||
|
|
||||||
# https://github.com/mas-cli/mas
|
|
||||||
# On teste si mas est installé
|
# On teste si mas est installé
|
||||||
if hash mas 2>/dev/null; then
|
if hash mas 2>/dev/null; then
|
||||||
|
|
||||||
massy=$(mas outdated)
|
massy=$(mas outdated)
|
||||||
echo ""
|
echo ""
|
||||||
echo "$massy"
|
#echo "$massy"
|
||||||
|
|
||||||
|
nomoreatstore=$(echo "$massy" | grep "not found in store")
|
||||||
|
outdated=$(echo "$massy" | grep -v "not found in store")
|
||||||
|
|
||||||
|
if [ -n "$outdated" ]; then
|
||||||
|
echo -e "${underline}Availables updates:${reset}"
|
||||||
|
echo "$outdated" | awk '{ $1=""; print}'
|
||||||
|
echo "--"
|
||||||
|
#echo "$outdated" | awk '{ $1=""; $3=""; print}'
|
||||||
|
|
||||||
if [ -n "$(mas outdated)" ]; then
|
|
||||||
echo -e "\033[4mAvailables updates:\033[0m"
|
|
||||||
echo "$massy" | cut -d " " -f2-5
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ "$no_distract" = false ]; then
|
#if [ "$no_distract" = false ]
|
||||||
|
if [[ $testing -ne 1 ]]; then
|
||||||
|
#if (( $testing == 1 )); then
|
||||||
|
|
||||||
a=$(echo -e "Do you wanna run \033[1mmas upgrade\033[0m ? (y/n)")
|
#a=$(echo -e "Do you wanna run \033[1mmas upgrade${reset} ? (y/n)")
|
||||||
read -pr "$a" choice
|
#read -pr "$a" choice
|
||||||
case "$choice" in
|
a=$(echo -e "Do you wanna run \033[1mmas upgrade${reset} ? (y/n) ")
|
||||||
y|Y|o ) mas upgrade;;
|
read -p "$a" choice
|
||||||
n|N ) echo "Ok, let's continue";;
|
|
||||||
* ) echo "invalid";;
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
esac
|
|
||||||
|
#case "$choice" in
|
||||||
|
# y|Y|o ) mas upgrade;;
|
||||||
|
# n|N ) echo "Ok, let's continue";;
|
||||||
|
# * ) echo "invalid";;
|
||||||
|
#esac
|
||||||
|
|
||||||
|
while IFS=\n read -r line
|
||||||
|
#for line in "$outdated"
|
||||||
|
do
|
||||||
|
echo "$line"
|
||||||
|
idendifiant=$(echo "$line" | awk '{print $1}')
|
||||||
|
nom=$(echo "$line" | awk -F "(" '{print $1}' | awk '{ $1=""; print}' | xargs)
|
||||||
|
nom_version=$(echo "$line" | awk '{ $1=""; print}')
|
||||||
|
version=$(echo "$line" | awk -F "(" '{print $2}' | sed 's/.$//')
|
||||||
|
|
||||||
|
echo "$idendifiant - $nom - $version"
|
||||||
|
#echo "$version"
|
||||||
|
|
||||||
|
#b=$(echo -e "Do you wanna run ${bold}mas upgrade $nom ${reset} ${italic}$version${reset} ? (y/n) ")
|
||||||
|
#read -p "$b" upg
|
||||||
|
#echo "-- $upg --"
|
||||||
|
#if [ "$upg" == "y" ] || [ "$upg" == "Y" ]; then
|
||||||
|
# mas upgrade "$idendifiant"
|
||||||
|
#fi
|
||||||
|
echo "-- fin --"
|
||||||
|
|
||||||
|
#echo "$line" | awk '{print $1}' | xargs -p -n 1 mas upgrade
|
||||||
|
|
||||||
|
done <<< "$outdated"
|
||||||
|
#done
|
||||||
|
|
||||||
else
|
else
|
||||||
mas upgrade
|
echo -e "OK, let's continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
#else
|
||||||
|
# mas upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\033[4mNo availables mas updates.\033[0m"
|
echo -e "${italic}No availables mas updates.${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$nomoreatstore" ]; then
|
||||||
|
echo -e "\n${underline}Apps no more in App Store:${reset}"
|
||||||
|
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
id=$(echo "$line" | awk '{print $3}')
|
||||||
|
#name=$(echo "$line" | awk '{print $12}' | sed 's/.$//')
|
||||||
|
name=$(echo "$line" | awk -F "identify" '{print $2}' | sed 's/.$//' | xargs)
|
||||||
|
echo -e "$name ($id)"
|
||||||
|
|
||||||
|
done <<< "$nomoreatstore"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Please install mas: brew install mas"
|
echo -e "Please install mas: ${italic}brew install mas${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -1,193 +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 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/
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
||||||
# version installée de nvm par Homebrew
|
|
||||||
nvm_installed=$(brew info nvm | grep Cellar)
|
|
||||||
# version actuelle de nvm sur GitHub
|
|
||||||
version_nvm=$(git ls-remote --tags --refs --sort="v:refname" git://github.com/nvm-sh/nvm.git | tail -n1 | sed 's/.*\///' | sed 's/v//')
|
|
||||||
|
|
||||||
# github
|
|
||||||
if [ -f "$NVM_DIR/nvm.sh" ]; then
|
|
||||||
source $NVM_DIR/nvm.sh
|
|
||||||
# version courante de nvm
|
|
||||||
nvm_v=$(nvm --version)
|
|
||||||
#echo "$nvm_v,$version_nvm" | tr ',' '\n' | sort -V
|
|
||||||
|
|
||||||
echo -e "\033[4m🌿 nvm install is:\033[0m $NVM_DIR/nvm.sh"
|
|
||||||
echo "nvm $nvm_v is installed from https://github.com/nvm-sh/nvm"
|
|
||||||
|
|
||||||
if [ "$nvm_v" != "$version_nvm" ]; then
|
|
||||||
echo "Current nvm version on GitHub: $version_nvm"
|
|
||||||
echo "Current nvm installed version: $nvm_v"
|
|
||||||
|
|
||||||
read -p "Do you want to update nvm from GitHub repo? (y/n)" choice
|
|
||||||
|
|
||||||
if [ "$choice" == "y" ]; then
|
|
||||||
echo "Updating nvm from GitHub..."
|
|
||||||
#curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v"$version_nvm"/install.sh | bash
|
|
||||||
|
|
||||||
#curl: native on Catalina, wget installed by homebrew
|
|
||||||
#wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
|
||||||
#curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
node_install=$(nvm list "$ls_color")
|
|
||||||
echo -e "\033[4m🌿 node.js\033[0m (installed versions): \n$node_install"
|
|
||||||
|
|
||||||
# homebrew
|
|
||||||
elif [ -f "/usr/local/opt/nvm/nvm.sh" ]; then
|
|
||||||
source $(brew --prefix nvm)/nvm.sh
|
|
||||||
# version courante de nvm
|
|
||||||
nvm_v=$(nvm --version)
|
|
||||||
echo -e "\033[4m🌿 nvm install is:\033[0m /usr/local/opt/nvm/nvm.sh"
|
|
||||||
echo "nvm $nvm_v is installed from homebrew"
|
|
||||||
|
|
||||||
if [ "$nvm_v" != "$version_nvm" ]; then
|
|
||||||
echo "Current nvm version on GitHub: $version_nvm"
|
|
||||||
echo "Current nvm installed version: $nvm_v"
|
|
||||||
|
|
||||||
echo -e "nvm is outdated ! You should run \033[1;3mbrew update && brew upgrade nvm\033[0m"
|
|
||||||
echo -e "or run \033[1;3mKymsu's homebrew.sh script\033[0m."
|
|
||||||
fi
|
|
||||||
|
|
||||||
node_install=$(nvm list "$ls_color")
|
|
||||||
echo -e "\033[4m🌿 node.js\033[0m (installed versions): \n$node_install"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\033[3mNote:"
|
|
||||||
echo -e "N/A: version \"10.18.0 -> N/A\" is not yet installed."
|
|
||||||
echo -e "You need to run \"nvm install 10.18.0\" to install it before using it.\033[0m"
|
|
||||||
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Local packages
|
|
||||||
if [ -d "$local_path" ]; then
|
|
||||||
cd "$local_path" || return
|
|
||||||
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)
|
|
||||||
g_outdated=$(npm outdated -g --parseable=true)
|
|
||||||
|
|
||||||
# => npm ERR! Cannot read property 'length' of undefined -> https://stackoverflow.com/questions/55172700/npm-outdated-g-error-cannot-read-property-length-of-undefined
|
|
||||||
# /Users/bruno/.nvm/versions/node/v10.16.2/lib/node_modules/npm/lib/outdated.js
|
|
||||||
# /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" | 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 --verbose
|
|
||||||
# npm verb outdated not updating @angular/cli because it's currently at the maximum version that matches its specified semver range
|
|
||||||
|
|
||||||
echo "$g_outdated" | cut -d : -f 4 | xargs -p -n 1 npm -g install
|
|
||||||
|
|
||||||
else
|
|
||||||
#echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -n 1 npm install -g
|
|
||||||
#echo "$g_outdated" | sed '1d' | awk '{print $1}' | xargs -n 1 npm update -g
|
|
||||||
|
|
||||||
echo "$g_outdated" | cut -d : -f 4 | xargs -n 1 npm -g install
|
|
||||||
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 ""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
438
plugins.d/nodejs.sh
Executable file
438
plugins.d/nodejs.sh
Executable file
@@ -0,0 +1,438 @@
|
|||||||
|
#!/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" || $@ =~ "-n" ]] && 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
|
||||||
|
|
||||||
|
# Set update_node to true to update node.
|
||||||
|
update_node=true
|
||||||
|
|
||||||
|
# Local install:
|
||||||
|
# run 'npm init' in local_path to create package.json
|
||||||
|
local_path=$HOME/Sites/
|
||||||
|
|
||||||
|
# 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=("@squoosh/cli")
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
: <<'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"
|
||||||
|
green="\033[1;32m"
|
||||||
|
bold="\033[1m"
|
||||||
|
bold_ita="\033[1;3m"
|
||||||
|
box="\033[1;41m"
|
||||||
|
redbold="\033[1;31m"
|
||||||
|
redbox="\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"
|
||||||
|
}
|
||||||
|
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
old_npm="$npm_v"
|
||||||
|
echo -e "\n${underline}🌿 npm:${reset}"
|
||||||
|
echo -e " - current version: ${italic}$npm_v${reset}"
|
||||||
|
echo -e " - install path: ${italic}$npm_ins${reset}"
|
||||||
|
|
||||||
|
|
||||||
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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" https://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 [ -n "$version_nvm" ]; then
|
||||||
|
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
|
||||||
|
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 ""
|
||||||
|
|
||||||
|
|
||||||
|
# Do not update packages
|
||||||
|
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
|
||||||
|
|
||||||
|
##################
|
||||||
|
# Local packages #
|
||||||
|
##################
|
||||||
|
|
||||||
|
# 1. Create package.json file with 'npm init'
|
||||||
|
# or copy packagejson in $local_path
|
||||||
|
# 2. Install node modules with 'npm install' in $local_path\node_modules
|
||||||
|
|
||||||
|
# Local folder exist and not empty (modules installed)
|
||||||
|
#if [ -d "$local_path/node_modules" ] && [ -n "$(ls -A "$local_path/node_modules")" ]; then
|
||||||
|
if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then
|
||||||
|
|
||||||
|
echo -e "${underline}🌿 Local installed scripts:${reset}"
|
||||||
|
|
||||||
|
cd "$local_path" || return
|
||||||
|
|
||||||
|
if [ "$display_info" = true ]; then
|
||||||
|
ll=$(npm ls --long | grep -v 'git$')
|
||||||
|
x=
|
||||||
|
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
if [[ "${line}" =~ "──" ]] || [[ "${line}" =~ "─┬" ]]; then
|
||||||
|
local_pkg=$(echo "${line}" | awk '{print $2}' | awk -F"@" '{print $1}')
|
||||||
|
#echo -e "${bold}${line}${reset}"
|
||||||
|
info_pkg=$(npm view "$local_pkg" | sed -n '3,4p')
|
||||||
|
q=$(echo "$info_pkg" | sed "s/^/| /")
|
||||||
|
#echo -e "$q"
|
||||||
|
x+="${bold}${line}${reset}\n"
|
||||||
|
x+="$q\n"
|
||||||
|
else
|
||||||
|
#echo -e "${line}"
|
||||||
|
x+="${line}\n"
|
||||||
|
fi
|
||||||
|
done <<< "$ll"
|
||||||
|
else
|
||||||
|
npm ls
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "$x"
|
||||||
|
|
||||||
|
echo -e "\n${underline}🌿 Search for local packages update...${reset}\n"
|
||||||
|
outdated=$(npm outdated --long | sed '1d')
|
||||||
|
if [ -n "$outdated" ]; then
|
||||||
|
nb_update=$(echo "outdated" | wc -l | xargs)
|
||||||
|
a="available package update"
|
||||||
|
array=($a)
|
||||||
|
[ "$nb_update" -gt 1 ] && echo -e "${box} $nb_update ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_update ${reset} ${array[@]}:\n"
|
||||||
|
|
||||||
|
echo -e "\n${underline}🌿 Updating local packages...${reset}\n"
|
||||||
|
|
||||||
|
while IFS= read -r i
|
||||||
|
do
|
||||||
|
package=$(echo "$i" | awk '{print $1}')
|
||||||
|
current=$(echo "$i" | awk '{print $2}')
|
||||||
|
wanted=$(echo "$i" | awk '{print $3}')
|
||||||
|
latest=$(echo "$i" | awk '{print $4}')
|
||||||
|
|
||||||
|
j=$(echo "$current" | awk -F "." '{print $1}')
|
||||||
|
k=$(echo "$latest" | awk -F "." '{print $1}')
|
||||||
|
|
||||||
|
if [[ ! " ${do_not_update[@]} " =~ " ${package} " ]]; then
|
||||||
|
|
||||||
|
# Update major version 1.x.y to 2.x.y
|
||||||
|
if [ $current = $wanted ] && [ "$j" -lt "$k" ]; then
|
||||||
|
if [ "$no_distract" = false ]; then
|
||||||
|
echo "$package@latest" | xargs -p npm install
|
||||||
|
else
|
||||||
|
echo "$package@latest" | xargs npm install
|
||||||
|
#npm install "$package@latest"
|
||||||
|
fi
|
||||||
|
# Update minor or patch version
|
||||||
|
else
|
||||||
|
if [ "$no_distract" = false ]; then
|
||||||
|
echo "$package" | xargs -p npm update
|
||||||
|
else
|
||||||
|
echo "$package" | xargs npm update
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "${redbold}$package is pinned to version $current !${reset} Don't update !"
|
||||||
|
fi
|
||||||
|
|
||||||
|
done <<< "$outdated"
|
||||||
|
|
||||||
|
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 --location=global --depth=0 --long | grep -v 'git$')
|
||||||
|
x=""
|
||||||
|
q=""
|
||||||
|
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
if [[ "${line}" =~ "──" ]]; then
|
||||||
|
#echo -e "${bold}${line}${reset}"
|
||||||
|
global_pkg=$(echo "${line}" | awk '{print $2}' | awk -F"@" '{print $1}')
|
||||||
|
#echo -e "${bold}${line}${reset}"
|
||||||
|
info_pkg=$(npm view "$global_pkg" | sed -n '4p')
|
||||||
|
q=$(echo "$info_pkg" | sed "s/^/| /")
|
||||||
|
#echo "$q"
|
||||||
|
x+="${bold}${line}${reset}\n"
|
||||||
|
|
||||||
|
elif [[ ${#line} > 2 ]]; then
|
||||||
|
#echo -e "${line}"
|
||||||
|
x+="${line}\n"
|
||||||
|
x+="$q\n"
|
||||||
|
fi
|
||||||
|
done <<< "$lg"
|
||||||
|
else
|
||||||
|
npm list --location=global --depth=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "$x"
|
||||||
|
|
||||||
|
#Packages update
|
||||||
|
echo -e "\n${underline}🌿 Search for global packages update...${reset}\n"
|
||||||
|
|
||||||
|
glong_outdated=$(npm outdated --location=global --long | sed '1d')
|
||||||
|
|
||||||
|
if [ -n "$glong_outdated" ]; then
|
||||||
|
nb_update_global=$(echo "$glong_outdated" | wc -l | xargs)
|
||||||
|
a="available package update"
|
||||||
|
array=($a)
|
||||||
|
[ "$nb_update_global" -gt 1 ] && echo -e "${box} $nb_update_global ${reset} ${array[@]/%/s}:\n" || echo -e "${box} $nb_update_global ${reset} ${array[@]}:\n"
|
||||||
|
|
||||||
|
echo -e "$glong_outdated\n"
|
||||||
|
echo -e "\n${underline}🌿 Updating global packages...${reset}\n"
|
||||||
|
|
||||||
|
# Disable: Would you like to share anonymous usage data with the Angular Team at Google ?
|
||||||
|
if [[ " $glong_outdated " =~ "angular" ]]; then
|
||||||
|
export NG_CLI_ANALYTICS="false"
|
||||||
|
fi
|
||||||
|
# 15 packages are looking for funding
|
||||||
|
|
||||||
|
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
pkg=$(echo "$line" | awk '{print $1}')
|
||||||
|
curr=$(echo "$line" | awk '{print $2}')
|
||||||
|
vers=$(echo "$line" | awk '{print $4}')
|
||||||
|
outdated="$pkg@$vers"
|
||||||
|
|
||||||
|
if [[ ! " ${do_not_update[@]} " =~ " ${pkg} " ]]; then
|
||||||
|
|
||||||
|
# TEST
|
||||||
|
#version=$(echo "$line" | awk '{print $1 "@" $4}')
|
||||||
|
#echo "$version"
|
||||||
|
# /test
|
||||||
|
|
||||||
|
if [ "$no_distract" = false ]; then
|
||||||
|
echo "$outdated" | xargs -p -n 1 npm --location=global install
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "$outdated" | xargs -n 1 npm --location=global install
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "${redbold}$pkg is pinned to version $curr !${reset} Don't update !"
|
||||||
|
|
||||||
|
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
|
||||||
|
doc=$(cd "$local_path" && npm doctor)
|
||||||
|
|
||||||
|
|
||||||
|
while IFS= read -r line
|
||||||
|
do
|
||||||
|
if [[ "${line}" =~ "Not ok" ]]; then
|
||||||
|
echo -e "${red}${line}${reset}"
|
||||||
|
elif [[ "${line}" =~ "Ok" ]]; then
|
||||||
|
echo -e "${green}${line}${reset}"
|
||||||
|
else
|
||||||
|
echo -e "${line}"
|
||||||
|
fi
|
||||||
|
done <<< "$doc"
|
||||||
|
|
||||||
|
|
||||||
|
#echo -e "$doc\n"
|
||||||
|
|
||||||
|
# search not ok => red
|
||||||
|
|
||||||
|
#npm_v=$(echo "$doc" | grep 'npm -v')
|
||||||
|
#node_v=$(echo "$doc" | grep 'node -v')
|
||||||
|
npm_v=$(echo "$doc" | grep -A2 'Checking npm version')
|
||||||
|
node_v=$(echo "$doc" | grep -A2 'Checking node version')
|
||||||
|
|
||||||
|
if [[ " $node_v " =~ "Not ok" ]]; then
|
||||||
|
|
||||||
|
no=$(echo "$node_v" | sed -n '$p')
|
||||||
|
new_node=$(echo "$no" | awk '{print $3}' | sed 's/^.//')
|
||||||
|
old_node=$(echo "$no" | awk '{print $5}' | sed 's/.//;s/.$//')
|
||||||
|
|
||||||
|
if [ "$new_node" != "$old_node" ] && [ "$update_node" = true ]; then
|
||||||
|
|
||||||
|
b=$(echo -e "\nCurrent node: v$old_node. Update ${bold}node${reset} to ${bold}v$new_node${reset} [y/n] ? ")
|
||||||
|
read -e -p "$b" rep2
|
||||||
|
if [ "$rep2" == "y" ] || [ "$rep2" == "Y" ]; then
|
||||||
|
. $HOME/.nvm/nvm.sh
|
||||||
|
echo -e "\n${bold}Updating node to v$new_node...${reset}"
|
||||||
|
nvm install "$new_node"
|
||||||
|
echo -e "\n${bold}Updating npm...${reset}"
|
||||||
|
npm --location=global install npm
|
||||||
|
#
|
||||||
|
nvm use $new_node
|
||||||
|
echo -e "\n${bold}Reinstall packages from v$old_node...${reset}"
|
||||||
|
nvm reinstall-packages "$old_node"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ " $npm_v " =~ "Not ok" ]]; then
|
||||||
|
|
||||||
|
np=$(grep -o -E "v([0-9]{1,2}\.){2}[0-9]{1,2}" <<< "$npm_v")
|
||||||
|
new_npm=$(echo "${np:1}") # 10.7.0
|
||||||
|
|
||||||
|
if [ "$new_npm" != "$old_npm" ]; then
|
||||||
|
echo -e "${underline}\nUdpate available for npm.${reset}"
|
||||||
|
echo -e " - Current: ${red}v$old_npm${reset}"
|
||||||
|
echo -e " - Update: ${green}v$new_npm${reset}"
|
||||||
|
echo -e "You should run:"
|
||||||
|
echo -e " - ${bold}npm --location=global install npm${reset}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "Troubleshooting:"
|
||||||
|
echo "https://github.com/nvm-sh/nvm#macos-troubleshooting"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo -e "🔍 Verifying npm cache\n"
|
||||||
|
npm cache verify
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
@@ -10,10 +10,25 @@
|
|||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
# No distract mode (no user interaction)
|
# No distract mode (no user interaction)
|
||||||
no_distract=false
|
[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
|
#
|
||||||
|
# Display PHP informations
|
||||||
|
display_info=true
|
||||||
|
# Open PHP info in Safari
|
||||||
|
php_info=false
|
||||||
#
|
#
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
italic="\033[3m"
|
||||||
|
underline="\033[4m"
|
||||||
|
ita_under="\033[3;4m"
|
||||||
|
bgd="\033[1;4;31m"
|
||||||
|
red="\033[1;31m"
|
||||||
|
blue="\033[34m"
|
||||||
|
bold="\033[1m"
|
||||||
|
box="\033[1;41m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
notification() {
|
notification() {
|
||||||
sound="Basso"
|
sound="Basso"
|
||||||
title="Homebrew"
|
title="Homebrew"
|
||||||
@@ -27,76 +42,135 @@ notification() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
echo -e "${bold}🐘 pecl ${reset}"
|
||||||
no_distract=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\033[1m🐘 pecl \033[0m"
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo -e "\033[1m❗️ plugin en test (beta) \033[0m"
|
echo -e "${bold}❗️ plugin en test (beta) ${reset}"
|
||||||
echo ""
|
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)
|
# Airbook
|
||||||
|
#❯ echo $(brew --prefix)
|
||||||
|
#/opt/homebrew
|
||||||
|
|
||||||
|
#❯ which -a php
|
||||||
|
#/opt/homebrew/bin/php
|
||||||
|
#/usr/bin/php
|
||||||
|
|
||||||
|
#/opt/homebrew/opt/php
|
||||||
|
|
||||||
|
#❯ php --info | grep 'PHP Version'
|
||||||
|
#PHP Version => 7.3.24-(to be removed in future macOS)
|
||||||
|
#PHP Version => 7.3.24-(to be removed in future macOS)
|
||||||
|
|
||||||
|
# Silberbook
|
||||||
|
#❯ echo $(brew --prefix)
|
||||||
|
#/usr/local
|
||||||
|
|
||||||
|
#❯ which -a php
|
||||||
|
#/usr/local/bin/php
|
||||||
|
#/usr/bin/php
|
||||||
|
|
||||||
|
#/usr/local/opt/php
|
||||||
|
|
||||||
|
|
||||||
version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}')
|
version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}')
|
||||||
v=${version:0:3}
|
v=${version:0:3}
|
||||||
|
echo -e "${ita_under}${blue}Current PHP version:${reset} ${bold}$version${reset}\n"
|
||||||
|
|
||||||
if [ "$v" = "7.3" ]; then
|
latest="8.2"
|
||||||
php_path=$(brew --prefix)/opt/php@7.3/bin
|
versions=("7.4" "8.0" "8.1" "8.3" "$latest")
|
||||||
elif [ "$v" = "7.2" ]; then
|
php_installed=$(ls -1 $(brew --prefix)/opt/ | grep php@)
|
||||||
php_path=$(brew --prefix)/opt/php@7.2/bin
|
echo -e "${ita_under}${blue}Installed PHP versions:${reset}"
|
||||||
elif [ "$v" = "7.4" ]; then
|
echo -e "$php_installed\n"
|
||||||
|
|
||||||
|
if [ "$v" == "$latest" ] ; then
|
||||||
php_path=$(brew --prefix)/opt/php/bin
|
php_path=$(brew --prefix)/opt/php/bin
|
||||||
|
else
|
||||||
|
php_path=$(brew --prefix)/opt/php@$v/bin
|
||||||
|
fi
|
||||||
|
#echo "$php_path"
|
||||||
|
pecl version
|
||||||
|
|
||||||
|
|
||||||
|
curl -Is https://www.apple.com | head -1 | grep 200
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pecl_upgrade=$($php_path/pecl list-upgrades)
|
# Note that all public channels can be synced using "update-channels"
|
||||||
|
echo -e "\n${ita_under}${blue}Updating all channels...${reset}"
|
||||||
|
pecl update-channels
|
||||||
|
|
||||||
|
#pecl channel-update pecl.php.net
|
||||||
|
#pecl channel-update pear.php.net
|
||||||
|
|
||||||
|
|
||||||
|
# List Installed Packages In The Default Channel
|
||||||
|
#pecl_list=$($php_path/pecl list)
|
||||||
|
# List installed packages from all channels
|
||||||
|
pecl_list=$(pecl list -a)
|
||||||
|
echo -e "\n$pecl_list\n"
|
||||||
|
|
||||||
|
# Installation imagick:
|
||||||
|
# https://github.com/Imagick/imagick
|
||||||
|
#git clone https://github.com/Imagick/imagick
|
||||||
|
#cd imagick
|
||||||
|
#phpize && ./configure
|
||||||
|
#make
|
||||||
|
#make install
|
||||||
|
|
||||||
|
|
||||||
|
pecl_upgrade=$(pecl list-upgrades)
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$pecl_upgrade" ]; then
|
if [ -n "$pecl_upgrade" ]; then
|
||||||
|
|
||||||
echo -e "\033[4mExtensions update:\033[0m"
|
echo -e "${ita_under}${blue}Extensions update:${reset}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "$pecl_upgrade"
|
echo "$pecl_upgrade"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
available=$(echo "$pecl_upgrade" | grep -v 'No upgrades available' | grep 'kB')
|
available=$(echo "$pecl_upgrade" | grep -v 'No upgrades available' | grep 'kB')
|
||||||
|
#echo "available: $available"
|
||||||
|
|
||||||
if [ -n "$available" ]; then
|
if [ -n "$available" ]; then
|
||||||
while read ligne
|
while read ligne
|
||||||
do
|
do
|
||||||
echo "$ligne"
|
#echo "$ligne"
|
||||||
|
|
||||||
# Channel pear.php.net
|
# Channel pear.php.net
|
||||||
a=$(echo "$ligne" | grep "pear")
|
a=$(echo "$ligne" | grep "pear")
|
||||||
|
#echo "a: $a"
|
||||||
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
|
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")
|
||||||
|
#echo "b: $b"
|
||||||
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 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"
|
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
|
echo "$b" | xargs -p -n 1 pecl upgrade
|
||||||
|
php_info=true
|
||||||
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
|
echo "$b" | xargs -n 1 pecl upgrade
|
||||||
|
php_info=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
@@ -105,31 +179,49 @@ if [ -n "$pecl_upgrade" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# si modif des extensions, les .ini dans conf.d/ ne sont pas modifiés, juste le php.ini
|
# 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
|
# php.ini a été modifié il y a moins de 5mn
|
||||||
v_php=$(php --info | grep -E 'usr.*ini')
|
#v_php=$(php --info | grep -E 'usr.*ini')
|
||||||
|
v_php=$(php --ini)
|
||||||
|
|
||||||
conf_php=$(echo "$v_php" | grep 'Loaded Configuration File' | awk '{print $NF}')
|
conf_php=$(echo "$v_php" | grep 'Loaded Configuration File' | awk '{print $NF}')
|
||||||
dir=$(dirname "$conf_php")
|
dir=$(dirname "$conf_php")
|
||||||
name=$(basename "$conf_php")
|
name=$(basename "$conf_php")
|
||||||
notif2="$conf_php was modified in the last 5 minutes"
|
notif2="$conf_php was modified in the last 5 minutes"
|
||||||
|
|
||||||
test=$(find "$dir" -name "$name" -mmin -5 -maxdepth 1)
|
if [ "$display_info" = true ]; then
|
||||||
|
echo -e "${ita_under}${blue}PHP ini files:${reset}"
|
||||||
|
echo -e "php.ini path: ${bold}$conf_php${reset}"
|
||||||
|
echo -e "Additionnals ini files:\n$(ls $dir/conf.d/*.ini)"
|
||||||
|
echo -e "\n${ita_under}${blue}To change php version:${reset} ${italic}$ sphp 7.4${reset}"
|
||||||
|
echo -e " ${italic}•mod-php: https://gist.github.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2${reset}"
|
||||||
|
echo -e " ${italic}•php-fpm: https://gist.github.com/rozsival/10289d1e2006c68009ace0478306ecd2${reset}\n"
|
||||||
|
|
||||||
|
#[ "$php_info" = true ] && echo -e "Opening PHP info in Safari..." && open "https://$host.local/info.php"
|
||||||
|
if [ "$php_info" = true ]; then
|
||||||
|
#host=$(hostname)
|
||||||
|
echo -e "Some extensions have been updated. Let's opening PHP info in Safari..."
|
||||||
|
open "https://$(hostname).local/info.php"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
test=$(find "$dir" -maxdepth 1 -name "$name" -mmin -5)
|
||||||
|
|
||||||
if [ -n "$test" ]; then
|
if [ -n "$test" ]; then
|
||||||
echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
echo -e "${red}❗️ ️$notif2${reset}"
|
||||||
notification "$notif2"
|
notification "$notif2"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
a=$(echo -e "Do you want to edit \033[1m$conf_php\033[0m file ? (y/n)")
|
if [ -n "$available" ]; then
|
||||||
|
a=$(echo -e "Do you want to edit ${bold}$conf_php${reset} file ? (y/n)")
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
if [ "$choice" == "y" ]; then
|
if [ "$choice" == "y" ]; then
|
||||||
$EDITOR "$conf_php"
|
$EDITOR "$conf_php"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# WARNING: channel "pear.php.net" has updated its protocols,
|
|
||||||
# use "pecl channel-update pear.php.net" to update
|
|
||||||
@@ -1,11 +1,35 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Perl plugin for KYMSU
|
||||||
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
|
###############################################################################################
|
||||||
|
#
|
||||||
|
# Settings:
|
||||||
|
|
||||||
# Display info on updated pakages
|
# Display info on updated pakages
|
||||||
display_info=true
|
display_info=true
|
||||||
|
|
||||||
|
# No distract mode (no user interaction)
|
||||||
|
[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
# Also add module for prevent to update it.
|
# Also add module for prevent to update it.
|
||||||
declare -a do_not_update=('')
|
declare -a do_not_update=('')
|
||||||
|
|
||||||
|
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"
|
||||||
|
redbold="\033[1;31m"
|
||||||
|
redbox="\033[1;41m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
|
echo -e "${bold}🐪 Perl ${reset}"
|
||||||
|
echo
|
||||||
|
|
||||||
perl_app=$(which perl)
|
perl_app=$(which perl)
|
||||||
perl_v=$(perl -v | sed -n '2p')
|
perl_v=$(perl -v | sed -n '2p')
|
||||||
@@ -14,14 +38,14 @@ echo -e "\033[4mPerl:\033[0m $perl_app"
|
|||||||
echo -e "\033[4mVersion:\033[0m $perl_v"
|
echo -e "\033[4mVersion:\033[0m $perl_v"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
module="App::cpanoutdate"
|
module="App::cpanoutdated"
|
||||||
if ! perl -M$module -e 1 2>/dev/null; then
|
if ! perl -M$module -e 1 2>/dev/null; then
|
||||||
echo -e "\033[4mRequierement:\033[0m module $module is not installed"
|
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)")
|
a=$(echo -e "Do you wanna run \033[1mcpan -i "$module"\033[0m ? (y/n)")
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
if [ "$choice" == "y" ]; then
|
if [ "$choice" == "y" ]; then
|
||||||
#cpan -i $module
|
cpan -i $module
|
||||||
install_ok=true
|
install_ok=true
|
||||||
else
|
else
|
||||||
echo "Bye"
|
echo "Bye"
|
||||||
@@ -29,12 +53,18 @@ if ! perl -M$module -e 1 2>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "$module installed"
|
|
||||||
install_ok=true
|
install_ok=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$install_ok" == "true" ]; then
|
if [ "$install_ok" == "true" ]; then
|
||||||
echo "$module installed"
|
|
||||||
|
|
||||||
# install with cpan
|
# install with cpan
|
||||||
# % cpan-outdated | xargs cpan -i
|
# % cpan-outdated | xargs cpan -i
|
||||||
@@ -46,10 +76,10 @@ if [ "$install_ok" == "true" ]; then
|
|||||||
outdated=$(cpan-outdated -p)
|
outdated=$(cpan-outdated -p)
|
||||||
nb=$(echo $outdated | wc -w)
|
nb=$(echo $outdated | wc -w)
|
||||||
|
|
||||||
a=$(echo -e "Do you wanna update\033[1m "$nb" outdated\033[0m modules ? (y/n)")
|
a=$(echo -e "Do you wanna update\033[1m "$nb" outdated\033[0m modules ? (y/n/a)")
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
|
|
||||||
if [ "$choice" == "y" ]; then
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
|
||||||
for i in $outdated
|
for i in $outdated
|
||||||
do
|
do
|
||||||
@@ -60,7 +90,11 @@ if [ "$install_ok" == "true" ]; then
|
|||||||
cpan -D "$i"
|
cpan -D "$i"
|
||||||
fi
|
fi
|
||||||
echo -e "\033[1m"
|
echo -e "\033[1m"
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
echo "$i" | awk '{print $1}' | xargs -p -n 1 cpan -i
|
echo "$i" | awk '{print $1}' | xargs -p -n 1 cpan -i
|
||||||
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
echo "$i" | awk '{print $1}' | xargs -n 1 cpan -i
|
||||||
|
fi
|
||||||
echo -e "\033[0m"
|
echo -e "\033[0m"
|
||||||
#echo ""
|
#echo ""
|
||||||
fi
|
fi
|
||||||
|
|||||||
160
plugins.d/pip.sh
160
plugins.d/pip.sh
@@ -13,37 +13,47 @@
|
|||||||
#
|
#
|
||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
|
# Display info on updated pakages / casks
|
||||||
|
#[[ $@ =~ "--info" ]] && display_info=false || display_info=true
|
||||||
|
display_info=true
|
||||||
|
|
||||||
|
# No distract mode (no user interaction)
|
||||||
|
[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && 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: pip ou pip3
|
||||||
# pip: python3.8 - pip3: python3.9
|
# 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=false
|
# Add module to the do_not_update array for prevent to update.
|
||||||
#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=("parso" "asgiref")
|
||||||
declare -a do_not_update=("asgiref")
|
declare -a do_not_update=("pyee")
|
||||||
#
|
#
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
: <<'END_COMMENT'
|
||||||
|
blabla
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
italic="\033[3m"
|
italic="\033[3m"
|
||||||
underline="\033[4m"
|
underline="\033[4m"
|
||||||
|
ita_under="\033[3;4m"
|
||||||
bold="\033[1m"
|
bold="\033[1m"
|
||||||
|
bold_under="\033[1;4m"
|
||||||
redbox="\033[1;41m"
|
redbox="\033[1;41m"
|
||||||
redbold="\033[1;31m"
|
redbold="\033[1;31m"
|
||||||
red="\033[31m"
|
red="\033[31m"
|
||||||
yellow="\033[33m"
|
yellow="\033[33m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
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"; }
|
||||||
no_distract=true
|
command -v $pip_version >/dev/null 2>&1 || { echo -e "${bold}$pip_version${reset} is not installed." && exit 1; }
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ -x "$(command -v $pip_version)" ]; then
|
|
||||||
echo "Error: $pip_version is not installed." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "${bold}🐍 $pip_version (Python 3) ${reset}"
|
echo -e "${bold}🐍 $pip_version (Python 3) ${reset}"
|
||||||
|
|
||||||
@@ -52,88 +62,116 @@ echo ""
|
|||||||
echo -e "Current ${underline}Python3${reset} version: $(python3 -V | awk '{print $2}')"
|
echo -e "Current ${underline}Python3${reset} version: $(python3 -V | awk '{print $2}')"
|
||||||
echo -e "Current ${underline}pip3${reset} version: $(pip3 -V)"
|
echo -e "Current ${underline}pip3${reset} version: $(pip3 -V)"
|
||||||
|
|
||||||
#$pip_version install --upgrade pip
|
#$pip_version install --upgrade pip > /dev/null
|
||||||
$pip_version install --upgrade pip > /dev/null
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Do not update packages
|
||||||
if (( ${#do_not_update[@]} )); then
|
if (( ${#do_not_update[@]} )); then
|
||||||
|
|
||||||
nbp=${#do_not_update[*]}
|
nbp=${#do_not_update[*]}
|
||||||
|
|
||||||
echo -e "${underline}List of${reset} ${redbox} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
echo -e "${underline}List of${reset} ${redbox} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
||||||
echo -e "${redbold}${do_not_update[*]}${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 -e "To remove package from this list, you need to edit the ${italic}do_not_update${reset} array."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Packages update
|
||||||
|
echo -e "🐍 ${underline}Search for packages update...${reset}\n"
|
||||||
|
|
||||||
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}')
|
||||||
|
|
||||||
|
# Find infos about updated packages
|
||||||
if [ -n "$upd" ]; then
|
if [ -n "$upd" ]; then
|
||||||
|
|
||||||
nb=$(echo "$upd" | wc -w | xargs)
|
nb=$(echo "$upd" | wc -w | xargs)
|
||||||
|
|
||||||
echo -e "${redbox} $nb ${reset} ${underline}availables updates:${reset}"
|
echo -e "${redbox} $nb ${reset} availables updates:"
|
||||||
#echo $pip3_outdated_freeze | tr [:space:] '\n'
|
echo -e "\n$pip_outdated"
|
||||||
echo "$pip_outdated"
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
for i in $upd
|
for i in $upd
|
||||||
do
|
do
|
||||||
info=$($pip_version show "$i")
|
info=$($pip_version show "$i")
|
||||||
echo "$info" | head -4
|
|
||||||
|
l=$(echo "$info" | sed -n '1p')
|
||||||
|
|
||||||
|
if [[ ! " ${do_not_update[@]} " =~ " ${i} " ]]; then
|
||||||
|
m=$(sed "1s/.*/\\${bold}$l\\${reset}/" <<< "$info")
|
||||||
|
else
|
||||||
|
m=$(sed "1s/.*/\\${redbold}$l\\${reset}/" <<< "$info")
|
||||||
|
fi
|
||||||
|
echo -e "$m" | head -4
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
z+="$i "
|
||||||
|
|
||||||
done
|
done
|
||||||
|
# z = asgiref setuptools lunr
|
||||||
|
|
||||||
if [ -x "$(command -v pipdeptree)" ]; then
|
# Check dependancies
|
||||||
echo -e "${underline}Check dependancies:${reset}"
|
if [ -x "$(command -v pipdeptree)" ] && [ "$display_depend" == true ]; then
|
||||||
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")
|
|
||||||
|
|
||||||
#asgiref==3.2.10
|
echo -e "🐍 ${underline}Check dependancies:${reset}\n"
|
||||||
# - Django==3.1.2 [requires: asgiref~=3.2.10]
|
echo -e "Be carefull!! This updates can be a dependancie for some modules. Check for any incompatible version.\n"
|
||||||
|
|
||||||
#parso==0.7.1
|
# packages dont on recherche les dépendances (x = asgiref,setuptools,lunr)
|
||||||
# - jedi==0.17.2 [requires: parso>=0.7.0,<0.8.0]
|
x=$(echo "$z" | sed 's/.$//' | sed 's/ /,/g')
|
||||||
|
# on filtre les lignes (y = asgiref|setuptools|lunr)
|
||||||
|
y=$(echo "$z" | sed 's/.$//' | sed 's/ /|/g')
|
||||||
|
|
||||||
z=0
|
dependencies=$(echo "$x" | xargs pipdeptree -r --python /opt/homebrew/opt/python@3.11/bin/python3.11 -p | grep -E $y)
|
||||||
while read -r line; do
|
echo -e ""
|
||||||
if [[ $line = *"<"* ]]; then
|
|
||||||
echo -e "${red}$line${reset}"
|
|
||||||
elif [[ $line = *"~="* ]]; then
|
while IFS= read -r line; do
|
||||||
echo -e "${yellow}$line${reset}"
|
z=$(echo "${line}" | grep -i ^[a-z])
|
||||||
|
k=$(echo "${line}" | awk -F'==' '{print $1}')
|
||||||
|
l=$(echo "${line}" | awk -F':' '{print $2}')
|
||||||
|
|
||||||
|
|
||||||
|
# Si la ligne commence par une lettre (aka. paquet à mettre à jour)
|
||||||
|
if [ -n "$z" ] ; then
|
||||||
|
|
||||||
|
# Met en redbold le paquet si il est 'do_not_update'
|
||||||
|
if [[ ! " ${do_not_update[@]} " =~ " ${k} " ]]; then
|
||||||
|
echo -e "\n${bold}${line}${reset}"
|
||||||
else
|
else
|
||||||
if [ "$z" -eq 0 ]; then
|
echo -e "\n${redbold}${line}${reset}"
|
||||||
echo -e "${italic}$line${reset}"
|
|
||||||
else
|
|
||||||
echo "$line"
|
|
||||||
fi
|
fi
|
||||||
z=$((z+1))
|
|
||||||
|
# sinon dépendance
|
||||||
|
elif [[ "${l}" = *"<"* ]] || [[ "${l}" = *"=="* ]]; then
|
||||||
|
echo -e "${red}${line}${reset}"
|
||||||
|
elif [[ "${l}" = *"~="* ]]; then
|
||||||
|
echo -e "${yellow}${line}${reset}"
|
||||||
|
else
|
||||||
|
echo "${line}"
|
||||||
fi
|
fi
|
||||||
done <<< "$dependencies"
|
done <<< "$dependencies"
|
||||||
echo ""
|
|
||||||
|
|
||||||
else
|
|
||||||
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
|
||||||
read -pr "$c" choice
|
|
||||||
case "$choice" in
|
|
||||||
y|Y|o ) $pip_version install $user pipdeptree ;;
|
|
||||||
n|N ) echo "Ok, let's continue";;
|
|
||||||
* ) echo "invalid";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the update is not in the do_not_update array, we install it.
|
|
||||||
|
|
||||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
# Updating packages
|
||||||
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
|
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)")
|
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
|
||||||
@@ -144,19 +182,19 @@ if [ -n "$upd" ]; then
|
|||||||
esac
|
esac
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
elif [ "${FOUND}" = "" ]; then
|
else
|
||||||
|
|
||||||
echo "$i" | xargs $pip_version install $user --upgrade
|
echo "$i" | xargs $pip_version install $user --upgrade
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "${underline}No availables updates.${reset}"
|
echo -e "No availables updates."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "🐍 Running ${bold}pip check${reset} for checking that everything is ok."
|
echo -e "🐍 ${underline}Running ${reset}${bold_under}pip check${reset}${underline} for checking that everything is ok...${reset}\n"
|
||||||
|
|
||||||
$pip_version check
|
$pip_version check
|
||||||
|
|
||||||
|
|||||||
105
plugins.d/pipx.sh
Executable file
105
plugins.d/pipx.sh
Executable file
@@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# pipx plugin for KYMSU
|
||||||
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
|
# No distract mode (no user interaction)
|
||||||
|
[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
|
# Upgrade --include-injected
|
||||||
|
injected=true
|
||||||
|
|
||||||
|
# Add module to the do_not_update array for prevent to update.
|
||||||
|
#declare -a do_not_update=()
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "${bold}🛠 pipx (Python 3) ${reset}"
|
||||||
|
|
||||||
|
if ! command -v pipx &> /dev/null
|
||||||
|
then
|
||||||
|
echo -e "${bold}pipx${reset} could not be found !\n"
|
||||||
|
echo -e "You should install ${bold}pipx${reset}:\n"
|
||||||
|
echo -e " - brew install pipx"
|
||||||
|
echo -e " - pipx ensurepath"
|
||||||
|
echo -e "or"
|
||||||
|
echo -e " - python3 -m pip install --user pipx"
|
||||||
|
echo -e " - python3 -m pipx ensurepath"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
list=$(pipx list --include-injected) # pipx list --quiet
|
||||||
|
echo -e "\n${underline}List installed packages:${reset}"
|
||||||
|
echo "$list"
|
||||||
|
|
||||||
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
pipx-outdated() {
|
||||||
|
echo -e "\n${underline}Outdated Packages:${reset}"
|
||||||
|
while read -sr pyPkgName pyPkyVersion; do
|
||||||
|
local pypi_latest="$(curl -sS https://pypi.org/simple/${pyPkgName}/ | grep -o '>.*</' | tail -n 1 | grep -o -E '[0-9]([0-9]|[-._])*[0-9]')"
|
||||||
|
#[ "$pyPkyVersion" != "$pypi_latest" ] && printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||||
|
if [ "$pyPkyVersion" != "$pypi_latest" ]; then
|
||||||
|
printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||||
|
outdated+="$pyPkgName "
|
||||||
|
fi
|
||||||
|
|
||||||
|
done < <( pipx list | grep -o 'package.*,' | tr -d ',' | cut -d ' ' -f 2- )
|
||||||
|
}
|
||||||
|
|
||||||
|
# https://github.com/avantrec/soco-cli/blob/master/CHANGELOG.txt
|
||||||
|
|
||||||
|
pipx-outdated
|
||||||
|
|
||||||
|
outdated=$(echo "$outdated" | sed 's/.$//')
|
||||||
|
|
||||||
|
if [ -n "$outdated" ]; then
|
||||||
|
|
||||||
|
nb=$(echo "$outdated" | wc -w | xargs)
|
||||||
|
echo -e "${redbox} $nb ${reset} availables updates:"
|
||||||
|
|
||||||
|
|
||||||
|
a=$(echo -e "\nDo you wanna run ${bold}pipx upgrade "$outdated"${reset} ? (y/n/a) ")
|
||||||
|
# yes/no/all
|
||||||
|
read -p "$a" choice
|
||||||
|
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
for i in $outdated;
|
||||||
|
do
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
|
if [ "$injected" = true ]; then
|
||||||
|
echo "$i" | xargs -p -n 1 pipx upgrade --include-injected
|
||||||
|
else
|
||||||
|
echo "$i" | xargs -p -n 1 pipx upgrade
|
||||||
|
fi
|
||||||
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
|
if [ "$injected" = true ]; then
|
||||||
|
pipx upgrade-all --include-injected
|
||||||
|
else
|
||||||
|
pipx upgrade-all
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo -e "OK, let's continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "No update available !"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
92
plugins.d/python_668.sh
Executable file
92
plugins.d/python_668.sh
Executable file
@@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 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" || $@ =~ "-n" ]] && 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
|
||||||
|
# pip: python3.8 - pip3: python3.9
|
||||||
|
pip_version=pip3
|
||||||
|
#user: "" or "--user"
|
||||||
|
user=""
|
||||||
|
|
||||||
|
# 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=("pyee")
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
: <<'END_COMMENT'
|
||||||
|
blabla
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
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 ""
|
||||||
|
|
||||||
|
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 ""
|
||||||
|
|
||||||
|
# Do not update packages
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
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}')
|
||||||
50
plugins.d/rustup.sh
Executable file
50
plugins.d/rustup.sh
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
echo -e "\n${bold}🦀 Rust${reset}\n"
|
||||||
|
|
||||||
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if hash rustup 2>/dev/null; then
|
||||||
|
|
||||||
|
echo -e "🦀 ${underline}rustup check${reset}\n"
|
||||||
|
rustup check
|
||||||
|
|
||||||
|
|
||||||
|
if [[ ! $(which rustup-init) =~ "homebrew" ]]; then
|
||||||
|
echo -e "\n🦀 ${underline}Upgrading rustup itself !${reset}\n"
|
||||||
|
rustup self update
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n🦀 ${underline}Upgrading rust toolchains !${reset}\n"
|
||||||
|
rustup update
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if hash cargo 2>/dev/null; then
|
||||||
|
|
||||||
|
echo -e "\n🦀 ${underline}Update cargo packages !${reset}\n"
|
||||||
|
if hash ggrep 2>/dev/null; then
|
||||||
|
cargo install $(cargo install --list | ggrep -E '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' ')
|
||||||
|
else
|
||||||
|
cargo install $(cargo install --list | egrep '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' ')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
101
plugins.d/venv.sh
Executable file
101
plugins.d/venv.sh
Executable file
@@ -0,0 +1,101 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Venv plugin for KYMSU
|
||||||
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
###############################################################################################
|
||||||
|
#
|
||||||
|
# Settings:
|
||||||
|
|
||||||
|
# Liste des apps:
|
||||||
|
# - le venv doit avoir le même nom que l'app
|
||||||
|
declare -a apps=("mkdocs")
|
||||||
|
|
||||||
|
# Liste des extensions pour Mkdocs
|
||||||
|
mkdocs_ext=("mkdocs-material" "mkdocs-material-extensions" "mkdocs-git-revision-date-localized-plugin" "mkdocs-minify-plugin" "fontawesome_markdown" "mkdocs-pdf-export-plugin")
|
||||||
|
|
||||||
|
echo -e "${bold}🐍 Update apps in Python virtuals environments ${reset}\n"
|
||||||
|
|
||||||
|
# Où sont stockés les environnements virtuels:
|
||||||
|
# macos: silverbook / airbook
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
v=$HOME/Documents/venv
|
||||||
|
|
||||||
|
# rpi4: linux_gnueabihf
|
||||||
|
# rpi3:
|
||||||
|
# solus: linux-gnu
|
||||||
|
|
||||||
|
elif [[ "$OSTYPE" == "linux_gnu" ]]; then
|
||||||
|
v=$HOME/Applications
|
||||||
|
|
||||||
|
elif [[ "$OSTYPE" == "linux_gnueabihf" ]]; then
|
||||||
|
v=$HOME/venv
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
|
echo -e "Exit !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "Venv directory: $v\n"
|
||||||
|
################################################################################################
|
||||||
|
|
||||||
|
for app in ${apps[*]}
|
||||||
|
do
|
||||||
|
echo -e "${bold}Update $app${reset}";
|
||||||
|
cd "$v/$app"
|
||||||
|
|
||||||
|
source bin/activate
|
||||||
|
python3 -V
|
||||||
|
pip3 install -U pip setuptools
|
||||||
|
|
||||||
|
pip3 install -U "$app"
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
# pas d'update: ret=0
|
||||||
|
#[ $ret -eq 0 ] && echo -e "${underline}\nNo update available !\n${reset}"
|
||||||
|
|
||||||
|
if [ $ret -eq 0 ]; then
|
||||||
|
echo -e "${underline}\nNo update available !\n${reset}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
info=$(pip3 show "$app")
|
||||||
|
l1=$(echo "$info" | sed -n '1p')
|
||||||
|
l1="\\\033[4m$l1\\\033[0m"
|
||||||
|
info=$(echo "$info" | sed "1s/.*/$l1/")
|
||||||
|
echo -e "$info"
|
||||||
|
|
||||||
|
<<COMMENT
|
||||||
|
# Update all modules:
|
||||||
|
pip_outdated=$(pip3 list --outdated --format columns)
|
||||||
|
upd=$(echo "$pip_outdated" | sed '1,2d' | awk '{print $1}')
|
||||||
|
outdated=""
|
||||||
|
for i in $upd
|
||||||
|
do
|
||||||
|
outdated+="$i "
|
||||||
|
done
|
||||||
|
outdated=$(echo "$outdated" | sed 's/.$//')
|
||||||
|
COMMENT
|
||||||
|
|
||||||
|
# Update mkdocs plugins & themes:
|
||||||
|
if [ $app == "mkdocs" ]; then
|
||||||
|
for i in ${mkdocs_ext[*]}
|
||||||
|
do
|
||||||
|
echo -e "\n${bold}Update $i:${reset}" && pip3 install -U $i
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
deactivate
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
@@ -34,6 +34,8 @@ admin=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=()
|
||||||
|
|
||||||
|
#[[ $@ =~ "-nodistract" || $@ =~ "-n" ]] && no_distract=true || no_distract=false
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]] || [[ $no_distract == true ]]; then
|
if [[ $1 == "--nodistract" ]] || [[ $no_distract == true ]]; then
|
||||||
no_distract=true
|
no_distract=true
|
||||||
prompt=
|
prompt=
|
||||||
|
|||||||
5
prefs_kymsu.sh
Executable file
5
prefs_kymsu.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source plugins.d/pip.sh
|
||||||
|
|
||||||
|
echo ${#do_not_update[*]}
|
||||||
Reference in New Issue
Block a user