From b3f7f505eabe682fee0b4cc9cf02a45e965e62ea Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 28 Jul 2010 17:11:31 +0200 Subject: Move old scripts to old script directory. --- MigrateFromGitwebUnixPermToGitolite.sh | 42 --------------- NewCGitUnixPermGitProject.sh | 85 ------------------------------ UploadContentsToAnyclipServer.sh | 5 -- UploadNewGitGitwebUnixPerm.sh | 17 ------ old/MigrateFromGitwebUnixPermToGitolite.sh | 42 +++++++++++++++ old/NewCGitUnixPermGitProject.sh | 85 ++++++++++++++++++++++++++++++ old/UploadContentsToAnyclipServer.sh | 5 ++ old/UploadNewGitGitwebUnixPerm.sh | 17 ++++++ 8 files changed, 149 insertions(+), 149 deletions(-) delete mode 100755 MigrateFromGitwebUnixPermToGitolite.sh delete mode 100755 NewCGitUnixPermGitProject.sh delete mode 100755 UploadContentsToAnyclipServer.sh delete mode 100755 UploadNewGitGitwebUnixPerm.sh create mode 100755 old/MigrateFromGitwebUnixPermToGitolite.sh create mode 100755 old/NewCGitUnixPermGitProject.sh create mode 100755 old/UploadContentsToAnyclipServer.sh create mode 100755 old/UploadNewGitGitwebUnixPerm.sh diff --git a/MigrateFromGitwebUnixPermToGitolite.sh b/MigrateFromGitwebUnixPermToGitolite.sh deleted file mode 100755 index 28f420d..0000000 --- a/MigrateFromGitwebUnixPermToGitolite.sh +++ /dev/null @@ -1,42 +0,0 @@ -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 diff --git a/NewCGitUnixPermGitProject.sh b/NewCGitUnixPermGitProject.sh deleted file mode 100755 index 856c884..0000000 --- a/NewCGitUnixPermGitProject.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh - -##### Configure These Vars: ##### - -USER="git" -HOST="labs.anyclip.com" -REPOS="/home/$USER" -POSTCMD="$REPOS/updatewebinterface.sh" - -################################# - - -# Check environment -if [ "$1" == "" ]; then - echo "The first argument of this script must be the description of the git repository." - exit 1 -fi -if [ ! -d ".git" ]; then - echo "The current directory is not a git repository." - exit 1 -fi - -# Initialize constants -repository="`pwd | xargs -0 basename | tr -d ' '`" -connection="$USER@$HOST" -hash="`echo $REPOS $repository $connection $(date +%s%N) | md5sum | cut -d ' ' -f 1`" -options="-o ControlMaster=auto -o ControlPath=./.sshcontrolmaster-$hash" -gitsshpath="./.gitssh-$hash" - -# Create git ssh stub to use our options -echo -n "[*] Creating git ssh wrapper script..." -(echo '#!/bin/sh' > $gitsshpath && -echo -n 'exec ssh ' >> $gitsshpath && -echo -n "$options " >> $gitsshpath && -echo '"$@"' >> $gitsshpath && -chmod +x $gitsshpath) || { echo "failure!"; exit 1; } -echo "success." -export GIT_SSH="$gitsshpath" - -# Setup control master -echo -n "[*] Connecting to server..." -ssh $options -fN $connection || { echo "failure!"; exit 1; } -echo "success." - -# Create bare repo on server -echo -n "[*] Creating bare remote repository..." -ssh $options $connection "\ - cd \"$REPOS\" && \ - mkdir \"$repository\" &&\ - cd \"$repository\" &&\ - git init --bare &&\ - echo \"$1\" > description &&\ - mv hooks/post-update.sample hooks/post-update &&\ - chmod +x hooks/post-update;" > /dev/null 2>&1 || { echo "failure!"; exit 1; } -echo "success." - -# Add configuration for remote repo to local repo -echo -n "[*] Setting up local configuration..." -echo "[remote \"origin\"] - url = $connection:$REPOS/$repository - fetch = +refs/heads/*:refs/remotes/origin/* -[branch \"master\"] - remote = origin - merge = refs/heads/master" >> .git/config || { echo "failure!"; exit 1; } -echo "success." - -# Push local repo to remote repo -echo -n "[*] Uploading repository..." -git push --all > /dev/null 2>&1 || { echo "failure!"; exit 1; } -echo "success." - -# Run the post command if there is one -if [ "$POSTCMD" != "" ]; then - echo -n "[*] Running post-command..." - ssh $options $connection "$POSTCMD" || { echo "failure!"; exit 1; } - echo "success." -fi - -# Kill the ssh control master, delete gitssh wrapper -echo -n "[*] Cleaning up..." -ssh $options -O exit $connection 2> /dev/null || echo "\n\tClean up failed: could not kill ssh control master." -rm $gitsshpath > /dev/null || echo "\n\tClean up failed: could not delete git ssh wrapper." -echo "success." - -echo "Complete!" diff --git a/UploadContentsToAnyclipServer.sh b/UploadContentsToAnyclipServer.sh deleted file mode 100755 index 297a921..0000000 --- a/UploadContentsToAnyclipServer.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -shopt -s dotglob -directory=`pwd` -base=`basename "$directory"` -rsync -rlptDvz --exclude=*.pyc --exclude=.git --exclude=.gitignore --delete-excluded $1* labs.anyclip.com:/var/www/localhost/htdocs/$base/ diff --git a/UploadNewGitGitwebUnixPerm.sh b/UploadNewGitGitwebUnixPerm.sh deleted file mode 100755 index b846a69..0000000 --- a/UploadNewGitGitwebUnixPerm.sh +++ /dev/null @@ -1,17 +0,0 @@ -currentDir=`pwd` -targetDir="`basename \"$currentDir\" | tr "[:upper:]" "[:lower:]"`.git" -ssh zx2c4.com "\ -cd ~/git.zx2c4.com;\ -mkdir \"$targetDir\";\ -cd \"$targetDir\"; -git init --bare;\ -echo \"$1\" > description;\ -mv hooks/post-update.sample hooks/post-update;\ -chmod +x hooks/post-update" -echo "[remote \"origin\"] - url = zx2c4.com:git.zx2c4.com/$targetDir - fetch = +refs/heads/*:refs/remotes/origin/* -[branch \"master\"] - remote = origin - merge = refs/heads/master" >> .git/config -git push --all 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 diff --git a/old/NewCGitUnixPermGitProject.sh b/old/NewCGitUnixPermGitProject.sh new file mode 100755 index 0000000..856c884 --- /dev/null +++ b/old/NewCGitUnixPermGitProject.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +##### Configure These Vars: ##### + +USER="git" +HOST="labs.anyclip.com" +REPOS="/home/$USER" +POSTCMD="$REPOS/updatewebinterface.sh" + +################################# + + +# Check environment +if [ "$1" == "" ]; then + echo "The first argument of this script must be the description of the git repository." + exit 1 +fi +if [ ! -d ".git" ]; then + echo "The current directory is not a git repository." + exit 1 +fi + +# Initialize constants +repository="`pwd | xargs -0 basename | tr -d ' '`" +connection="$USER@$HOST" +hash="`echo $REPOS $repository $connection $(date +%s%N) | md5sum | cut -d ' ' -f 1`" +options="-o ControlMaster=auto -o ControlPath=./.sshcontrolmaster-$hash" +gitsshpath="./.gitssh-$hash" + +# Create git ssh stub to use our options +echo -n "[*] Creating git ssh wrapper script..." +(echo '#!/bin/sh' > $gitsshpath && +echo -n 'exec ssh ' >> $gitsshpath && +echo -n "$options " >> $gitsshpath && +echo '"$@"' >> $gitsshpath && +chmod +x $gitsshpath) || { echo "failure!"; exit 1; } +echo "success." +export GIT_SSH="$gitsshpath" + +# Setup control master +echo -n "[*] Connecting to server..." +ssh $options -fN $connection || { echo "failure!"; exit 1; } +echo "success." + +# Create bare repo on server +echo -n "[*] Creating bare remote repository..." +ssh $options $connection "\ + cd \"$REPOS\" && \ + mkdir \"$repository\" &&\ + cd \"$repository\" &&\ + git init --bare &&\ + echo \"$1\" > description &&\ + mv hooks/post-update.sample hooks/post-update &&\ + chmod +x hooks/post-update;" > /dev/null 2>&1 || { echo "failure!"; exit 1; } +echo "success." + +# Add configuration for remote repo to local repo +echo -n "[*] Setting up local configuration..." +echo "[remote \"origin\"] + url = $connection:$REPOS/$repository + fetch = +refs/heads/*:refs/remotes/origin/* +[branch \"master\"] + remote = origin + merge = refs/heads/master" >> .git/config || { echo "failure!"; exit 1; } +echo "success." + +# Push local repo to remote repo +echo -n "[*] Uploading repository..." +git push --all > /dev/null 2>&1 || { echo "failure!"; exit 1; } +echo "success." + +# Run the post command if there is one +if [ "$POSTCMD" != "" ]; then + echo -n "[*] Running post-command..." + ssh $options $connection "$POSTCMD" || { echo "failure!"; exit 1; } + echo "success." +fi + +# Kill the ssh control master, delete gitssh wrapper +echo -n "[*] Cleaning up..." +ssh $options -O exit $connection 2> /dev/null || echo "\n\tClean up failed: could not kill ssh control master." +rm $gitsshpath > /dev/null || echo "\n\tClean up failed: could not delete git ssh wrapper." +echo "success." + +echo "Complete!" diff --git a/old/UploadContentsToAnyclipServer.sh b/old/UploadContentsToAnyclipServer.sh new file mode 100755 index 0000000..297a921 --- /dev/null +++ b/old/UploadContentsToAnyclipServer.sh @@ -0,0 +1,5 @@ +#!/bin/sh +shopt -s dotglob +directory=`pwd` +base=`basename "$directory"` +rsync -rlptDvz --exclude=*.pyc --exclude=.git --exclude=.gitignore --delete-excluded $1* labs.anyclip.com:/var/www/localhost/htdocs/$base/ diff --git a/old/UploadNewGitGitwebUnixPerm.sh b/old/UploadNewGitGitwebUnixPerm.sh new file mode 100755 index 0000000..b846a69 --- /dev/null +++ b/old/UploadNewGitGitwebUnixPerm.sh @@ -0,0 +1,17 @@ +currentDir=`pwd` +targetDir="`basename \"$currentDir\" | tr "[:upper:]" "[:lower:]"`.git" +ssh zx2c4.com "\ +cd ~/git.zx2c4.com;\ +mkdir \"$targetDir\";\ +cd \"$targetDir\"; +git init --bare;\ +echo \"$1\" > description;\ +mv hooks/post-update.sample hooks/post-update;\ +chmod +x hooks/post-update" +echo "[remote \"origin\"] + url = zx2c4.com:git.zx2c4.com/$targetDir + fetch = +refs/heads/*:refs/remotes/origin/* +[branch \"master\"] + remote = origin + merge = refs/heads/master" >> .git/config +git push --all -- cgit v1.2.3-59-g8ed1b