Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "--- Analyzing archive data ---"
- mkdir -p open
- cd open
- for i in ../archive/*.tar.gz; do
- echo -n " unpacking..."
- VERSION=`echo $i | awk -F/ '{print $NF}' | cut -d- -f 2 | cut -d. -f -3`
- echo -n " $VERSION..."
- mkdir -p $VERSION
- cd $VERSION
- tar -x --strip-components=1 -f../$i
- echo -n " cleaning..."
- # Clean out cruft
- for j in .DS_Store ._.DS_Store .gdb_history .depend; do
- find . -name "$j" -print0 | xargs -0 rm -f
- done
- find . -type l -print0 | xargs -0 rm -f
- cd ..
- echo -n " permisioning..."
- find "$VERSION" -type d -print0 | xargs -0 chmod 755
- find "$VERSION" -type f -print0 | xargs -0 chmod 644
- for j in `find "$VERSION" -type f`; do
- FILETYPE=`file -nNk $j | grep -i 'executable'`
- if [ -n "$FILETYPE" ]; then
- chmod 755 "$j"
- fi
- done
- #for j in `find "$VERSION" -type f -print0 | xargs -0 file -nNk | grep -i 'executable' | awk -F: '{print $1}'`; do
- # chmod 755 "$j"
- #done
- echo -n " unemptying..."
- RECENT=`find "$VERSION" -type f -printf '%TY-%Tm-%Td %TT %p\n' | grep -v .git | colrm 20 | sort -r | head -1`
- touch -d "$RECENT" "$VERSION"
- for j in `find "$VERSION" -type d -empty`; do
- touch -d "$RECENT" "$j/.gitignore"
- done
- echo -n " stamping..."
- echo -en "$VERSION\t$RECENT\n" >"$VERSION/VERSION"
- touch -d "$RECENT" "$VERSION/VERSION"
- echo "done."
- done
- cd ..
- DIRS=`ls -d1 open/v* | awk -F/ '{print $NF}' | sort -n`
- TOTAL=`echo $DIRS | wc -w`
- exit 1
- echo "--- Creating git repository ---"
- mkdir -p nakedmud
- cd nakedmud
- git init >../git_checkin.log 2>../git_error.log
- DIRS=`ls -d1 ../open/v* | awk -F/ '{print $NF}' | sort -n`
- COUNT=0
- TOTAL=`echo $DIRS | wc -w`
- for i in $DIRS; do
- COUNT=$[ $COUNT + 1 ]
- echo -n "$i ($COUNT of $TOTAL) versioning..."
- git ls-files -z | xargs -0 rm -f
- find . -maxdepth 1 -type d -print0 | grep -z '^./[a-zA-Z0-9_]' | xargs -0 rm -rf
- cp -rp ../open/$i/* .
- cp -rp ../addons .
- cp -rp ../manuals .
- if [ -f "VERSION" ]; then
- RECENT=`cat "VERSION" | cut -f 2-`
- else
- RECENT=`find "../open/$i" -type f -printf '%TY-%Tm-%Td %TT %p\n' | grep -v .git | colrm 20 | sort -r | head -1`
- fi
- export GIT_AUTHOR_DATE="$RECENT"
- export GIT_COMMITTER_DATE="$RECENT"
- git add -A >>../git_checkin.log 2>>../git_error.log
- git commit -m $i >>../git_checkin.log 2>>../git_error.log
- git tag $i >>../git_checkin.log 2>>../git_error.log
- echo " done."
- done
- cd ..
- if [ -f git_error.log -a ! -s git_error.log ]; then
- rm git_error.log
- fi
- # If that looks like it worked properly...
- # git config --global user.name "Dread Quixadhal"
- # git config --global user.email [email protected]
- # git remote add origin [email protected]:quixadhal/nakedmud.git
- # git push --all
- # git push --tags
Advertisement
Add Comment
Please, Sign In to add comment