Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/zsh
- PrintUsage() {
- echo "Usage: `basename $0` [-o log_file][-hv] <-aus> repositories"
- echo "Options:"
- echo "\ta: initialize, adds and publish the git repositories"
- echo "\tu: update all repositories"
- echo "\ts: get status of all repositories"
- echo "\to: set file for log"
- echo "\th: see this message"
- echo "\tv: get software version"
- exit 1
- }
- while getopts "hvo:au" OPTION
- do
- case $OPTION in
- h)
- PrintUsage
- ;;
- v)
- echo "`basename $0` version 0.2"
- exit
- ;;
- o)
- ARQUIVO_LOG=$OPTARG
- ;;
- a)
- DO_ALL=1
- ;;
- u)
- DO_UPDATE=1
- ;;
- s)
- SEE_STATUS=1
- ;;
- ?)
- PrintUsage
- ;;
- esac
- done
- shift $((OPTIND-1))
- if [ -z "$DO_ALL" ] && [ -z "$DO_UPDATE" ];
- then
- PrintUsage
- fi
- if [ "$ARQUIVO_LOG" ];
- then
- echo "Execucao iniciada em `date`." >> $ARQUIVO_LOG
- for FILE in $*;
- do
- cd $FILE
- if [ "$DO_ALL" = 1 ];
- then
- git init >> ../$ARQUIVO_LOG
- git remote add origin git@github.com:patricksferraz/$FILE.git >> ../$ARQUIVO_LOG
- git add * >> ../$ARQUIVO_LOG
- git commit -m "initial commit" >> ../$ARQUIVO_LOG
- git push origin master >> ../$ARQUIVO_LOG
- fi
- if [ "$DO_UPDATE" = 1 ];
- then
- git pull origin master >> ../$ARQUIVO_LOG
- git push origin master >> ../$ARQUIVO_LOG
- fi
- cd ..
- done
- else
- echo "Execucao iniciada em `date`."
- for FILE in $*;
- do
- cd $FILE
- if [ "$DO_ALL" = 1 ];
- then
- git init
- git remote add origin git@github.com:patricksferraz/$FILE.git
- git add *
- git commit -m "initial commit"
- git push origin master
- fi
- if [ "$DO_UPDATE" = 1 ];
- then
- git pull origin master
- git push origin master
- fi
- cd ..
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement