3 # Copyright 2015 by Jan Vales <jan@jvales.net> (Someone <someone@somenet.org>)
4 # send me your changes. credit author(s). do not publish. share alike.
5 # to be done: find a suitable licence text.
7 # Script to add all directories in ./ to separate git repositories and push them somewhere safe.
10 echo "GIT ALL T3H SERVICES!"
13 if [[ $1 == "" ]] ; then
14 echo "ERROR: No commit message given! Aborting."
21 if [[ -d "${CURRENTPWD}/${dir}" ]] ; then
22 cd "${CURRENTPWD}/${dir}"
23 echo "Doing git dir: $dir"
25 if [[ ! -d ".git" ]] ; then
26 echo "*** WARN: git repo not found. creating..."
28 git config user.name git_all_script
29 git config user.email lol@example.com
30 git config rebase.stat true
32 git commit --allow-empty -m "Initial commit"
36 touch setPerms.autogenerated.sh
38 chown -R root:root "${CURRENTPWD}/${dir}/.git" "setPerms.autogenerated.sh"
39 chmod -R 600 "${CURRENTPWD}/${dir}/.git" "setPerms.autogenerated.sh"
41 find . -not -type l -not -path './.git/*' -exec stat {} -c "chmod %a \"%n\"; chown %u:%g \"%n\"" \; | sort -k 3 > setPerms.autogenerated.sh
43 chmod -R +x setPerms.autogenerated.sh
45 git config user.name git_all_script
46 git config user.email script@w0y.invalid
47 git config rebase.stat true
48 # git config remote.origin.url="ssh://git@s.i:2/media/sf_vmshare/git/${dir}"
49 # git config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
50 # git config branch.master.remote=origin
51 # git config branch.master.merge=refs/heads/master
52 git config branch.master.rebase true
60 echo "DONE. now rsync this directory away (pull from remote) NOW!"