Dossier test

This commit is contained in:
2018-03-12 06:25:43 +01:00
parent 7ea415b906
commit bca8a94150
10 changed files with 218 additions and 0 deletions

30
_test/_cask.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
echo "🍺 Casks upgrade."
cask_outdated=$(brew cask outdated --greedy --verbose)
outdated=$(echo "$cask_outdated" | grep -v '(latest)')
if [ -n "$outdated" ]; then
echo "$outdated"
echo "$outdated" | awk '{print $1}' | awk '{print $1}' | xargs brew cask reinstall
else
echo -e "\033[4mNo availables Cask updates.\033[0m"
fi
echo ""
latest=$(echo "$cask_outdated" | grep '(latest)')
if [ -n "$latest" ]; then
echo -e "\033[4mCasks (latest):\033[0m"
echo "$latest" | cut -d " " -f1,2
echo ""
read -p "Do you wanna run Cask (latest) upgrade? (y/n)" choice
case "$choice" in
y|Y|o ) echo "$latest" | awk '{print $1}' | xargs -p -n 1 brew cask upgrade --greedy ;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
fi

22
_test/_mas_test.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
if [[ "${1}" == "latest" ]]; then
echo "mas"
fi
echo "🍏 Mac App Store updates come fast as lightning"
#mas outdated
massy=`mas outdated`
echo ""
if [ -n "$massy" ]; then
#if [ $massy != 0 ]; then
read -p "Do you wanna run mas upgrade? (y/n)" choice
case "$choice" in
y|Y|o ) mas upgrade;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
echo ""
fi

12
_test/_mkdocs.command Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
#MkDocs
cd /Users/bruno/project
mkdocs build
#noti -t 'MkDocs' -m 'Upload termine' scp -P42666 -r ./central_docs bruno@192.168.1.7:/volume1/web
scp -P42666 -r ./central_docs bruno@192.168.1.7:/volume1/web
#scp -P42666 -r ./central_docs bruno@clicclac.synology.me:/volume1/web
#rsync -rav -e ssh ./central_docs bruno@192.168.1.7:/volume1/web/tt
terminal-notifier -title 'MkDocs' -message 'Envoi terminé !' -sound 'Glass'
exit

9
_test/_mkdocs.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
cd /Users/bruno/project
mkdocs build
#noti -t 'MkDocs' -m 'Upload termine' scp -P42666 -r ./central_docs bruno@192.168.1.7:/volume1/web
scp -P42666 -r ./central_docs bruno@192.168.1.7:/volume1/web
terminal-notifier -title 'MkDocs' -message 'Envoi terminé !' -sound 'Glass'
#scp -P42666 -r ./central_docs bruno@clicclac.synology.me:/volume1/web
#rsync -rav -e ssh ./central_docs bruno@192.168.1.7:/volume1/web/tt

17
_test/_pip.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
echo "🐍 pip"
echo ""
echo "🐍 update pip (Python 2)(macOS)"
echo ""
pip install --user --upgrade pip
pip install --user --upgrade mkdocs
pip install --user --upgrade mkdocs-material
pip list --outdated --format=columns
echo ""
echo "🐍 update pip3 (Python 3)(Homebrew)"
echo ""
pip3 install --upgrade pip
pip3 install --upgrade mkdocs
pip3 install --upgrade mkdocs-material
pip3 list --outdated --format=columns
echo ""

70
_test/_pip2.sh Executable file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env bash
echo "🐍 pip"
echo ""
<<COMMENT
echo "🐍 update pip (Python 2)(macOS)"
echo ""
pip install --user --upgrade pip
#pip install --user --upgrade mkdocs
#pip install --user --upgrade mkdocs-material
echo ""
pip_outdated=$(pip list --outdated --format=freeze)
upd=$(echo $pip_outdated | tr [:space:] '\n' | awk -F== '{print $1}')
if [ -n "$upd" ]; then
echo -e "\033[4mAvailables updates:\033[0m"
echo $pip_outdated | tr [:space:] '\n'
echo ""
a=$(echo -e "Do you wanna run \033[1mpip install --user --upgrade "$upd"\033[0m ? (y/n)")
read -p "$a" choice
case "$choice" in
y|Y|o ) echo $upd | xargs -p -n 1 pip install --user --upgrade ;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
else
echo -e "\033[4mNo availables updates.\033[0m"
fi
echo ""
COMMENT
echo "🐍 update pip3 (Python 3)(Homebrew)"
echo ""
pip3 install --upgrade pip
#pip3 install --upgrade mkdocs
#pip3 install --upgrade mkdocs-material
echo ""
pip3_outdated=$(pip3 list --outdated --format=freeze)
upd3=$(echo $pip3_outdated | tr [:space:] '\n' | awk -F== '{print $1}')
if [ -n "$upd3" ]; then
echo -e "\033[4mAvailables updates:\033[0m"
echo $pip3_outdated | tr [:space:] '\n'
echo ""
a=$(echo -e "Do you wanna run \033[1mpip3 install --upgrade "$upd3"\033[0m ? (y/n)")
read -p "$a" choice
case "$choice" in
y|Y|o ) echo $upd3 | xargs -p -n 1 pip3 install --upgrade ;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
else
echo -e "\033[4mNo availables updates.\033[0m"
fi
echo ""
#pip install --upgrade packaging Sphinx ? (y/n)n
#python 2 : packaging installé global

