Guest User

Untitled

a guest
Oct 11th, 2017
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. repo=$1
  4. log=$repo".repo_files/log.txt"
  5.  
  6. #if there is no repo_files folder in the repo make on
  7. test -e $repo.repo_files/ || (mkdir $repo".repo_files/" && chmod ug+rw $repo".repo_files/")
  8.  
  9. #Make ghost copies of the repo files if there is not a ghost repo located in the repo_files
  10. test -e $repo.repo_files/ghost_repo/ && echo 'Ghost Repo Found' || (mkdir $repo".repo_files/ghost_repo/" && chmod ug+rw $repo".repo_files/" && rsync -av --exclude=".*" $repo $repo".repo_files/ghost_repo")
  11.  
  12.  
  13. #Check to see if changes have been made
  14. #If there are changes note them down in a log file
  15. for f in $(ls $repo); do for f_ghost in $(ls $repo".repo_files/ghost_repo/"); do
  16. echo $f" "$f_ghost
  17. if ("$($f)" == "$($f_ghost)")
  18. then
  19. cat "#"$f": Changes"
  20. #lines added since last commit
  21. for line in $(comm -2 -3 $f $f_ghost); do
  22. ("[+]"$line) > $log
  23. done
  24. #lines removed since last commit
  25. for line in $(comm -1 -3 $f $f_ghost); do
  26. ("[-]"$line) > $log
  27. done
  28. fi
  29. done;
  30.  
  31. for f in $($repo".repo_files/ghost_repo"); do
  32. test -e $repo..$f && "$("[Deleted File] "$f)" > $log
  33. done
  34. for f in $($repo); do
  35. if -e $repo/.repo_files/ghost_repo/$f; then
  36. "$("[Added File] "$f)" > $log
  37. "$("#"$f": Changes")" > $log
  38. for line in $f; do
  39. ("[+]"$line) > $log
  40. done
  41. fi
  42. done
  43.  
  44.  
  45. done
Advertisement
Add Comment
Please, Sign In to add comment