[FrontPage] [TitleIndex] [WordIndex

# Copyleft Matt Jadud (matthew.jadud at olin dot edu)
# 
# This script is placed under the GPL v2 or later, and 
# may be the worst thing you ever did to your MoinMoin wiki.
# In theory, you should execute it in your wiki's "pages" directory.
# 
# Before executing this script, you do need to edit a few things.
# Please do.

########################################
# SET THESE VARIABLES
########################################

# You definitely want to choose an archive name.
ARCHIVE=FallOhSix

# You can probably leave the temp name alone
TEMPFILE=_to_backup

# This is used in an echo at the end; note 
# the trailing slash.
WEBROOT=http://hfid.olin.edu/hfidwiki/

########################################
# Save a list of files that are not already archived.
########################################
# First, get a list of everything in this directory, and 
# filter out all of the previous backups.
# It needs to be extended with a new 'grep -v' for each semester
# that gets backed up.
ls  | grep -v SpringOhFive \
        | grep -v FallOhFive \
        | grep -v FallOhSix \
        | grep -v .py \
        | grep -v backup_semester \
        > $TEMPFILE

########################################
########################################
# EDIT NOTHING BEYOND THIS POINT
########################################
########################################

########################################
# COPY DIRECTORIES
# Now, for each of the WikiDirectories we want to copy,
# erm... copy them. It has to have depth, and it 
# Needs to use the variable defined above.

for i in `cat $TEMPFILE` ; do echo [ARCHIVING] $i ; cp -R $i $ARCHIVE\(2f\)$i ; done

########################################
# Remove the temp list of files to copy.
rm  $TEMPFILE

########################################
# CREATE ARCHIVE PAGE IN MOINMOIN FORMAT
# 
# The last step is to automagically create a new wikipage.
# This will create the directory $ARCHIVE, and then populate
# it with the contents that MoinMoin expects to see.
#
# This way, you don't have to do anything in the wiki itself.

# Might as well make it the first revision.
REVISION=00000001

# Create the appropriate directories.
mkdir $ARCHIVE
mkdir $ARCHIVE/cache
mkdir $ARCHIVE/revisions
echo $REVISION > $ARCHIVE/current

# Output the page that will list all of the archives we've just created.

echo "This is an archive of the HFID wiki from the $ARCHIVE semester. It was created on:" >> $ARCHIVE/revisions/$REVISION
echo >> $ARCHIVE/revisions/$REVISION
echo >> $ARCHIVE/revisions/$REVISION
echo `date` >> $ARCHIVE/revisions/$REVISION
echo >> $ARCHIVE/revisions/$REVISION
echo >> $ARCHIVE/revisions/$REVISION
echo "[[Navigation(children)]]" >> $ARCHIVE/revisions/$REVISION

########################################
# ECHO A URL
# Before we go on, I'll echo out the URL to the new archive.
echo
echo Your new archive can be found on the web at:
echo
echo $WEBROOT$ARCHIVE
echo

2013-07-17 10:17