summaryrefslogtreecommitdiffstats
path: root/old/MigrateFromGitwebUnixPermToGitolite.sh
diff options
context:
space:
mode:
Diffstat (limited to 'old/MigrateFromGitwebUnixPermToGitolite.sh')
-rwxr-xr-xold/MigrateFromGitwebUnixPermToGitolite.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/old/MigrateFromGitwebUnixPermToGitolite.sh b/old/MigrateFromGitwebUnixPermToGitolite.sh
new file mode 100755
index 0000000..28f420d
--- /dev/null
+++ b/old/MigrateFromGitwebUnixPermToGitolite.sh
@@ -0,0 +1,42 @@
+find . -type d -name .git | while read gitdir; do
+pushd "$gitdir/../" > /dev/null
+
+name=`dirname "$gitdir"|cut -d / -f 2|cut -d ' ' -f 1`
+
+echo == Entering $name ==
+
+url=$(grep 'url = zx2c4.com:git.zx2c4.com' .git/config | cut -d '=' -f 2 | tr -d ' ')
+url=$(echo $url | cut -d ' ' -f 1)
+
+if ! echo $url | grep zx2c4.com > /dev/null; then
+ echo "Not a valid zx2c4 ssh repo."
+ echo
+ popd > /dev/null
+ continue
+fi
+
+echo $url
+scp $url/description .tmpdesc > /dev/null
+description=$(cat .tmpdesc)
+rm .tmpdesc
+echo $description
+
+sed -i -e "s/url = zx2c4.*$/url = gitcode@zx2c4.com:$name/g" .git/config
+
+pushd ~/Projects/gitolite-admin/conf > /dev/null
+echo "Writing config.."
+(echo
+echo " repo $name"
+echo " RW+CD = zx2c4"
+echo " R = @all"
+echo " $name \"Jason A. Donenfeld\" = \"$description\"") >> gitolite.conf
+git commit -a -m "Adding $name to repository."
+git push
+popd > /dev/null
+
+git push --all
+git push --tags
+
+echo
+popd > /dev/null
+done \ No newline at end of file