#!/bin/bash CURRNET_DATE=$(date +%Y_%m_%d) CURRENT_GUSER="Behrouz NematiPour" CURRENT_GEMAIL="bNematiPour@diality.com" # set the userr to the default, there were some scripts which were changing the git user. git config --global --replace-all user.name "$CURRENT_GUSER" git config --global --replace-all user.email "$CURRENT_GEMAIL" function patch_sources() { PASS=$(pwgen -ABcsnv1 16) cd DEV_TEST_DIR=$HOME/Diality_Dev_Test_$CURRNET_DATE rsync -Lr --exclude=".*" --exclude="*.log" --exclude="*.err" --exclude="*.swp" Projects/application $DEV_TEST_DIR cd $DEV_TEST_DIR zip --password=$PASS -r $DEV_TEST_DIR.zip application echo $PASS > $DEV_TEST_DIR.pas cd rm -frd $DEV_TEST_DIR } function update_outsource_dialin() { DIALIN_SOURCE=$HOME/Projects/dialin/dialin/* DIALIN_OUTSOURCE=$HOME/Projects/outsource/dialin/ COMMIT_MESSAGE=$CURRNET_DATE if [[ -n "$1" ]]; then COMMIT_MESSAGE="$1" fi echo " ---------- Updating the dialin outsource folder" rsync -Lr --exclude=".*" --exclude="*.log" --exclude="*.err" --exclude="*.swp" --exclude="__pychache__" $DIALIN_SOURCE $DIALIN_OUTSOURCE echo " ---------- push to the server [$COMMIT_MESSAGE]" cd $DIALIN_OUTSOURCE git add . git commit -m "$COMMIT_MESSAGE" git push -u origin master } function update_outsource_simulator() { SIMULATOR_SOURCE=$HOME/Projects/simulator/* SIMULATOR_OUTSOURCE=$HOME/Projects/outsource/simulator/ COMMIT_MESSAGE=$CURRNET_DATE if [[ -n "$1" ]]; then COMMIT_MESSAGE="$1" fi echo " ---------- Updating the simulator outsource folder" rsync -Lr --exclude=".*" --exclude="*.log" --exclude="*.err" --exclude="*.swp" --exclude="__pychache__" $SIMULATOR_SOURCE $SIMULATOR_OUTSOURCE echo " ---------- push to the server [$COMMIT_MESSAGE]" cd $SIMULATOR_OUTSOURCE git add . git commit -m "$COMMIT_MESSAGE" git push -u origin master } if [[ "$1" == "--source" ]]; then patch_sources fi if [[ "$1" == "--dialin" ]]; then update_outsource_dialin "$2" fi if [[ "$1" == "--simulator" ]]; then update_outsource_simulator "$2" fi if [[ "$1" == "" ]]; then echo "Usage:" echo "./run.vend.patch