67
_test/_pip_upd.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/usr/bin/env bash
echo "🐍 pip"
echo ""
echo "🐍 update pip3 (Python 3)(Homebrew)"
echo ""
# Fichier temp:
pip3 list --outdated --format=freeze > pip.txt
if [ $(cat pip.txt | wc -l) -gt 0 ]; then
pip_outdated=$(cat pip.txt | awk -F== '{print $1}')
echo -e "\033[4mAvailables updates:\033[0m"
cat pip.txt
b=$(echo -e "Do you wanna run \033[1mpip install --upgrade "$pip_outdated"\033[0m ? (y/n)")
read -p "$b" choice
case "$choice" in
y|Y|o ) cat pip.txt | awk -F== '{print $1}' | tr [:space:] '\n' | xargs -p -n 1 touch;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
echo ""
rm pip.txt
else
echo -e "\033[4mNo availables updates.\033[0m"
fi
# Variable:
pip3_outdated=$(pip3 list --outdated --format=freeze)
upd3=$(echo $pip3_outdated | tr [:space:] '\n' | awk -F== '{print $1}')
if [ -n "$upd3" ]; then
echo -e "\033[4mAvailables updates:\033[0m"
echo $pip3_outdated | tr [:space:] '\n'
echo ""
a=$(echo -e "Do you wanna run \033[1mpip3 install --upgrade "$upd3"\033[0m ? (y/n)")
read -p "$a" choice
case "$choice" in
y|Y|o ) echo $upd3 | xargs -p -n 1 pip3 install --upgrade ;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
else
echo -e "\033[4mNo availables updates.\033[0m"
fi
echo ""
#pip_outdated=$(echo $(pip3 list --outdated --format=freeze) | tr [:space:] '\n')
#echo $pip_outdated
#pip freeze > requirements.txt && pip install --upgrade -r requirements.txt && rm requirements.txt
#pip3 list --outdated --format=freeze | awk -F== '{print $1}' | xargs -n1 -p pip install --upgrade

17
_test/_test.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
APACHE=$(httpd -v | grep "version" | awk '{print $3}' | awk -F/ '{print $2}')
PHP=$(php -v | grep "cli" | awk '{print $2}')
#echo $APACHE
#echo $PHP
cd /Users/bruno/Documents/config\ web\ \(homebrew\)/
if [ ! -d "apache $APACHE" ]; then mkdir "apache $APACHE"; fi
cp /usr/local/etc/httpd/httpd.conf /Users/bruno/Documents/config\ web\ \(homebrew\)/apache\ $APACHE/
cp /usr/local/etc/httpd/extra/httpd-vhosts.conf /Users/bruno/Documents/config\ web\ \(homebrew\)/apache\ $APACHE/
if [ ! -d "php $PHP" ]; then mkdir "php $PHP"; fi
cp /usr/local/etc/php/7.2/php.ini /Users/bruno/Documents/config\ web\ \(homebrew\)/php\ $PHP/

12
_test/param.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
if [[ "${1}" == "latest" ]]; then
echo $1
fi
#[ -d ~/.kymsu/plugins.d -a -x ~/.kymsu/plugins.d ] && find ~/.kymsu/plugins.d -type f -name '*.sh' -perm +u+x -exec bash -c {} ${1:no-cleanup} \;
find . -type f -name '_mas*.sh' -perm +u+x -exec bash -c {} "$1" \;
#find ~/.kymsu/plugins.d -type f -name '_m*.sh' -perm +u+x | xargs exec "$1" ;

37
_test/update.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
if [ "$1" == "-h" ]; then
echo "Colorful Homebrew update script"
echo
echo "USAGE: update [-y]"
echo
echo " -y skip questions"
echo " -h display this help"
echo
exit 0
fi
echo "\033[93mFetching packages list:\033[0m"
brew update
brewsy=`brew outdated | wc -l | awk {'print $1'}`
if [ $brewsy != 0 ]; then
echo "\033[93mOutdated packages:\033[0m" $brewsy
echo
brew outdated
echo
if [ "$1" != "-y" ]; then
ask=$(echo "\033[93mUpdate the these packages?\033[92m [y/n] \033[0m")
read -p "$ask" yn
fi
if [ "$yn" = "y" ]; then
#brew upgrade --all && brew cleanup
echo "\033[93mbrew upgrade\033[0m\n"
else
echo "\033[93mOK, not doing anything\033[0m\n"
fi
else
echo "\033[93mNothing to do\033[0m"
fi