Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf760c8b3a | |||
| 1f8e7c7c4d | |||
| 8497b0d0d5 | |||
| d076210d4f | |||
| ce5fa6e908 | |||
| 5dab2b9d33 | |||
| e8a6b02a95 | |||
| f354d0b699 | |||
| 4399d440ec | |||
| f678d88c78 | |||
| d0898cb1e4 |
11
README.md
11
README.md
@@ -2,6 +2,10 @@
|
|||||||
altKYMSU is a fork from **KYMSU** (Keep Your macOs Stuff Updated)
|
altKYMSU is a fork from **KYMSU** (Keep Your macOs Stuff Updated)
|
||||||
https://github.com/welcoMattic/kymsu
|
https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
|
Each plugin notifie you about available update and upgrade apps and packages.
|
||||||
|
|
||||||
|
homebrew and pecl plugins notifie you if apache/php configuration files have been modified.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Plug-ins:
|
## Plug-ins:
|
||||||
@@ -20,7 +24,12 @@ https://github.com/welcoMattic/kymsu
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- [Homebrew](https://brew.sh/)
|
- [Homebrew](https://brew.sh/)
|
||||||
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) for checking dependancies (pip plugin)
|
|
||||||
|
Optionnal:
|
||||||
|
|
||||||
|
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) *(pip install pipdeptree)* for checking dependancies (pip plugin)
|
||||||
|
- [jq](https://github.com/stedolan/jq) *(brew install jq)* for processing JSON data (homebrew plugin)
|
||||||
|
- [terminal-notifier](https://github.com/julienXX/terminal-notifier) *(brew install terminal-notifier)* for sending macOS notification (all plugins)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
plugins.d/error.png
Normal file
BIN
plugins.d/error.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -9,20 +9,40 @@
|
|||||||
# ou
|
# ou
|
||||||
# /usr/bin/find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | /usr/bin/xargs -0 /usr/bin/perl -i -0pe 's/depends_on macos: \[.*?\]//gsm;s/depends_on macos: .*//g'
|
# /usr/bin/find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | /usr/bin/xargs -0 /usr/bin/perl -i -0pe 's/depends_on macos: \[.*?\]//gsm;s/depends_on macos: .*//g'
|
||||||
|
|
||||||
#########################################
|
###############################################################################################
|
||||||
#
|
#
|
||||||
# Settings:
|
# Settings:
|
||||||
|
|
||||||
# Display info on updated pakages
|
# Display info on updated pakages
|
||||||
display_info=true
|
display_info=true
|
||||||
|
|
||||||
#add module to do_not_update array
|
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
||||||
declare -a do_not_update=('virtualbox,virtualbox-extension-pack')
|
# Also add package for prevent to update whitout pin it.
|
||||||
|
declare -a do_not_update=('')
|
||||||
|
|
||||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
||||||
no_distract=false
|
no_distract=false
|
||||||
#
|
#
|
||||||
#########################################
|
###############################################################################################
|
||||||
|
#
|
||||||
|
# Recommended software (brew install):
|
||||||
|
# -jq (Lightweight and flexible command-line JSON processor)
|
||||||
|
# -terminal-notifier (Send macOS User Notifications from the command-line)
|
||||||
|
#
|
||||||
|
###############################################################################################
|
||||||
|
|
||||||
|
notification() {
|
||||||
|
sound="Basso"
|
||||||
|
title="Homebrew"
|
||||||
|
#subtitle="Attention !!!"
|
||||||
|
message="$1"
|
||||||
|
image="error.png"
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifier)" ]; then
|
||||||
|
terminal-notifier -title "$title" -message "$message" -sound "$sound" -contentImage "$image"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
if [[ $1 == "--nodistract" ]]; then
|
||||||
no_distract=true
|
no_distract=true
|
||||||
@@ -34,45 +54,169 @@ brew update
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
brew_outdated=$(brew outdated)
|
# Pinned packages
|
||||||
upd3=$(echo "$brew_outdated" | awk '{print $1}')
|
|
||||||
|
|
||||||
#nb=$(echo $upd3 | wc -w)
|
brew_pinned=$(brew list --pinned | xargs)
|
||||||
|
#brew_pinned=`echo $brew_pinned | sed 's/ *$//g'`
|
||||||
|
#brew_pinned=`echo $brew_pinned | xargs`
|
||||||
|
|
||||||
|
if [ -n "$brew_pinned" ]; then
|
||||||
|
|
||||||
|
nbp=$(echo "$brew_pinned" | wc -w | xargs)
|
||||||
|
|
||||||
|
echo -e "\033[4mList of\033[0m \033[1;41m $nbp \033[0m \033[4mpinned packages:\033[0m"
|
||||||
|
echo -e "\033[1;31m$brew_pinned\033[0m"
|
||||||
|
echo "To update a pinned package, you need to un-pin it manually (brew unpin <formula>)"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# A pinned package is in 'brew outdated'
|
||||||
|
|
||||||
|
declare -A array_info
|
||||||
|
|
||||||
|
if [ -x "$(command -v jq)" ]; then
|
||||||
|
brew_outdated=$(brew outdated --json)
|
||||||
|
upd_json=$(echo "$brew_outdated" )
|
||||||
|
|
||||||
|
for row in $(jq -c '.[]' <<< "$upd_json");
|
||||||
|
do
|
||||||
|
name=$(echo "$row" | jq -j '.name, "\n"');
|
||||||
|
upd3+="$name "
|
||||||
|
done
|
||||||
|
upd3=$(echo "$upd3" | sed 's/.$//')
|
||||||
|
|
||||||
|
# Only 1 request 'brew info' for all updated packages
|
||||||
|
info=$(brew info --json=v1 $upd3)
|
||||||
|
|
||||||
|
i=0
|
||||||
|
for row in $(echo "${info}" | jq -r '.[] | @base64');
|
||||||
|
do
|
||||||
|
_jq() {
|
||||||
|
echo ${row} | base64 --decode | jq -r ${1}
|
||||||
|
}
|
||||||
|
|
||||||
|
name=$(_jq '.name')
|
||||||
|
homepage=$(_jq '.homepage')
|
||||||
|
# encoding to base64 to prevent errors with some characters (')
|
||||||
|
desc=$(_jq '.desc' | base64 --break=0) # BSD: break=0 GNU: wrap=0
|
||||||
|
pinned=$(_jq '.pinned')
|
||||||
|
installed_v=$(_jq '.installed[].version')
|
||||||
|
stable=$(_jq '.versions.stable')
|
||||||
|
#linked=$(_jq '.linked_keg')
|
||||||
|
|
||||||
|
eval "declare -a array_info$i=($name $homepage $desc $pinned $installed_v $stable)"
|
||||||
|
|
||||||
|
((i++))
|
||||||
|
done
|
||||||
|
nb=$i
|
||||||
|
i=0
|
||||||
|
|
||||||
|
else
|
||||||
|
brew_outdated=$(brew outdated)
|
||||||
|
upd3=$(echo "$brew_outdated" | awk '{print $1}')
|
||||||
|
|
||||||
|
info=$(brew info $upd3)
|
||||||
|
for i in $upd3
|
||||||
|
do
|
||||||
|
a=$(grep -A 3 "$i: stable" <<< "$info")
|
||||||
|
array_info["$i"]="$a"
|
||||||
|
done
|
||||||
|
nb=${#array_info[@]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get infos for all updated packages
|
||||||
|
|
||||||
if [ -n "$upd3" ]; then
|
if [ -n "$upd3" ]; then
|
||||||
|
|
||||||
|
# Display info on outdated packages
|
||||||
|
|
||||||
if [ "$display_info" = true ]; then
|
if [ "$display_info" = true ]; then
|
||||||
echo -e "\033[4mInfo on updated packages:\033[0m"
|
echo -e "\033[4mInfo on\033[0m \033[1;41m $nb \033[0m \033[4mupdated packages:\033[0m"
|
||||||
for pkg in $upd3
|
|
||||||
|
if [ -x "$(command -v jq)" ]; then
|
||||||
|
# ok avec jq installé
|
||||||
|
|
||||||
|
i=0
|
||||||
|
for row in $(jq -c '.[]' <<< "$upd_json");
|
||||||
do
|
do
|
||||||
|
|
||||||
# if jq (https://stedolan.github.io/jq/) is installed
|
name=$(echo "$row" | jq -j '.name, "\n"');
|
||||||
if [ -x "$(command -v jq)" ]; then
|
pinned=$(echo "$row" | jq -j '.pinned, "\n"');
|
||||||
info_pkg=$(brew info --json=v1 "$pkg")
|
pinned_v=$(echo "$row" | jq -j '.pinned_version, "\n"');
|
||||||
current=$(echo "$info_pkg" | jq -r .[].installed[].version | tail -n 1 | awk '{print $1}')
|
iv=$(echo "$row" | jq -j '.installed_versions, "\n"');
|
||||||
stable=$(echo "$info_pkg" | jq -r .[].versions.stable)
|
installed_v=$(echo "$iv" | jq -j '.[]');
|
||||||
homepage=$(echo "$info_pkg" | jq -r .[].homepage)
|
current_v=$(echo "$row" | jq -j '.current_version, "\n"');
|
||||||
desc=$(echo "$info_pkg" | jq -r .[].desc)
|
|
||||||
|
|
||||||
echo -e "\033[1m$pkg:\033[0m current: $current last: $stable"
|
#n="array_info$i[0]"
|
||||||
echo "$desc"
|
#name=$(echo ${!n})
|
||||||
echo "$homepage"
|
h="array_info$i[1]"
|
||||||
|
homepage=$(echo ${!h})
|
||||||
|
d="array_info$i[2]"
|
||||||
|
desc=$(echo ${!d} | base64 --decode)
|
||||||
|
|
||||||
|
#info_pkg=$(brew info --json=v1 "$name")
|
||||||
|
#homepage=$(echo "$info_pkg" | jq -r .[].homepage)
|
||||||
|
#desc=$(echo "$info_pkg" | jq -r .[].desc)
|
||||||
|
#current=$(echo "$info_pkg" | jq -r .[].installed[].version | tail -n 1 | awk '{print $1}')
|
||||||
|
#stable=$(echo "$info_pkg" | jq -r .[].versions.stable)
|
||||||
|
#pined=$(echo "$info_pkg" | jq -r .[].pinned)
|
||||||
|
|
||||||
|
upd+="$name "
|
||||||
|
|
||||||
|
if [ "$pinned" = "true" ]; then echo -e "\033[1;31m$name: installed: $installed_v stable: $current_v [pinned at $pinned_v]\033[0m";
|
||||||
|
else echo -e "\033[1;37m$name: installed: $installed_v stable: $current_v\033[0m";
|
||||||
|
fi
|
||||||
|
if [ "$desc" != "null" ]; then echo "$desc"; fi;
|
||||||
|
echo -e "\033[4m$homepage\033[0m"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
((i++))
|
||||||
|
done
|
||||||
|
upd3=$upd
|
||||||
else
|
else
|
||||||
info=$(brew info $pkg | head -n 4)
|
# ok sans jq
|
||||||
ligne1=$(echo "$info" | head -n 1)
|
|
||||||
|
|
||||||
|
for pkg in $upd3
|
||||||
|
do
|
||||||
|
info_pkg="${array_info[$pkg]}"
|
||||||
|
ligne1=$(echo "$info_pkg" | head -n 1)
|
||||||
|
desc=$(echo "$info_pkg"| sed '1d')
|
||||||
|
|
||||||
|
if [[ $ligne1 =~ "pinned" ]]; then # same as if [[ $ligne1 == *"pinned"* ]]; then
|
||||||
|
echo -e "\033[1;31m$ligne1\033[0m"
|
||||||
|
else
|
||||||
echo -e "\033[1m$ligne1\033[0m"
|
echo -e "\033[1m$ligne1\033[0m"
|
||||||
echo "$info" | sed -n -e '2,3p'
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$desc"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Usefull for notify recent modification of apache/mysql/php conf files.
|
||||||
|
touch /tmp/checkpoint
|
||||||
|
|
||||||
|
# Remove pinned packages from outdated packages list
|
||||||
|
|
||||||
|
not_pinned=""
|
||||||
|
for i in $upd3
|
||||||
|
do
|
||||||
|
if [[ $brew_pinned != *"$i"* ]]; then
|
||||||
|
not_pinned+="$i "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
not_pinned=$(echo "$not_pinned" | sed 's/.$//')
|
||||||
|
|
||||||
|
# Update outdated packages
|
||||||
|
|
||||||
if [ "$no_distract" = false ]; then
|
if [ "$no_distract" = false ]; then
|
||||||
|
|
||||||
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$upd3"\033[0m? (y/n)")
|
if [ -n "$not_pinned" ]; then
|
||||||
|
|
||||||
|
a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$not_pinned"\033[0m ? (y/n)")
|
||||||
read -p "$a" choice
|
read -p "$a" choice
|
||||||
#case "$choice" in
|
#case "$choice" in
|
||||||
# y|Y ) echo "$brew_outdated" | awk '{print $1}' | xargs -p -n 1 brew upgrade ;;
|
# y|Y ) echo "$brew_outdated" | awk '{print $1}' | xargs -p -n 1 brew upgrade ;;
|
||||||
@@ -82,26 +226,38 @@ if [ -n "$upd3" ]; then
|
|||||||
|
|
||||||
if [ "$choice" == "y" ]; then
|
if [ "$choice" == "y" ]; then
|
||||||
|
|
||||||
for i in $upd3
|
for i in $not_pinned
|
||||||
do
|
do
|
||||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||||
if [ "${FOUND}" = "" ]; then
|
if [ "${FOUND}" = "" ]; then
|
||||||
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew upgrade
|
echo "$i" | awk '{print $1}' | xargs -p -n 1 brew upgrade
|
||||||
|
#echo "Running update package $i "
|
||||||
|
#fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Ok, let's continue"
|
echo "Ok, let's continue"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
echo "No package to update"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$brew_outdated" | awk '{print $1}' | xargs -n 1 brew upgrade
|
else # no distract = true
|
||||||
|
|
||||||
|
if [ -n "$not_pinned" ]; then
|
||||||
|
echo "$not_pinned" | awk '{print $1}' | xargs -n 1 brew upgrade
|
||||||
|
#echo "Running update package $not_pinned"
|
||||||
|
else
|
||||||
|
echo "No package to update"
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Casks
|
||||||
|
|
||||||
echo "🍺 Casks upgrade."
|
echo "🍺 Casks upgrade."
|
||||||
|
|
||||||
cask_outdated=$(brew cask outdated --greedy --verbose)
|
cask_outdated=$(brew cask outdated --greedy --verbose)
|
||||||
@@ -148,21 +304,44 @@ if [ -n "$latest" ] && [ "$no_distract" = false ]; then
|
|||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "🍺 ️The Doc is checking that everything is ok."
|
|
||||||
brew doctor
|
|
||||||
brew missing
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# Test if Apache conf file has been modified by Homebrew (Apache, PHP or Python updates)
|
# Test if Apache conf file has been modified by Homebrew (Apache, PHP or Python updates)
|
||||||
|
|
||||||
v_apa=$(httpd -V | grep 'SERVER_CONFIG_FILE')
|
v_apa=$(httpd -V | grep 'SERVER_CONFIG_FILE')
|
||||||
conf_apa=$(echo "$v_apa" | awk -F "\"" '{print $2}')
|
conf_apa=$(echo "$v_apa" | awk -F "\"" '{print $2}')
|
||||||
dir=$(dirname $conf_apa)
|
dir=$(dirname $conf_apa)
|
||||||
name=$(basename $conf_apa)
|
name=$(basename $conf_apa)
|
||||||
|
notif1="$dir has been modified in the last 5 minutes"
|
||||||
|
|
||||||
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
||||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$name was modified in the last 5 minutes\033[0m"
|
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$notif1\033[0m"
|
||||||
|
[ ! -z $test ] && notification "$notif1"
|
||||||
|
|
||||||
|
# Test if PHP.ini file has been modified by Homebrew (PECL)
|
||||||
|
|
||||||
|
php_versions=$(ls /usr/local/etc/php/)
|
||||||
|
for php in $php_versions
|
||||||
|
do
|
||||||
|
# file modified since it was last read
|
||||||
|
#if [ -N /usr/local/etc/php/$php/php.ini ]; then echo "modified"; fi
|
||||||
|
|
||||||
|
php_modified=$(find /usr/local/etc/php/$php/ -name php.ini -newer /tmp/checkpoint)
|
||||||
|
php_ini=/usr/local/etc/php/$php/php.ini
|
||||||
|
notif2="$php_ini has been modified"
|
||||||
|
|
||||||
|
[ ! -z $php_modified ] && echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
||||||
|
[ ! -z $php_modified ] && notification "$notif2"
|
||||||
|
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Doctor
|
||||||
|
|
||||||
|
echo "🍺 ️The Doc is checking that everything is ok."
|
||||||
|
brew doctor
|
||||||
|
brew missing
|
||||||
|
status=$?
|
||||||
|
if [ $status -ne 0 ]; then brew missing --verbose; fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
# Homebrew 2.0.0+ run a cleanup every 30 days
|
# Homebrew 2.0.0+ run a cleanup every 30 days
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ version=pip3
|
|||||||
now=$(date +"%d-%m-%Y_%T")
|
now=$(date +"%d-%m-%Y_%T")
|
||||||
mac=$(hostname -s)
|
mac=$(hostname -s)
|
||||||
file=$mac"@"$now
|
file=$mac"@"$now
|
||||||
#echo "$file"
|
|
||||||
filename="Installed_$file"
|
filename="Installed_$file"
|
||||||
|
|
||||||
echo -e "\033[1m🛠 Installed \033[0m"
|
echo -e "\033[1m🛠 Installed \033[0m"
|
||||||
@@ -33,151 +32,174 @@ fi
|
|||||||
|
|
||||||
if [ -f Brewfile ]; then
|
if [ -f Brewfile ]; then
|
||||||
echo -e "The \033[93mBrewfile\033[0m already exist! We rename it."
|
echo -e "The \033[93mBrewfile\033[0m already exist! We rename it."
|
||||||
bf=$(find . -name 'Brewfile_*' -maxdepth 1 | xargs rm)
|
find . -name 'Brewfile_*' -maxdepth 1 -print0 | xargs rm
|
||||||
d=$(date -r Brewfile "+%m-%d-%Y_%H:%M:%S")
|
d=$(date -r Brewfile "+%d-%m-%Y_%H:%M:%S")
|
||||||
|
|
||||||
mv Brewfile "Brewfile_$mac@$d"
|
mv Brewfile "Brewfile_$mac@$d"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '# Apps, package, scripts installed:' > Installed.md
|
{
|
||||||
echo "<u>"$mac"@"$now"</u>" >> Installed.md
|
echo '# Apps, package, scripts installed:'
|
||||||
echo '' >> Installed.md
|
echo "*$mac@$now*"
|
||||||
|
echo ''
|
||||||
|
|
||||||
echo '[TOC]' >> Installed.md
|
echo '[TOC]'
|
||||||
echo '' >> Installed.md
|
echo ''
|
||||||
|
|
||||||
# Homebrew
|
# Homebrew
|
||||||
|
|
||||||
echo '## Homebrew' >> Installed.md
|
echo '## 🍺 Homebrew'
|
||||||
echo '' >> Installed.md
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list"
|
echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list"
|
||||||
|
|
||||||
echo '### Tap:' >> Installed.md
|
echo '### Tap:' >> Installed.md
|
||||||
tap=$(brew tap)
|
tap=$(brew tap)
|
||||||
echo "\`\`\`bash" >> Installed.md
|
{
|
||||||
echo "$tap" >> Installed.md
|
echo "\`\`\`bash"
|
||||||
echo "\`\`\`" >> Installed.md
|
echo "$tap"
|
||||||
echo "" >> Installed.md
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list"
|
echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list"
|
||||||
|
|
||||||
echo '### Packages:' >> Installed.md
|
echo '### Packages:' >> Installed.md
|
||||||
brew=$(brew list)
|
brew=$(brew list)
|
||||||
echo "\`\`\`bash" >> Installed.md
|
{
|
||||||
echo "$brew" >> Installed.md
|
echo "\`\`\`bash"
|
||||||
echo "\`\`\`" >> Installed.md
|
echo "$brew"
|
||||||
echo "" >> Installed.md
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
echo -e "🍺 Get Homebrew \033[3m\033[93mCask\033[0m installed list"
|
echo -e "🍺 Get Homebrew \033[3m\033[93mCask\033[0m installed list"
|
||||||
|
|
||||||
echo '### Casks:' >> Installed.md
|
echo '### Casks:' >> Installed.md
|
||||||
cask=$(brew cask list)
|
cask=$(brew cask list)
|
||||||
echo "\`\`\`bash" >> Installed.md
|
{
|
||||||
echo "$cask" >> Installed.md
|
echo "\`\`\`bash"
|
||||||
echo "\`\`\`" >> Installed.md
|
echo "$cask"
|
||||||
echo "" >> Installed.md
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
# liste des apps de l'Appstore installées (nom & numéro)
|
# liste des apps de l'Appstore installées (nom & numéro)
|
||||||
|
|
||||||
echo -e "🍏 Get mas \033[3m\033[93mApp Store applications\033[0m list"
|
echo -e "🍏 Get mas \033[3m\033[93mApp Store applications\033[0m list"
|
||||||
|
|
||||||
echo '## mas (Mac App Store)' >> Installed.md
|
echo '## 🍏 mas (Mac App Store)' >> Installed.md
|
||||||
echo '' >> Installed.md
|
echo '' >> Installed.md
|
||||||
|
|
||||||
appfrommas=$(mas list)
|
appfrommas=$(mas list | sort -k2)
|
||||||
#echo "$appfrommas"
|
#echo "$appfrommas"
|
||||||
#declare -a appstore
|
#declare -a appstore
|
||||||
echo "\`\`\`bash" >> Installed.md
|
echo "\`\`\`bash" >> Installed.md
|
||||||
# todo: trier la liste par nom
|
# todo: trier la liste par nom
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
number=$(echo "$line" | awk '{print $1}')
|
number=$(echo "$line" | awk '{print $1}')
|
||||||
name=$(echo "$line" | awk -F "(" '{print $1}' | awk {'first = $1; $1=""; print $0'} | sed 's/^ //g')
|
#name=$(echo "$line" | awk -F "(" '{print $1}' | awk {'first = $1; $1=""; print $0'} | sed 's/^ //g')
|
||||||
|
name=$(echo "$line" | awk -F "(" '{print $1}' | awk '{first = $1; $1=""; print $0}' | sed 's/^ //g')
|
||||||
echo "$name ($number)" >> Installed.md
|
echo "$name ($number)" >> Installed.md
|
||||||
#echo " " >> Installed.md
|
#echo " " >> Installed.md
|
||||||
#appstore["$name"]="${number}"
|
#appstore["$name"]="${number}"
|
||||||
done <<< "$appfrommas"
|
done <<< "$appfrommas"
|
||||||
echo "\`\`\`" >> Installed.md
|
{
|
||||||
echo "" >> Installed.md
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
# Extensions PHP PECL
|
# Extensions PHP PECL
|
||||||
|
|
||||||
echo -e "🐘 Get PECL \033[3m\033[93mPHP extensions\033[0m list"
|
echo -e "🐘 Get PECL \033[3m\033[93mPHP extensions\033[0m list"
|
||||||
|
|
||||||
echo '## PECL extensions' >> Installed.md
|
echo '## 🐘 PECL extensions' >> Installed.md
|
||||||
echo '' >> Installed.md
|
echo '' >> Installed.md
|
||||||
|
|
||||||
ext_pecl=$(pecl list | sed '1,3d' | awk '{print $1}')
|
ext_pecl=$(pecl list | sed '1,3d' | awk '{print $1}')
|
||||||
echo "\`\`\`bash" >> Installed.md
|
{
|
||||||
echo "$ext_pecl" >> Installed.md
|
echo "\`\`\`bash"
|
||||||
echo "\`\`\`" >> Installed.md
|
echo "$ext_pecl"
|
||||||
echo "" >> Installed.md
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
# Python packages (pip)
|
# Python packages (pip)
|
||||||
|
|
||||||
echo -e "🐍 Get pip \033[3m\033[93mPython 3 packages\033[0m installed list"
|
echo -e "🐍 Get pip \033[3m\033[93mPython 3 packages\033[0m installed list"
|
||||||
echo '## Python packages' >> Installed.md
|
echo '## 🐍 Python packages' >> Installed.md
|
||||||
echo '' >> Installed.md
|
echo '' >> Installed.md
|
||||||
|
|
||||||
pip_packages=$($version list | sed '1,2d' | awk '{print $1}')
|
pip_packages=$($version list | sed '1,2d' | awk '{print $1}')
|
||||||
echo "\`\`\`bash" >> Installed.md
|
{
|
||||||
echo "$pip_packages" >> Installed.md
|
echo "\`\`\`bash"
|
||||||
echo "\`\`\`" >> Installed.md
|
echo "$pip_packages"
|
||||||
echo '' >> Installed.md
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
# atom
|
# atom
|
||||||
|
|
||||||
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"
|
||||||
echo '## Atom packages' >> Installed.md
|
|
||||||
echo '' >> Installed.md
|
|
||||||
|
|
||||||
atom=$(apm list | grep 'Community Packages' -A 100 | sed '1,1d')
|
atom=$(apm list | grep 'Community Packages' -A 100 | sed '1,1d')
|
||||||
|
{
|
||||||
|
echo '## ⚛️ Atom packages'
|
||||||
|
echo ''
|
||||||
|
echo "\`\`\`bash"
|
||||||
|
|
||||||
echo "\`\`\`bash" >> Installed.md
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
a=$(echo "$line" | awk -F "@" '{print $1}')
|
a=$(echo "$line" | awk -F "@" '{print $1}' | awk '{print $2}' )
|
||||||
atom_pkg=${a:4}
|
#atom_pkg=${a:4}
|
||||||
echo "$atom_pkg" >> "$chemin/Installed.md"
|
echo "$a"
|
||||||
done <<< "$atom"
|
done <<< "$atom"
|
||||||
echo "\`\`\`" >> Installed.md
|
|
||||||
echo '' >> Installed.md
|
|
||||||
|
|
||||||
|
echo "\`\`\`"
|
||||||
|
echo ""
|
||||||
|
echo ''
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
# Node.js packages (npm)
|
# Node.js packages (npm)
|
||||||
|
|
||||||
echo '## Node.js packages' >> Installed.md
|
|
||||||
echo '' >> Installed.md
|
|
||||||
|
|
||||||
echo -e "🌿 Get npm \033[3m\033[93m node global packages\033[0m installed scripts"
|
echo -e "🌿 Get npm \033[3m\033[93m node global packages\033[0m installed scripts"
|
||||||
echo '### Global:' >> Installed.md
|
pkg_global_npm=$(npm list -g --depth=0 --silent | sed '1d' | awk '{print $2}' | awk -F "@" '{print $1}')
|
||||||
|
|
||||||
pkg_global_npm=$(npm list -g --depth=0 --silent | sed '1,2d' | awk '{print $2}' | awk -F "@" '{print $1}')
|
{
|
||||||
echo "\`\`\`bash" >> Installed.md
|
echo '## 🌿 Node.js packages'
|
||||||
echo "$pkg_global_npm" >> Installed.md
|
echo ''
|
||||||
echo "\`\`\`" >> Installed.md
|
|
||||||
|
echo '### Global:'
|
||||||
|
|
||||||
|
echo "\`\`\`bash"
|
||||||
|
echo "$pkg_global_npm"
|
||||||
|
echo "\`\`\`"
|
||||||
|
} >> Installed.md
|
||||||
|
|
||||||
#echo "$local_path"
|
|
||||||
if [ -d "$local_path" ]; then
|
if [ -d "$local_path" ]; then
|
||||||
cd $local_path
|
cd "$local_path" || exit
|
||||||
|
|
||||||
echo -e "🌿 Get npm \033[3m\033[93m node local packages\033[0m installed scripts"
|
echo -e "🌿 Get npm \033[3m\033[93m node local packages\033[0m installed scripts"
|
||||||
echo '### Local:' >> "$chemin/Installed.md"
|
echo '### Local:' >> "$chemin/Installed.md"
|
||||||
|
|
||||||
pkg_local=$(npm ls | sed '1,1d' | grep -v 'deduped')
|
pkg_local=$(npm ls | sed '1d' | grep -v 'deduped')
|
||||||
|
|
||||||
echo "\`\`\`bash" >> "$chemin/Installed.md"
|
{
|
||||||
|
echo "\`\`\`bash"
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
a=$(echo "$line" | awk -F "@" '{print $1}')
|
pkg_local_npm=$(echo "$line" | sed 's/[│ └──├┬]//g' | awk -F "@" '{print $1}')
|
||||||
pkg_local_npm=${a:4}
|
echo "$pkg_local_npm"
|
||||||
echo "$pkg_local_npm" >> "$chemin/Installed.md"
|
|
||||||
done <<< "$pkg_local"
|
done <<< "$pkg_local"
|
||||||
echo "\`\`\`" >> "$chemin/Installed.md"
|
echo "\`\`\`"
|
||||||
|
} >> "$chemin/Installed.md"
|
||||||
|
|
||||||
cd $chemin
|
|
||||||
|
cd "$chemin" || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "" >> Installed.md
|
echo "" >> Installed.md
|
||||||
@@ -193,6 +215,10 @@ echo ''
|
|||||||
echo -e "To restore everything listed in that file, run \033[3m\033[93m'$ brew bundle'\033[0m in folder that contains the Brewfile."
|
echo -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 ''
|
||||||
|
|
||||||
|
#iconv -f macroman -t utf-8 Installed.md > Installed-utf8.md
|
||||||
|
#mv Installed-utf8.md "$filename".md
|
||||||
|
#rm Installed.md
|
||||||
|
|
||||||
mv Installed.md "$filename".md
|
mv Installed.md "$filename".md
|
||||||
|
|
||||||
open "$filename".md
|
open "$filename".md
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ if hash mas 2>/dev/null; then
|
|||||||
echo ""
|
echo ""
|
||||||
echo "$massy"
|
echo "$massy"
|
||||||
|
|
||||||
#if [ -n "$massy" ]; then
|
if [ -n "$(mas outdated)" ]; then
|
||||||
if [ ! -z "$(mas outdated)" ]; then
|
|
||||||
echo -e "\033[4mAvailables updates:\033[0m"
|
echo -e "\033[4mAvailables updates:\033[0m"
|
||||||
echo "$massy" | cut -d " " -f2-5
|
echo "$massy" | cut -d " " -f2-5
|
||||||
echo ""
|
echo ""
|
||||||
@@ -28,7 +27,7 @@ if hash mas 2>/dev/null; then
|
|||||||
if [ "$no_distract" = false ]; then
|
if [ "$no_distract" = false ]; 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\033[0m ? (y/n)")
|
||||||
read -p "$a" choice
|
read -pr "$a" choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y|o ) mas upgrade;;
|
y|Y|o ) mas upgrade;;
|
||||||
n|N ) echo "Ok, let's continue";;
|
n|N ) echo "Ok, let's continue";;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ echo
|
|||||||
|
|
||||||
# Local packages
|
# Local packages
|
||||||
if [ -d "$local_path" ]; then
|
if [ -d "$local_path" ]; then
|
||||||
cd $local_path
|
cd "$local_path" || return
|
||||||
echo -e "\033[4m🌿 Local installed scripts:\033[0m"
|
echo -e "\033[4m🌿 Local installed scripts:\033[0m"
|
||||||
npm ls
|
npm ls
|
||||||
outdated=$(npm outdated)
|
outdated=$(npm outdated)
|
||||||
|
|||||||
@@ -14,6 +14,19 @@ no_distract=false
|
|||||||
#
|
#
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
|
notification() {
|
||||||
|
sound="Basso"
|
||||||
|
title="Homebrew"
|
||||||
|
#subtitle="Attention !!!"
|
||||||
|
message="$1"
|
||||||
|
image="error.png"
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifier)" ]; then
|
||||||
|
terminal-notifier -title "$title" -message "$message" -sound "$sound" -contentImage "$image"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [[ $1 == "--nodistract" ]]; then
|
if [[ $1 == "--nodistract" ]]; then
|
||||||
no_distract=true
|
no_distract=true
|
||||||
fi
|
fi
|
||||||
@@ -59,14 +72,28 @@ 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
|
||||||
|
|
||||||
# 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')
|
||||||
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"
|
||||||
|
|
||||||
test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
test=$(find "$dir" -name "$name" -mmin -50000 -maxdepth 1)
|
||||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$name was modified in the last 5 minutes\033[0m"
|
|
||||||
|
if [ -n "$test" ]; then
|
||||||
|
echo -e "\033[1;31m❗️ ️$notif2\033[0m"
|
||||||
|
notification "$notif2"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
a=$(echo -e "Do you want to edit \033[1m$conf_php\033[0m file ? (y/n)")
|
||||||
|
read -p "$a" choice
|
||||||
|
if [ "$choice" == "y" ]; then
|
||||||
|
$EDITOR "$conf_php"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ if [ -n "$upd" ]; then
|
|||||||
|
|
||||||
for i in $upd
|
for i in $upd
|
||||||
do
|
do
|
||||||
info=$($version show $i)
|
info=$($version show "$i")
|
||||||
#info=$($version show $i | sed -n 4q)
|
#info=$($version show $i | sed -n 4q)
|
||||||
#info=$($version show $i | head -5)
|
#info=$($version show $i | head -5)
|
||||||
#info=$($version show $i | tail -n +5)
|
#info=$($version show $i | tail -n +5)
|
||||||
@@ -80,7 +80,7 @@ if [ -n "$upd" ]; then
|
|||||||
|
|
||||||
else
|
else
|
||||||
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
|
||||||
read -p "$c" choice
|
read -pr "$c" choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y|o ) $version install $user pipdeptree ;;
|
y|Y|o ) $version install $user pipdeptree ;;
|
||||||
n|N ) echo "Ok, let's continue";;
|
n|N ) echo "Ok, let's continue";;
|
||||||
@@ -94,10 +94,10 @@ if [ -n "$upd" ]; then
|
|||||||
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
FOUND=`echo ${do_not_update[*]} | grep "$i"`
|
||||||
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
|
if [ "${FOUND}" = "" ] && [ "$no_distract" = false ]; then
|
||||||
|
|
||||||
b=$(echo -e "Do you wanna run \033[1m$version install $user --upgrade "$i"\033[0m ? (y/n)")
|
b=$(echo -e "Do you wanna run \033[1m$version install $user --upgrade $i\033[0m ? (y/n)")
|
||||||
read -p "$b" choice
|
read -p "$b" choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y|Y|o ) echo $i | xargs $version install $user --upgrade ;;
|
y|Y|o ) echo "$i" | xargs $version install $user --upgrade ;;
|
||||||
n|N ) echo "Ok, let's continue";;
|
n|N ) echo "Ok, let's continue";;
|
||||||
* ) echo "invalid";;
|
* ) echo "invalid";;
|
||||||
esac
|
esac
|
||||||
@@ -105,7 +105,7 @@ if [ -n "$upd" ]; then
|
|||||||
|
|
||||||
elif [ "${FOUND}" = "" ]; then
|
elif [ "${FOUND}" = "" ]; then
|
||||||
|
|
||||||
echo $i | xargs $version install $user --upgrade
|
echo "$i" | xargs $version install $user --upgrade
|
||||||
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user