Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- SOURCE=`pwd`
- echo "Fast Git Project Updates 0.1"
- tab=($(find -maxdepth 3 -type d -name '.git'))
- echo "Detect" ${#tab[*]} "projects in "$SOURCE
- for dir in ${tab[*]};
- do
- dir=${dir:0:-4}
- if [ "$1" = "update" ]
- then
- echo -e "\E[32mUpdate " ${dir:2:-1} "\033[0m"
- cd $dir
- git pull > output
- a=`cat output`
- if [ "$a" = "Already up-to-date." ]
- then
- echo "No updates!"
- fi
- rm output
- cd $SOURCE
- elif [ "$1" = "upgrade" ]
- then
- echo -e "\E[32mUpgrade " ${dir:2:-1} "\033[0m"
- cd $dir
- if [ -e "CMakeLists.txt" ]
- then
- echo "Run Cmake"
- cmake .
- elif [ -e "configure" ]
- then
- echo "Run configure"
- configure .
- fi
- if [ -e "Makefile" ]
- then
- echo "Run make"
- make
- fi
- cd $SOURCE
- elif [ "$1" = "install" ]
- then
- if [ "$2" != "" ]
- then
- git clone $2
- fi
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment