Advertisement
bssanchez93

Patch Automatico GIT

Aug 22nd, 2014
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.15 KB | None | 0 0
  1. #!/bin/bash
  2. for VAR in $@
  3. do
  4.         x="$VAR"
  5.         shift
  6.         case "$VAR" in
  7.         -o)
  8.                 echo -e "[*] Cambiando al directorio  $1"
  9.                 cd $1
  10.                 #shift
  11.         ;;
  12.         -d)
  13.                 if [ ! -d $1 ]; then
  14.                         mkdir $1
  15.                 fi
  16.                 target=$1
  17.                 #shift
  18.         ;;
  19.         -f)
  20.                 filelist=$1
  21.                 #shift
  22.         ;;
  23.         --help)
  24.                 echo -e "Las opciones son:\n"
  25.                 echo -e "\t-d\t\tDonde se generara el parche"
  26.                 echo -e "\t-o\t\tDesde donde se copiaran los archivo"
  27.                 echo -e "\t-f\t\tRuta del archivo con los cambios"
  28.                 echo -e "\t--help\t\tMuestra esta ayuda\n"
  29.                 exit
  30.         esac
  31. done
  32.  
  33. while read line
  34. do
  35.   target_dir=`dirname $line`
  36.   mkdir -p $target/$target_dir
  37.   cp -v $line $target/$target_dir
  38. done < $filelist
  39.  
  40. echo -e "[*] Comprimiendo parche $target"
  41. tar czf $(dirname "$target")/parche-$(date '+%F').tar.gz  $target
  42. echo -e "[*] Eliminado temporales"
  43. rm -rf $target
  44. echo -e "[*] Listo parche terminado..!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement